Creating Tests Using Context Sensitive Recording - WinRunner

Context Sensitive mode records the operations you perform on your application in terms of its GUI objects. As you record, WinRunner identifies each GUI object you click (such as a window, button, or list), and the type of operation performed (such as drag, click, or select).

For example, if you click the Open button in an Open dialog box, WinRunner records the following:

button_press ("Open");

When it runs the test, WinRunner looks for the Open dialog box and the Open button represented in the test script. If, in subsequent runs of the test, the button is in a different location in the Open dialog box, WinRunner is still able to find it.

Creating Tests Using Context Sensitive Recording

Use Context Sensitive mode to test your application by operating on its user interface. For example, WinRunner can perform GUI operations (such as button clicks and menu or list selections), and then check the outcome by observing the state of different GUI objects (the state of a check box, the contents of a text box, the selected item in a list, and so on).

Remember that Context Sensitive tests work in conjunction with the GUI map and GUI map files. It is strongly recommended to read the “Understanding the GUI Map” section of this guide before you start recording.

The following example illustrates the connection between the test script and the GUI map. It also demonstrates the connection between the logical name and the physical description. Assume that you record a test in which you print a readme file by choosing the Print command on the File menu to open the Print dialog box, and then clicking the OK button. The test script might look like this:

WinRunner learns the actual description—the list of properties and their values—for each object involved and writes this description in the GUI map. When you open the GUI map and highlight an object, you can view the physical description. In the following example, the Readme.doc window is highlighted in the GUI map:

Readme.doc window is highlighted in the GUI map

WinRunner writes the following descriptions for the other window and objects in the GUI map:

Filemenu: {class:menu_item, label:File, parent:None}
Print command: {class: menu_item, label: "Print... Ctrl+P", parent: File}
Print window: {class:window, label:Print}
OK button: {class:push_button, label:OK}

(To see these descriptions, you would highlight the windows or objects in the GUI map in order to see the corresponding physical description below.) WinRunner also assigns a logical name to each object. As WinRunner runs the test, it reads the logical name of each object in the test script and refers to its physical description in the GUI map. WinRunner then uses this description to find the object in the application being tested.

To record a test in context sensitive mode:

  1. Choose Test > Record–Context Sensitive or click the Record–Context Sensitive button.
  2. The letters Rec are displayed in dark blue text with a light blue background on the Record button to indicate that a context sensitive record session is active.

  3. Perform the test as planned using the keyboard and mouse.
  4. Insert checkpoints and synchronization points as needed by choosing the appropriate commands from the User toolbar or from the Insert menu menu: GUI Checkpoint, Bitmap Checkpoint, Database Checkpoint, or Synchronization Point.

  5. To stop recording, click Test > Stop Recording or click Stop.

Solving Common Context Sensitive Recording Problems

This section discusses common problems that can occur while creating Context Sensitive tests.

WinRunner Does Not Record the Appropriate TSL Statements for Your Object

You record on an object, but WinRunner does not record the appropriate TSL statements for the object class. Instead, WinRunner records obj_mouse statements. This occurs when WinRunner does not recognize the class to which your object belongs, and therefore it assigns it to the generic “object”class.

There are several possible causes and solutions:

several possible causes and solutions

WinRunner Cannot Read Text from HTML Pages in Your Application

There are several possible causes and solutions:

WinRunner Cannot Read Text from HTML Pages in Your Application


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

WinRunner Topics