Monday, March 12, 2007

Adding GUI Checkpoints to a Test Script

Adding GUI Checkpoints to a Test Script

In this exercise you will check that objects in the Flight Reservation Open Order
dialog box function properly when you open an existing order.
1 Start WinRunner and open a new test.
If WinRunner is not already open, choose Programs > WinRunner >
WinRunner on the Start menu. If the Welcome window is open, click the New
Test button. Otherwise, choose File > New. A new test window opens.
2 Start the Flight Reservation application and log in.
Choose Programs > WinRunner > Sample Applications > Flight 1A on the
Start menu. In the Login window, type your name and the password mercury,
and click OK. Reposition the Flight Reservation application and WinRunner so
that they are both clearly visible on your desktop.
3 Start recording in Context Sensitive mode.
Choose Create > Record—Context Sensitive or click the Record button on the
toolbar.
4 Open the Open Order dialog box.
Choose File > Open Order in the Flight Reservation application.

5 Create a GUI checkpoint for the Order No. check box.
Choose Create > GUI Checkpoint > For Object/Window, or click the GUI
Checkpoint for Object/Window button on the User toolbar.

Use the pointer to double-click the Order No. check box. The Check GUI
dialog box opens and displays the available checks. Note that this dialog box
does not open if you only single-clicked the Order No. check box. Accept the
default check, "State." This check captures the current state (off) of the check
box and stores it as expected results.
Click OK in the Check GUI dialog box to insert the checkpoint into the test script.
The checkpoint appears as an obj_check_gui statement.
6 Enter "4" as the Order No.
Select the Order No. check box and type in 4 in the Order No. text box.
7 Create another GUI checkpoint for the Order No. check box.
Choose Create > GUI Checkpoint > For Object/Window or click the
GUI Checkpoint for Object/Window button on the User toolbar.
Use the pointer to single-click the Order No. check box. WinRunner
immediately inserts a checkpoint into the test script (an obj_check_gui
statement) that checks the default check "State." (Use this shortcut when you
want to use only the default check for an object.) This check captures the current
state (on) of the check box and stores it as expected results.
8 Create a GUI checkpoint for the Customer Name check box.
Choose Create > GUI Checkpoint > For Object/Window or click the
GUI Checkpoint for Object/Window button on the User toolbar.
Use the pointer to double-click the Customer Name check box. The Check
GUI dialog box opens and displays the available checks. Accept the default
check "State" and select "Enabled" as an additional check. The State check
captures the current state (off) of the check box; the Enabled check captures the
current condition (off) of the check box.
Click OK in the Check GUI dialog box to insert the checkpoint into the test script.
The checkpoint appears as an obj_check_gui statement.
9 Click OK in the Open Order dialog box to open the order.
10 Stop recording.
Choose Create > Stop Recording or click the Stop button.
11 Save the test.
Choose File > Save or click the Save button. Save the test as lesson5 in a
convenient location on your hard drive. Click Save to close the Save Test dialog
box.
12 If you are working in the Global GUI Map File mode, save the new objects
to the GUI map.
Choose Tools > GUI Map Editor. Choose View > GUI Files. Choose File >
Save. Click Yes or OK to add the new object or new window to your GUI map.
Choose File > Exit to close the GUI Map Editor.