Thursday, March 8, 2007

Understanding the Test Script

Understanding the Test Script
In the previous exercise, you recorded the process of opening a flight order in the Flight Reservation application. As you worked, WinRunner generated a test script similiar to the following:
# Flight Reservation set_window ("Flight Reservation", 3);
menu_select_item ("File;Open Order...");
# Open Order set_window ("Open Order", 1);
button_set ("Order No.", ON);
edit_set ("Edit_1", "3");
button_press ("OK");
As you can see, the recorded TSL statements describe the objects you selected and the actions you performed.
For example, when you selected a menu item, WinRunner generated a menu_select_item statement.
The following points will help you understand your test script:
• When you click an object, WinRunner assigns the object a logical name, which is usually the object’s text label. The logical name makes it easy for you to read the test script. For example, when you selected the Order No. check box, WinRunner recorded the following statement: button_set ("Order No.", ON); "Order No." is the object’s logical name.
• By default, WinRunner automatically adds a comment line each time you begin working in a new window so that your script is easier to read. For example, when you clicked on the Flight Reservation window, WinRunner generated the following comment line: # Flight Reservation
• WinRunner generates a set_window statement each time you begin working in a new window. The statements following a set_window statement perform operations on objects within that window. For example, when you opened the Open Order dialog box, WinRunner generated the following statement: set_window ("Open Order", 10);
• When you enter keyboard input, WinRunner generates a type, an obj_type, or an edit_set statement in the test script. For example, when you typed 3 in the Order Number box, WinRunner generated the following statement: