About Learning Virtual Objects - WinRunner

Your application may contain bitmaps that look and behave like GUI objects. WinRunner records operations on these bitmaps using win_mouse_click statements. By defining a bitmap as a virtual object, you can instruct WinRunner to treat it like a GUI object such as a push button, when you record and run tests. This makes your test scripts easier to read and understand.

For example, suppose you record a test on the Windows NT Calculator application in which you click buttons to perform a calculation. Since WinRunner cannot recognize the calculator buttons as GUI objects, by default it creates a test script similar to the following:

set_window("Calculator");
win_mouse_click ("Calculator", 87, 175);
win_mouse_click ("Calculator", 204, 200);
win_mouse_click ("Calculator", 121, 163);
win_mouse_click ("Calculator", 242, 201);

This test script is difficult to understand. If, instead, you define the calculator buttons as virtual objects and associate them with the push button class, WinRunner records a script similar to the following:

set_window ("Calculator");
button_press("seven");
button_press("plus");
button_press("four");
button_press("equal");

You can create virtual push buttons, radio buttons, check buttons, lists, or tables, according to the bitmap’s behavior in your application. If none of these is suitable, you can map a virtual object to the general object class.

You define a bitmap as a virtual object using the Virtual Object wizard. The wizard prompts you to select the standard class with which you want to associate the new object. Then you use a crosshairs pointer to define the area of the object. Finally, you choose a logical name for the object.

WinRunner adds the virtual object’s logical name and physical description to the GUI map.


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

WinRunner Topics