Generating a Function for a GUI Object - WinRunner

With the Function Generator, you can generate a Context Sensitive function simply by pointing to a GUI object in your application. WinRunner examines the object, determines its class, and suggests an appropriate function. You can accept this default function or select another function from a list.

Using the Default Function for a GUI Object

When you generate a function by pointing to a GUI object in your application, WinRunner determines the class of the object and suggests a function. For most classes, the default function is a get function. For example, if you click a list, WinRunner suggests the list_get_selected function.

To use the default function for a GUI object:

  1. Choose Insert > Function > For Object/Window or click the Insert Function for Object/Window button on the User toolbar. WinRunner shrinks to an icon and the mouse pointer becomes a pointing hand.
  2. Point to a GUI object in the application being tested. Each object flashes as you pass the mouse pointer over it.
  3. Click an object with the left mouse button. The Function Generator dialog box opens and shows the default function for the selected object. WinRunner automatically assigns argument values to the function.
  4. To cancel the operation without selecting an object, click the right mouse button.

  5. To paste the statement into the script, click Paste. The function is pasted into the test script at the insertion point and the Function Generator dialog box closes.
  6. To execute the function, click Execute. The function is executed. Clicking Execute does not paste the statement into the script.

    To use the default function for a GUI object

  7. Click Close to close the dialog box.

Selecting a Non-Default Function for a GUI Object

If you do not want to use the default function suggested by WinRunner, you can choose a different function from a list.

To select a non-default function for a GUI object:

  1. Choose Insert > Function > For Object/Window or click the Insert Function for Object/Window button on the User toolbar. WinRunner is minimized and the mouse pointer becomes a pointing hand.
  2. Point to a GUI object in the application being tested. Each object flashes as you pass the mouse pointer over it.
  3. Click an object with the left mouse button. The Function Generator dialog box opens and displays the default function for the selected object. WinRunner automatically assigns argument values to the function.
  4. To cancel the operation without selecting an object, click the right mouse button.

  5. In the Function Generator dialog box, click Change. The dialog box expands and displays a list of functions. The list includes only functions that can be used on the GUI object you selected. For example, if you select a push button, the list displays button_get_info, button_press,etc.
  6. In the Function Name list, select a function. The generated statement appears at the top of the dialog box. Note that WinRunner automatically fills in argument values. A description of the function appears at the bottom of the dialog box.
  7. To select a non-default function for a GUI object

  8. If you want to modify the argument values, click Args. The dialog box expands and displays a text box for each argument. See “Assigning Argument Values” for more information on how to fill in the argument text boxes.
  9. To paste the statement into the test script, click Paste. The function is pasted into the test script at the insertion point.
  10. To execute the function, click Execute. The function is immediately executed but is not pasted into the test script.

  11. You can continue to generate function statements for the same object by repeating the steps above without closing the dialog box. The object you selected remains the active object and arguments are filled in automatically for any function selected.
  12. Click Close to close the dialog box.

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

WinRunner Topics