Using the Function Generator to Insert Functions
You are now ready to add functions to the test script which query the # Tickets,
Ticket Price, and Total fields in the Fax Order dialog box.
1 Insert a blank line above the button_press ("Cancel"); statement and place
the cursor at the beginning of this line.
2 Open the Fax Order dialog box.
Choose File > Fax Order in the Flight Reservation application.
3 Query the # Tickets field.
Choose Create > Insert Function > For Object/Window or click the
Insert Function for Object/Window button on the User toolbar. Use the
pointer to click the # Tickets field.
The Function Generator opens and suggests the edit_get_text function.
Ticket Price, and Total fields in the Fax Order dialog box.
1 Insert a blank line above the button_press ("Cancel"); statement and place
the cursor at the beginning of this line.
2 Open the Fax Order dialog box.
Choose File > Fax Order in the Flight Reservation application.
3 Query the # Tickets field.
Choose Create > Insert Function > For Object/Window or click the
Insert Function for Object/Window button on the User toolbar. Use the
pointer to click the # Tickets field.
The Function Generator opens and suggests the edit_get_text function.
This function reads the text in the # Tickets field and assigns it to a variable. The
default variable name is text. Change the variable name, text, to tickets by typing
in the field:
default variable name is text. Change the variable name, text, to tickets by typing
in the field:
edit_get_text("# Tickets:",tickets);
Click Paste to add the function to the test script.
4 Query the Ticket Price field.
Choose Create > Insert Function > For Object/Window or click the
Insert Function for Object/Window button on the User toolbar. Use the
pointer to click the Ticket Price field.
The Function Generator opens and suggests the edit_get_text function.
Change the name of the text variable to price:
edit_get_text("Ticket Price:",price);
Click Paste to add the function to the test script.
5 Query the Total field.
Choose Create > Insert Function > For Object/Window or click the
Insert Function For Object/Window button on the User toolbar. Use the
pointer to click the Total field.
The Function Generator opens and suggests the edit_get_text function.
Change the name of the text variable to total:
4 Query the Ticket Price field.
Choose Create > Insert Function > For Object/Window or click the
Insert Function for Object/Window button on the User toolbar. Use the
pointer to click the Ticket Price field.
The Function Generator opens and suggests the edit_get_text function.
Change the name of the text variable to price:
edit_get_text("Ticket Price:",price);
Click Paste to add the function to the test script.
5 Query the Total field.
Choose Create > Insert Function > For Object/Window or click the
Insert Function For Object/Window button on the User toolbar. Use the
pointer to click the Total field.
The Function Generator opens and suggests the edit_get_text function.
Change the name of the text variable to total:
edit_get_text("Total:",total);
Click Paste to add the function to the test script.
6 Close the Fax Order dialog box.
Click Cancel to close the dialog box in the Flight Reservation application.
7 Save the test.
Choose File > Save or click the Save button.
8 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 to add the new object or new window to your GUI map. A
WinRunner message box opens. Click OK. Choose File > Exit to close the GUI
Map Editor.
Click Cancel to close the dialog box in the Flight Reservation application.
7 Save the test.
Choose File > Save or click the Save button.
8 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 to add the new object or new window to your GUI map. A
WinRunner message box opens. Click OK. Choose File > Exit to close the GUI
Map Editor.