Beruflich Dokumente
Kultur Dokumente
Context Sensitive testing enables you to test your application as the user sees it—
in terms of GUI objects—such as windows, menus, buttons, and lists. Each object
has a defined set of properties that determines its behavior and appearance.
WinRunner learns these properties and uses them to identify and locate GUI
objects during a test run. WinRunner does not need to know the physical location
of a GUI object to identify it.
Before you can begin Context Sensitive testing, WinRunner must learn the
properties of each GUI object in your application. Use the RapidTest Script wizard
to guide you through the learning process. It systematically opens each window
in your application and learns the properties of the GUI objects it contains.
WinRunner also provides additional methods for learning the properties of
individual objects.
As the user interface of your application changes, you can continue to use tests
you already developed. You simply add, delete, or edit object descriptions in the
GUI map so WinRunner can continue to find the objects in your modified
application.
WinRunner uses a logical name to identify an object: for example “Print” for a Print
dialog box, or “OK” for an OK button. This short name connects WinRunner to the
object’s longer physical description. This detailed description (the logical name
and the physical description) ensures that each GUI object has its own unique
identification. The physical description contains a list of the object’s physical
properties: the Print dialog box, for example, is identified as a window with the
label “Print”.
Logical Name:
Physical Description:
The RapidTest Script wizard enables WinRunner to learn all windows and objects
in your application being tested at once. It systematically opens every window in
the application and learns the GUI objects it contains. WinRunner then instructs
you to save the information in a GUI map file. A GUI_load command that loads
this file is added to a startup test.
Note: The RapidTest Script wizard is not available for when working with the
Terminal Emulator or WebTest add-ins. Therefore, if you are using these add-ins,
do not complete this section or the following sections of this lesson. Instead,
after you create and run tests in the other tutorial lessons, you must save your
temporary GUI map file whenever you close WinRunner or close a test script you
want to save. A temporary GUI map file contains the information that WinRunner
learns about GUI objects in your application.
WinRunner uses GUI map files to locate objects in the application being tested.
You must load the appropriate GUI map files before you run tests on your
application being tested.
You can load GUI map files in one of two ways:
using the GUI_load function
from the GUI Map Editor
You can view a loaded GUI map file in the GUI Map Editor. A loaded file is
indicated by the letter “L” and a number preceding the file name.
Winrunner Commands:
set window Specifies the window to receive input, according to the window's
logical name.
set window Specifies a window to receive input, according to the window's
physical description.
win activate Activates a window.
win check bitmap Compares a current window bitmap to an expected bitmap.
win check gui Compares current GUI data to expected GUI data.
===============================================================
activates a window.
win_activate ( window );
The win_activate function makes the specified window the active window by
bringing it into focus and raising it to the top of the display (equivalent to clicking
on the window banner). All subsequent input is submitted to this window.
activates a window.
===============================================================
Note that while set_window receives the window's logical name, _set_window
receives its physical description.
===============================================================
width, height For an area bitmap: the size of the selected area, in pixels.
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. For more information regarding the
update mode, refer to the "Running Tests" chapter in your User's Guide.
When an area of the window is captured, the additional parameters x, y, width and
height define the area's location and dimensions.
===============================================================
compares a window bitmap to an expected bitmap.
width, height For an area bitmap: the size of the selected area, in pixels.
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. For more information regarding the
update mode, refer to the "Running Tests" chapter in your User's Guide.
When an area of the window is captured, the additional parameters x, y, width and
height define the area's location and dimensions.
===============================================================
The win_check_gui function captures and compares GUI data for a window. During
test creation, the specified GUI data is captured and stored. When you run a test,
the current GUI data is compared to the data stored in expected_results_file
, according to a checklist specifying the information to be checked. A file containing
the actual results is also generated. For more details on using win_check_gui, refer
to the “Checking GUI Objects” chapter in your User's Guide.
===============================================================
The win_check_gui function captures and compares GUI data for a window. During
test creation, the specified GUI data is captured and stored. When you run a test,
the current GUI data is compared to the data stored in expected_results_file
, according to a checklist specifying the information to be checked. A file containing
the actual results is also generated. For more details on using win_check_gui, refer
to the “Checking GUI Objects” chapter in your User's Guide.
===============================================================
The win_check_info function checks that the current value of the specified property
matches the property_value.
===============================================================
win_click_help ( window );
===============================================================
search_area The region of the object to search, relative to the window. This area is
defined as a pair of coordinates, with x1,y1,x2,y2 specifying any two diagonally
opposite corners of the rectangular search region. If this parameter is not defined,
then the entire window specified is considered the search area.
string_def Defines how the text search is performed. If no string_def is specified,
(0 or FALSE, the default parameter), the interpreter searches for a complete word
only. If 1, or TRUE, is specified, the search is not restricted to a single, complete
word.
mouse_button Specifies the mouse button that clicks on the text string. The
value can be LEFT, MIDDLE, or RIGHT. If no button is specified, the default is the
left button.
The win_click_on_text function searches for a specified text string in the indicated
window or in an area of the window. It then moves the screen pointer to the center
of the text string and clicks on the string.
Before using win_click_on_text, make sure the fonts used by your AUT have been
learned. This step is always required for XRunner, and may be required for
WinRunner. For more information on learning fonts, refer to the “Checking Text”
chapter in your User's Guide. Note that when win_click_on_text is used with a
learned font, then WinRunner searches for a single, complete word only. This means
that any regular expression used in the string parameter must not contain blank
spaces, and only the default value of the string_def parameter, FALSE, is in effect.
===============================================================
closes a window.
win_close ( window );
===============================================================
win_drop ( target_window, x, y );
target_window The logical name of the window.
x,y The coordinates of the mouse pointer when released over the target window,
relative to the upper left corner of the client area of the target window, expressed in
pixels.
The win_exists function checks whether the specified window appears on the screen.
Use the time parameter to control test synchronization. Note that the timeout does
not affect the function if no time is specified.
result_array The name of the output variable that stores the location of the string
as a four-element array.
search_area The region of the object to search, relative to the window. This area is
defined as a pair of coordinates, with x1,y1,x2,y2 specifying any two diagonally
opposite corners of the rectangular search region. If this parameter is not defined,
then the entire window is considered the search area.
string_def Defines how the text search is performed. If no string_def is specified,
(0 or FALSE, the default parameter), the interpreter searches for a complete word
only. If 1, or TRUE, is specified, the search is not restricted to a single, complete
word.
The win_find_text function searches for a specified text string in the specified
window or area of the window and stores the location of the string in an output
variable.
Before using win_find_text, make sure that the fonts used by your AUT have been
learned. This step is always required for XRunner, and may be required for
WinRunner. For more information on learning fonts, refer to the “Checking Text”
chapter in your User's Guide. Note that when win_find_text is used with a learned
font, then WinRunner searches for a single, complete word only. This means that
any regular expression used in string must not contain blank spaces, and only the
default value of string_def, FALSE, is in effect.
===============================================================
returns the physical description of a window.
The win_get_info functions retrieves the value of the specified property and stores it
in out_value.
===============================================================
The win_get_text function reads text from the specified window, or area of the
window.
Before using win_get_text, make sure that the fonts used by your AUT have been
learned, if necessary. For more information, refer to the “Checking Text” chapter in
your User's Guide.
If Learn Fonts has been performed, win_get_text can read only one line of text. If
the enclosed area contains more than one line of text, then the line beginning
furthest to the left is read. If more than one line begins at the same point on the left,
the bottommost line is read. The maximum number of characters that can be
captured in one win_get_text statement is 2048.
===============================================================
The win_highlight function highlights the specified window. The flashes option sets
the number of times the window flashes on the screen.
===============================================================
win_max ( window );
The win_max function maximizes the specified window to fill the entire screen.
===============================================================
win_min ( window );
===============================================================
The win_mouse_click function performs a mouse click at the coordinates inside the
selected window. The mouse_button option lets you specify which mouse button to
click. The modifier option allows the user to add a modifier key.
===============================================================
===============================================================
modifier A constant specifying the modifier key used with the mouse button.
The value can be CONTROL, SHIFT, or CONTROL_SHIFT. If no modifier is
specified, the default is no modifier. This parameter is available for XRunner only.
The win_mouse_drag function performs a mouse drag inside a window from the
start coordinates to the end coordinates. Note that the coordinates are relative to the
upper left corner of the window, not the screen.
win_mouse_move ( window, x, y );
The win_mouse_move function moves the mouse pointer to the specified coordinates
inside a window.
===============================================================
win_move ( window, x, y );
===============================================================
Before using win_move_locator_text, make sure that the fonts used by your AUT
have been learned. This step is always required for XRunner, and may be required
for WinRunner. For more information on learning fonts, refer to the “
Checking Text” chapter in your User's Guide. Note that when
win_move_locator_text is used with a learned font, then WinRunner searches for a
single, complete word only. This means that any regular expression used in the
string parameter must not contain blank spaces, and only the default value of the
string_def parameter, FALSE, is in effect.
===============================================================
win_open ( window );
The win_open function opens a window in the application under test (AUT). If
necessary, other windows in the application open or close in order to provide access
to the specified window. The function works only if the window in the AUT is
already in the GUI map.
===============================================================
resizes a window.
win_restore ( window );
width, height For an area bitmap: the size of the selected region, in pixels.
The win_wait_bitmap function synchronizes test execution. It ensures that a window
comes up on the screen and is completely redrawn before test execution continues.
By using win_wait_bitmap, you can make sure that events are not input to a window
before it is ready.
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. For more information regarding the
update mode, refer to the "Running Tests" chapter in your User's Guide.
===============================================================
The win_wait_info function waits for a window property to attain the specified
value and then continues the test run. If the specified value is not attained, the
function waits until the time expires before continuing the test.