Tuesday, September 4, 2007

QTP Sync, Wait and Synchronization

Synchronization makes available specified amount of time for an object to process prior to moving on to the next step.

Wait is like forcing the QTP to wait for a specified amount of time while synchronization is not a 'forced' wait e.g. whenever a specific page loads QTP moves forward in case of synchronization, but in case of wait, if the wait is for 10 seconds and a webpage loads in 3 seconds then it still waits for 7 seconds.

Synchronization is there to take care of the timing problems between QTP and the AUT. Examples where synchronization can be used:

For a web page to load.
For a button to become enabled or disabled.
For client-server communications to finish.

Synchronization is possible in many ways:

We can insert a synchronization point for example for a progress bar to reach 100%. QTP will generate a WaitProperty statement in the Expert View in case of synchronization.

We can use Exist or Wait statements. Exist statements always return a Boolean (0 or 1) value.

We can also modify the default amount of time that QTP waits for a Web page to load.
(Browser Navigation Timeout, File(menu)-> Settings-> Web tab)

When working with tests, we can increase the default timeout settings for a test to instruct QuickTest to allow more time for objects to appear.
(Object Synchronization Timeout, File(menu)-> Settings-> Run tab)

Synchronization is enabled only during recording.

I will be talking about Sync, Wait, WaitProperty-->result of synchronization).

Example of Synchronization

Example of Wait

Example of Sync