Blog to understand automation concepts in QTP, Selenium Webdriver and Manual Testing concepts

Synchronization in QTP


      A synchronization point instructs QTP to wait until certain response from the application during playback.Synchronization point is required due to reason that when a test is run, the application may not always respond with the same speed. For example, it might take some extra time for below activities


  • 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

      Synchronization can be used to ensure that QTP waits until the application is ready  before performing a certain step in following ways:


  • Timeout Value Modification
  • Using WaitProperty
  • Using Wait  Statement
  • Using Exist Statement

Timeout Value modification


Object Synchronization timeout  Sets the maximum time (in seconds) that QTP waits for an  
object to load before running a step in the test.

To define the Object  Synchronization timeout, Access  File > Settings > Run.



Using WaitProperty


Adding a synchronization point instructs QTP to pause the test until an object property  achieves the value specified.

The below dialog box enables to insert a WaitProperty statement to synchronize test.


How to Access:


  • Start a recording session.
  • Display the screen or page in application that contains the object for which a synchronization point needs to be inserted.
  • In the QTP window, select Insert >Synchronization Point.

WaitProperty is displayed in Expert View as shown below
Browser(".").Page("…").WebElement("…").WaitProperty "visible", true, 10000


Using Wait and Exist Statement


Exist and/or Wait statements can be used to instruct QTP to wait for a window to open or an object to appear

Exist Statement:


Exist statements return a Boolean value indicating whether or not an object currently exists

Eg:  blnExist = Browser(“…”).Page(“…”).Object.exist

Wait Statement:


Wait statements instruct Quick Test to wait a specified amount of time before proceeding to the next step.

Eg:  Wait(30)

Below code shows an example of Using Wait and Exist Statement for synchronization.

blnDone=Window("Flight Reservation").Dialog("Flights Table").Exist
counter=1
While Not blnDone
Wait (2)
blnDone=Window("Flight Reservation").Dialog("Flights Table").Exist
counter=counter+1
If counter=10 then
blnDone=True
End if
Wend 




No comments:

Post a Comment