WinRunner: How to determine which window you are on:
Each time a new browser window appears, you need to test to make sure the correct window is activated. to do with use the following code:
#test to make sure on browser
win_check_info("Browser Main Window_1","enabled",1);
# check to make sure the menu says Menu Selection
menu = obj_check_gui("title_shad", "list5.ckl", "gui5", 5);
if (menu == 0)
report_msg("On Menu Window");
report_msg("not on right window");
Explain Get Text checkpoint web text checkpoint with syntax?
Returns a text string from an object. web_obj_get_text (object, table_row, table_column, out_text [, text_before, text_after, index]);
i. object The logical name of the object.
ii. table_row If the object is a table, it specifies the location of the row within a table. The string is preceded by the # character.
iii. table_column If the object is a table, it specifies the location of the column within a table. The string is preceded by the # character.
iv. out_text The output variable that stores the text string.
v. text_before Defines the start of the search area for a particular text string.
vi. text_after Defines the end of the search area for a particular text string.
vii. index The occurrence number to locate. (The default parameter number is numbered 1) Reply
Explain Get Text checkpoint from selection (web only) with syntax?
We use win_get_text (window, out_text [, x1, y1, x2, y2]) function to get the text from a window. Reply
Explain Get Text checkpoint from screen area with syntax?
a. We use obj_get_text (, ) function to get the text from an object
b. We use win_get_text (window, out_text [, x1, y1, x2, y2]) function to get the text from a window. Reply
Explain Get Text checkpoint from object/window with syntax?
You can use text checkpoints in your test scripts to read and check text in GUI objects and in areas of the screen. While creating a test you point to an object or a window containing text. WinRunner reads the text and writes a TSL statement to the test script. You may then add simple programming elements to your test scripts to verify the contents of the text.
b. You can use a text checkpoint to:
i. Read text from a GUI object or window in your application, using obj_get_text and win_get_text
ii. Search for text in an object or window, using win_find_text and obj_find_text
iii. Move the mouse pointer to text in an object or window, using obj_move_locator_text and win_move_locator_text
iv. Click on text in an object or window, using obj_click_on_text and win_click_on_textReply
WinRunner: When Running Scripts:
When you make your shell script, remember to run it the first time in update mode to create all the expected results, and then run it in verify mode. The reason this needs to be done is because the expect results reside under each specific test script, and for shell scripts it created sub folders for each test it runs. The expected results are not pulled from the individual test area to the shell script area, so it needs to be run in update mode to re-create them. Another option is to use Windows Explorer and copy all your expected results folders to the directory containing the shell script. Reply
WinRunner: Naming Conventions:
> Never call a test "tests", WinRunner/TestDirector has problem distinguishing the name test with the directory tests.
> The project automation document will specify any naming conventions used for the individual projects.
> Test Script names should be in UPPER CASE. Reply
WinRunner: Commands and Checkpoint Verification information for Web:
> Must do a set_window(); command for each action on a new window, this will assist the script in recognizing/resetting the window state and help prevent scripts failing due to slow network/system performance.
> Must add report_msg or tl_step command after each test to record what happens in the test.
> A obj_check_qui statement checks only one object on the window, and win_check_qui statement checks multiple objects in the window.
> The single property check allows you to check a single property of an object. The single property check dialog will add one of the following functions to your script.
The Object/Window check allows you to check every default object in the window. After it has completed it inserts an obj_check_gui statement in your script.
The Multiple Objects check allows you to check two or more objects in the window. This selection works best, because it first brings up the checkpoint window, then after the user selects add you can navigate to the AUT. Also, for some reason, the data in the object is retrieved with this feature but not the object/window check. After it has completed it inserts a win_check_gui statement in your script.
> There are 3 main types of GUI checks you can do with WinRunner. Single Property and Object/Window checks, and Multiple Objects.
> There are 35 Web functions, that come with the web test add-in. For the full list please see the TSL reference guide. The table below lists the most commonly used functions.
web browser invoke Invokes the browser and opens a specified site.
web image click Clicks a hypergraphic link or an image.
web label click Clicks the specified label.
web link click Clicks a hypertext link.
web link valid Checks whether a URL name of a link is valid (not broken).
web obj get info Returns the value of an object property.
Needs a set_window command to be run before used
web obj get text Returns a text string from an object.
web obj text exists Returns a text value if it is found in an object.
web sync Waits for the navigation of a frame to be completed.
web url valid Checks whether a URL is valid
web find text Returns the location of text within a page.
> Most of the Web Test functions do not return a value to the test log, in order to record a pass or fail, conditional logic will have to be added to your code below the web function to send a tl_step or report_msg to the log Reply
WinRunner: Libraries Needed for automation:
A number of libraries have been created to aid in the automation projects. Below is a list of the libraries that should be installed on each individual machine.
> csolib32 : This is a library full of many useful functions. This library was created by Mercury Customer Support and can be found in the following zip file csolib.zip. In order to access the library functions, the tsl_init file needs to be modified to run the cso_init file (which will load the libraries when the WinRunner application boots up).
> WebFunctions : This is a library contains functions designed to run on the YOUR-COMPANY Web systems. Reply
WinRunner: Steps to take before recording:
> Before starting to record, you should close all applications that are not required for testing. (Mail, Explorer, Screen Savers, CD Player etc).
> After installing a new version of Test Director and WinRunner, it is a good idea to make a back up copy of the following ini files to another location(testers choice of location). This is recommended to allow the tester to easily reset their WinRunner/TestDirector environment in the event of system corruption.
> Make sure your system is set up with all the necessary library functions that have been created.
> Make sure you create a GUI map and font group for each project.
> In the tsl_init file add the command GUI_close_all();. This command will make sure that no GUI maps are loaded when you bring up the WinRunner application. The benefit of this approach is that it will force the tester to load the correct GUI map for their testing, thus preventing scripting errors and other complications.