Waiting for Property Values of Objects and Windows - WinRunner

You can create a property value synchronization point, which instructs WinRunner to wait for a specified property value to appear in a GUI object. For example, you can tell WinRunner to wait for a button to become enabled or for an item to be selected from a list.

The method for synchronizing a test is identical for property values of objects and windows. You start by choosing Insert > Synchronization Point > For Object/Window Property. As you pass the mouse pointer over your application, objects and windows flash. To select a window, you click the title bar or the menu bar of the desired window. To select an object, you click the object.

A dialog box opens containing the name of the selected window or object. You can specify which property of the window or object to check, the expected value of that property, and the amount of time that WinRunner waits at the synchronization point.

A statement with one of the following functions is added to the test script, depending on which GUI object you selected:

Waiting for Property Values of Objects and Windows

During a test run, WinRunner suspends the test run until the specified property value in a GUI object is detected. It then compares the current value of the specified property with its expected value. If the property values match, then WinRunner continues the test.

In the event that the specified property value of the GUI object does not appear, WinRunner displays an error message, when the mismatch_break testing option is on. For information about the mismatch_break testing option, see “Setting Testing Options from a Test Script.” You can also set this testing option globally using the corresponding Break when verification fails option in the Run > Settings category of the General Options dialog box.

If the window or object you capture has a name that varies from run to run, you can define a regular expression in its physical description in the GUI map. This instructs WinRunner to ignore all or part of the name.

During recording, when you capture an object in a window other than the active window, WinRunner automatically generates a set_window statement.

To insert a property value synchronization point:

  1. Choose Insert > Synchronization Point > For Object/Window Property or click the Synchronization Point for Object/Window Property button on the User toolbar. The mouse pointer becomes a pointing hand.
  2. Highlight the desired object or window. To highlight an object, place the mouse pointer over it. To highlight a window, place the mouse pointer over the title bar or the menu bar.
  3. Click the left mouse button. Depending on whether you clicked an object or a window, either the Wait for Object or the Wait for Window dialog box opens.
  4. To insert a property value synchronization point

  5. Specify the parameters of the property check to be carried out on the window or object, as follows:
    • Window or <Object type>: The name of the window or object you clicked appears in a read-only box. To select a different window or object, click the pointing hand.
    • Property: Select the property of the object or window to be checked from the list. The default property for the window or type of object specified above appears by default in this box.
    • Value: Enter the expected value of the property of the object or window to be checked. The current value of this property appears by default in this box.
    • Time: Enter the amount of time (in seconds) that WinRunner waits at the synchronization point in addition to the amount of time that WinRunner waits specified in the timeout_msec testing option. You can change the default amount of time that WinRunner waits using the timeout_msec testing option. You can also change the default timeout value in the Timeout for checkpoints and CS statements box in the Run > Settings category of the General Options dialog box.
  6. Click Paste to paste this statement into your test script.

The dialog box closes and a _wait_info statement that checks the property values of an object is inserted into your test script. For example, button_wait_info has the following syntax:

button_wait_info ( button, property, valuetime );

The button is the name of the button. The property is any property that is used by the button object class. The value is the value that must appear before the test run can continue. The time is the maximum number of seconds WinRunner should wait at the synchronization point, added to the timeout_msec testing option.

For example, suppose that while testing the Flight Reservation application you order a plane ticket by typing in passenger and flight information and clicking Insert. The application takes a few seconds to process the order. Once the operation is completed, you click Delete to delete the order.

In order for the test to run smoothly, a button_wait_info statement is needed in the test script. This function tells WinRunner to wait up to 10 seconds (plus the timeout interval) for the Delete button to become enabled. This ensures that the test does not attempt to delete the order while the application is still processing it. The following is a segment of the test script:

button_press ("Insert");
button_wait_info ("Delete","enabled",1,"10");
button_press ("Delete");

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

WinRunner Topics