Interview Questions

How to Create a Test Using Winrunner (2)

Introduction To WinRunner Basics


(Continued from previous question...)

How to Create a Test Using Winrunner (2)

GUI checkpoint
GUI checkpoint for single property
User can check a single property of a GUI object. For example, user can check whether a button is enabled or disabled or whether an item in a list is selected To create a GUI checkpoint for a property value, use the Check Property dialog box to add one of the following functions to the test script:

button_check_info ()
scroll_check_info ()
edit_check_info ()
static_check_info ()
list_check_info ()
win_check_info ()
obj_check_info ()

Syntax:-Function_Name (name, property, property_value)
name: The Logical name of the object to be checked
property: The property to be checked
property_value: The expected property value


The Functions checks the current value of the specified property matches the expected property value.
To create a GUI checkpoint for a property value:
1. Choose Insert >GUI Checkpoint >For Single Property.
2. The mouse pointer becomes a pointing hand, and the Check Property dialog box opens and shows the default function for the selected object. WinRunner automatically assigns argument values to the function.
3. User can modify the arguments for the property check. To modify assigned argument values, choose a value from the Property list. The expected value is updated in the Expected text box. To choose a different object, click the pointing hand and then click the object to choose.

If the user clicks an object that is not compatible with the selected function, a message states that the current function cannot be applied to the selected object.


GUI checkpoint for object/window
This checkpoint is used to check the state or properties of a single object or window in an application. If a user single-click on a GUI object, the default checks for that object are included in the GUI checkpoint. If the user double-clicks on a GUI object, after WinRunner capturing GUI data, the Check GUI dialog box opens. User can choose which checks to include for that particular object. When using a GUI Checkpoint command, WinRunner inserts a checkpoint statement into the test script.

For a GUI object class, WinRunner inserts an obj_check_gui statement, which compares current GUI object data to expected data.

obj_check_gui (object, checklist, expected_results_file, time);

object The logical name or description of the GUI object. The object may belong to any class.
checklist The name of the checklist defining the GUI checks.
expected_results_file The name of the file that stores the expected GUI data.
time The interval in seconds. This interval is added to the timeout test option during the test run.
For a window, WinRunner inserts a win_check_gui statement, which compares current GUI data to expected GUI data for a window.

win_check_gui (window, checklist, expected_results_file, time);

WinRunner names the first checklist in the test as list1.ckl and the first expected results file gui1.

During test creation, the GUI data is captured and stored. When the user run the test, the current GUI data is compared to the data stored in the expected_results_file, according to the checklist. A file containing the actual results is also generated.

GUI checkpoint for multiple objects
The checkpoint statement inserted by the WinRunner in the case of GUI checkpoint for multiple objects and GUI checkpoint for object/window are the same.

To create a GUI checkpoint for two or more objects select GUI Checkpoint For Multiple Objects button on the User toolbar. The Create GUI Checkpoint dialog box opens.

To add an object, click the Add button once. If the user clicks a window title bar or menu bar, a window pops up asking "You are currently pointing at a window. What do you wish to check inside the window?" objects or menus. User can continue to choose objects by clicking the Add button.

Click the right mouse button to stop the selection process and to restore the mouse pointer to its original shape. The Create GUI Checkpoint dialog box reopens. The Objects pane contains the name of the window and objects included in the GUI checkpoint. To specify which objects to check, click an object name in the Objects pane. The Properties pane lists all the properties of the object. The default properties are selected.

The checklist file contains the expected values and it come under the exp folder. A GUI checklist includes only the objects and the properties to be checked. It does not include the expected results for the values of those properties. WinRunner has an edit checklist file option under the Insert menu. For modifying GUI checklist file select the Edit GUI Checklist. This brings up a dialog box that gives the option to select the checklist file to modify. There is also an option to select the scope of the checklist file, whether it is Test specific or a shared one.

Bitmap Checkpoint
Bitmap Checkpoint for Object/Window
To create a Bitmap Checkpoint for Object/Window
Choose Insert >Bitmap Checkpoint >For Object/Window.

The WinRunner window is minimized, the mouse pointer becomes a pointing hand.
Point to the object or window and click it.

WinRunner captures the bitmap and generates a TSL statement in the script.

The TSL statement generated for a window bitmap has the following syntax:

win_check_bitmap (window, bitmap, time);

The TSL statement generated for an object bitmap has the following syntax:
obj_check_bitmap (object, bitmap, time);

window or object The logical name or description of the window or object.
bitmap A string expression that identifies the captured bitmap.

time The interval marking the maximum delay between the previous input event and the capture of the current bitmap, in seconds. This interval is added to the timeout test option before the next statement is executed.

The win_check_bitmap function captures and compares bitmaps of a window or window area. During test creation, the specified window or area is captured and stored. During a test run, the current bitmap is compared to the one stored in the database. If they are different, the actual bitmap is captured. This function is generated during the recording of a test. Since the test is waiting for a result, the test should be run in update mode.

(Continued on next question...)

Other Interview Questions