Wednesday, January 21, 2015

Synchronization


1.1       Synchronizing Your Tests


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 button to become enabled.
·         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 Quick Test waits until your application is ready before performing a certain step

1.2       Options to Synchronize Tests

There are several options that you can use to synchronize your test:

·         You can insert a synchronization point, which instructs Quick Test to pause the test until an object property achieves the value you specify.
  • You can insert Exist or Wait statements that instruct Quick Test 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 to instruct Quick Test to allow more time for certain events to occur.

1.2.1 Inserting Synchronization Point

  • Begin recording your test.
·         Display the screen or page in your application that contains the object for which you want to insert a synchronization point.

  • In Quick Test choose Insert > Step > Synchronization Point. The mouse pointer turns into a pointing hand.

  • Click the object in your application for which you want to insert a synchronization point.
If the location you click is associated with more than one object in your application, the Object Selection – Synchronization Point dialog box opens.

Select the object for which you want to insert a synchronization point, and click OK.
The Add Synchronization Point dialog box opens.

·         The Property name list contains the test object properties associated with the object. Select the Property name you want to use for the synchronization point.

  • Enter the property value for which Quick Test should wait before continuing to the next step in the test.

  • Enter the synchronization point timeout (in milliseconds) after which Quick Test should continue to the next step, even if the specified property value was not achieved.

  • Click OK. A Wait Property( )step is added to your test.

For example, if you insert a synchronization point for the Update Order button, it may look something like this:

Window("Flights").WinButton("Update Order").WaitProperty "enabled", 1, 3000

1.2.2  Adding Exist and Wait Statements


You can use Exist and/or Wait statements in the Expert View to instruct Quick Test to wait for a window to open or an object to appear.

Exist statements return a Boolean value indicating whether or not an object currently exists.
Example following statement returns whether Flights Table is displayed:
y=Window("Flight Reservation").Dialog("Flights Table").Exist
 
Wait statements instruct Quick Test to wait a specified amount of time before proceeding to the next.

Example following statement waits for 10 seconds:
Wait (10)

Global synchronization Settings

Modifying Timeout Values
  • To modify the maximum amount of time that Quick Test waits for an object to appear, change the Object Synchronization Timeout (Test > Settings > Run tab).
  • To modify the amount of time that Quick Test waits for a Web page to load, change the Browser Navigation Timeout (Test > Settings > Web tab).


No comments: