Tuesday, March 13, 2007

Reading Text from an Application

In this exercise you will record the process of opening the graph in the Flight Reservation application to read the total number of tickets sold, creating a new order, and opening the graph again. In the next exercise you will add programming elements to the test script that verify the text in the graph.
Note that in order for WinRunner to read text on computers with certain display drivers, including ATI, you must learn the fonts in the Flight Reservation application before you can perform this exercise. If WinRunner fails to read text in the exercise below, stop the exercise, follow the instructions in "Teaching Fonts to WinRunner" in the next section, and then repeat this exercise from the beginning.
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 Open 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.
4 Open the graph.
In the Flight Reservation application, choose Analysis > Graphs.
5 Read the total from the graph.
In WinRunner, choose Create > Get Text > From Screen Area, or click the Get Text From Screen Area button on the User toolbar.
Use the crosshairs pointer and the left mouse button to drag a rectangle around the total. Click the right mouse button to finish the operation.
WinRunner inserts an obj_get_text statement into the test script. The text appears in the script as a comment.
6 Close the graph.
7 Create a new order.
Choose File > New Order in the Flight Reservation application.
8 Enter flight and passenger information.
9 Insert the order into the database.
Click the Insert Order button. When the insertion is complete, the message "Insert Done" appears in the status bar:
10 Synchronize the test so that it waits for the "Insert Done" message to appear in the status bar.
In WinRunner, choose the Create > Synchronization Point > For Object/Window Bitmap command or click the Synchronization Point For Object/Window Bitmap button on the User toolbar.
Use the pointer to click the "Insert Done" message.
11 Open the graph again.
Choose Analysis > Graphs.
12 Read the total from the graph.
Choose Create > Get Text > From Screen Area, or click the Get Text From Screen Area button on the User toolbar.
Use the crosshairs pointer and the left mouse button to drag a rectangle around the total.
Click the right mouse button to finish the operation. WinRunner inserts an obj_get_text statement into the test script.
13 Close the graph.
14 Stop recording.

Choose Create > Stop Recording or click the Stop button.
15 Save the test.
Choose File > Save or click the Save button. Name the test lesson9 and click Save.
16 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.