Synchronization point and Wait functions in QTP.

What is Synchronization point in QTP?

Synchronization is a method used in QTP to handle the time mismatch between QTP and AUT(Application under test, When  an application starts it will not always sink with the QTP Test due to Performance, sometimes it may run quick and sometimes not. Few examples below when synchronization is needed or occurred.

  • For Progress bar to reach 100%
  • For a status message to appear
  • For button to become enabled
  • For a window or popup message to open
  • For a web page to load
  • For client-server communications to interact

Types of Synchronization point in QTP:

Insert Synchronization point

Till an object is identified by QTP, Synchronization point helps to keep wait, once an object is identified then it exits.

Wait (5)

Wait is like putting QTP to wait for a specified amount of time whether an object is identified or not, while Synchronization is not a ‘forced’ wait which means it make QTP to wait until the process is completed.

Default Synchronization wait time in QTP is 20 Seconds

Synchronization point in QTP-settings

Wait –Keyword in QTP

Wait (5) -5 is seconds

It’s always advised to use Synchronization point rather than wait, because even after if object is found QTP will wait till the amount of time specified in the wait statement.

Several ways to synchronize the test

  • A Synchronization point can be interested, which instructs Quick test to pause the test until an object property achieves the value which specified by the user, when a Synchronization point is inserted in to the test, Quick Test generates a Wait Property statement in the expert view
  • Exist or wait statements can be inserted that instruct Quick test to wait until an object exists or wait a specified amount of time before continuing the test
  • The default timeout settings can also be included in the test settings and options dialog boxes in order to instruct Quick Test to allow more time for certain events to occur.

Press F3 in QTP and Open Flight reservation application, Login with proper password ‘mercury’ , now after login you will see Flight Reservation Window, Enter “Date of Flight” ,Fly From and Fly to”, select Flight from list, Enter name and click “Insert Order Button”

Note: If QTP runs this script without inserting Synchronization point, QTP will perform all actions as recorded, but it will shows the result as pass before “insert Done..” message is shown in the progress bar, this is the timing problem between QTP and AUT, because sometimes Application may fail to insert the record in to the database, but QTP gives the result “Pass, To overcome this problem the Synchronization point is added in the script by following method

How to insert Synchronization point in QTP Test?

  • Go to Insert Menu ->Step->Synchronization Point, QTP will be minimized and cursor will be changed to Hand icon
  • Click on the “Insert done” text in the progress bar of flight reservation window
  • ‘Object Selection – Synchronization Point’ window will open with ActiveX Thread Panel Control” as below
  • Click on ok Button
  • Add Synchronization Point window opens up, Choose property name as ‘text’ and give the property value as “Insert Done….” shown in the progress bar(Don’t forget to put those 3 dots, and double quotation (Ex. In the property value text box)
  • Click in the “Add Synchronization Point”
  • Click stop recording
  • The code in the expert View looks like below statement

Window (“Flight Reservation”).ActiveX(“Thread Panel Control”).wait Property “text”; Insert Done…”,20000(can be modified in Add Synchronization dialog)

  • Save the test
  • Open the new order from in the flight reservation and run the script.
Article Name
Synchronization point and Wait functions in QTP.
Synchronization point is a method used in QTP to handle the time mismatch between QTP and Application under test, There are two types.
Publisher Name
Publisher Logo

Leave a Reply

Your email address will not be published. Required fields are marked *