When you run tests, your application may not always respond with the same speed. For example, it might take a few seconds:
- For a progress bar to reach 100%
- For a status message to appear
- For a button to become enabled
- For a window or pop-up message to open
You can handle these anticipated timing problems by synchronizing your test to ensure that QuickTest waits until your application is ready before performing a certain step.
There are several options that you can use to synchronize your test:
- You can insert a synchronization point, which instructs QuickTest to pause the test until an object property achieves the value you specify. When you insert a synchronization point into your test, QuickTest generates a WaitProperty statement in the Expert View.
- You can insert Exist or Wait statements that instruct QuickTest to wait until an object exists or to wait a specified amount of time before continuing the test.
- You can also increase the default timeout settings in the Test Settings and Options dialog boxes in order
Inserting synchronization point
First find where you want to insert synchronization point and click on record à insert à synchronization point à select the object à select the property and value à OK.
Syntax: -
Object.waitproperty “property name”, “property value”, time out
Ex: If you’re inserting a synchronization point on insert order in flight reservation application then the statement will be like this.
Window ("Flight Reservation").Winbutton ("Insert Order").WaitProperty "enabled", 1, 10000
Difference between wait and synchronization point
Wait (20)à waits for 20 seconds. It’s mandatory to wait for 20 seconds.
At same place if you’re giving synchronization point and mention 20 seconds to wait and that wait is not mandatory. When ever the given condition becomes true below 20 seconds then QTP immediately goes to the next step without wait for 20 seconds.
'**************************************************************************
'Writing own synchronization Point
oTimeout=100
For oTime=1 to oTimeout
oPropval=window("Flight Reservation").WinButton("Delete Order").GetROProperty("enabled")
If oPropval=true Then
Exit for
else
wait(1)
End If
Next
'**************************************************************************
Hi Sudhakar,
ReplyDeleteYour articles are nice.Easy to understand.
Hi
ReplyDeleteHow to achieve this in vb script...can you pls let me know
Yeah, your explanation is crystal clear and very much in detailed.
ReplyDelete