|
WinRunner.infoThese notes on the software functionality automated test tool WinRunner from Mercury Interactive focuses on the hardest won (but easily forgotten) insights not obvious from available documentation.
| Topics this page:
|
Related Topics: |
Company & Product Background
Scripts written to control WinRunner is called TSL (Test Script Language) It is based on C language syntax That's why function calls in WinRunner are followed by parameters within parentheses separated by commas. So if your developers only develop in Visual Basic, or ASP, then maybe you should consider Rational Robot, which is controlled with programming in VB syntax. Mercury's competitors in the automated testing market are: TSL references logical names stored in the GUI Map. This allows one change to be used for all instances. The RapidTest Script Wizard feature of WinRunner systematically learns the properties of GUI objects as it automatically opens windows. Winrunner is designed more for testing rich desktop and web applications, not WebForms of Microsoft's .NET applications. For that, use QuickTest first released in 1999. With version 8, Quick Test Pro can competently take over WinRunner, now considered a legacy product within Mercury. Scripts from WinRunner can be used in LoadRunner to expose problems and predict the behavior of the system infrastructure under simulated loads of emulated virtual client users. Quality Center (formerly called Test Director) can invoke tests remotely, according to a custom schedule when client machines have network access control set to "User Level". WinRunner has no ties to Mercury products Topaz (which measures network performance), and SiteScope (which collects measurements on machines).
|
Mercury Interactive
See how their stock is doing in the dot.bomb economy at MSN Money Central archives |
Product Usage Process Risks
|
Recovery from WinRunner Crashes WinRunner operates in these Windows processes:
If WinRunner crashes and you don't want to reboot, press Ctrl-Alt-Del, select the Task Manager, click Processes Tab, Image Name. Then click on each of these processes (if they exist) and click "End Process" on each of the above. This should solve this error message in file wrstderr:
Exit WinRunner OftenWinRunner automatically creates a ".BAK" copy of script files it opens for editing. Save operations do not update this ".BAK" file. If WinRunner crashes, it will replace the current version of script files with their ".BAK" version.So exit WinRunner after you make a lot of changes to avoid getting them wiped out. Zip up your script directory before you open your script after a crash. It's a good idea to archive versions. Rename each file with a sequential number. Move them to an "arc" folder if you don't want to see them.
|
Welcome Screen SettingsWhen WinRunner starts up for the first time, it asks whether you want to create a new script or open an existing script.Uncheck "Show on startup" because most people open existing scripts to edit rather than starting with a new blank script. Such action is saved in the [WrEnv] section within the wrun.ini file as entry ShowWelcome=0
"0" usually means "FALSE" or "NO" or "OFF".
Exit WinRunner after changing any setting because the wrun.ini file is saved to the hard disk only when WinRunner exits. This setting in the wrun.ini file can be overridden with the wrun.exe invocation program command flag -dont_show_welcome
|
Add-In InitializationWhen WinRunner starts up for the first time, it asks you which addins you want to load. Add-in's are what enables WinRunner to recognize and manipulate non-standard objects (classed as text labels, edit fields, list boxes, push buttons, radio buttons, scroll bars, tool bars, etc.) within applications developed using ActiveX, Visual Basic, PowerBuilder, and other utilities. Each add-in selected during start-up result in the execution of some TSL script in the lib folder where WinRunner was installed:
|
|
Add-ins on StartupYou can create your own (such as WRAFS did) by following the Customization Guide. But the standard WinRunner installation comes with several "additional support" "hooks" to the operating system:Selections are stored in the [Wrcfg] section as entry ADDONS=ActiveX,PB,VB,WebTest,WRSAFS Uncheck "Show on startup" unless you will be constantly switching among development platforms. Such action is saved in the [Wrcfg] section within the wrun.ini file as entry ADDONS_SELECT_TIMEOUT=0 This setting in the wrun.ini file can be overridden with the wrun.exe invocation program command flag -addins_select_timeout <time> | Only install the add-ins you need. Add-in Conflict help lists the initialization script for each add-in. |
TSL StartWinRunner begins by silently executing (in the background) scirpt
%M_ROOT%\dat\tslinit
This information is used to run initialization scripts from the lib folder under the m_root. wr_gen initilizes external variables which are prepended with an underline. tslinit also runs an initialization script for each add-in from For example: Don't modify these scripts because they will be replaced whenever Winrunner is installed. |
Tools > General Settings
[1]
Some values are set at "TRUE" when WinRunner establishes the defaults, but become "1" (which also means TRUE)
when the value is changed within WinRunner.
|
Getvar & Setvar
|
"Hidden" Settings
Test Report User NameTo change the User Name appearing in Test Reports: Open the wrun.ini file and add this under the [WrEnv] section: LOGname=Bozo
WinRunner needs to be restarted for this to take effect.
Positions from Previous SessionWinRunner is kind enough to invoke itself with the same state that you were in when you exit the program. So it remembers these settings:
If you have multiple monitors, put the WinRunner Editor window on the right monitor. If you forget to move and save the position, change the win.ini and restart WinRunner.
Internal LimitsWinRunner has defaults which can be overridden by adding an entry in win.ini. Internally, the WinRunner program looks for these settings in win.ini, but uses internal defaults if they have not been added.
|
Start-up DebuggingDelete Header files upon errorIf you get a "header file error" when opening a script file from another time/machine, delete the files named "header" and "lock". WinRunner automatically re-creates them.
Delete Lock files after lockupWinRunner locks a script when it is not exited normally. To remove a lock, use Windows Explorer to open the script's folder and manually delete the file named lock.
|
Physical storage
All TSL code are physically stored in a file always named "script" with no file extension. The name specified to save TSL code from within WinRunner is used to create a folder with that name.
FunctionsThe standard functions described in Mercury's TSL Reference Guide and WinRunner User Guide are automatically compiled and loaded into memory when WinRunner starts.All functions written by users of WinRunner are custom functions. Compiled TSL code must be organized into functions so that they can be referenced by other TSL statements. Example of TSL code to create a function:
private function func1( in parm1 ) print( parm1 ); return(rc); } Example of TSL code to reference a custom function with no parameters:
app_close_windows();
|
WinRunner 7 In A Hurry! Software Test Automation With WinRunner by consultants Thomas Messerschmidt, Mark Harbin of WinRunner In a Hurry.com and 213-810-2589
Java Applications and Applets
|
Main vs. Compiled ModulesUnlike C or Java which require users to perform a separate compilation step using a separate program, you make a Winrunner script module “Compiled” by changing the file's Test type property from the File Properties screen shown at right. Winrunner performs a pre-compilation automatically when it saves a module assigned a property value of “Compiled Module”.By default, modules containing TSL code have a property value of "main". Main modules are called for execution from within other modules. Main modules are dynamically compiled only when WinRunner recognizes a "call" statement such as:
call cso_init();
call( "C:\\MyAppFolder\\" & "app_init" ); Compiled modules are loaded into memory to be referenced from TSL code in any module:
reload( "C:\\MyAppFolder\\" & "flt_lib" );
or
load( "C:\\MyAppFolder\\" & "flt_lib" );
If during a load command you get the message "The line is too long to be displayed", open the script and check for recent changes, usually misplacement of parentheses, braces, quotes, and other special characters. Try removing all lines within each function (one at a time) to identify. You can also run "c lint" programs to identify indentation. The edit_set function can work with up to 1020 characters into an edit field. However, the WinRunner screen editor will only work with lines that are a maximum of 253 characters.
|
Recording Tips
|
Keyboard ConfigurationIntroduction: Don't Get MouseyGet in the habit of controling script execution by pressing softkeys on the keyboard (listed below) rather than clicking the mouse. Some scripts commands assume that the cursor is placed at a certain spot and it won't execute properly if you're moving the mouse around at the same time.
Change Default SoftKey AssignmentsHere are several reasons why you may want to configure your own keys to control WinRunner. The default settings for WinRunner keyboard mappings to desired actions can be changed from menu Settings, Editor Options, Key assignments. Alternately, run command softtkeyRather than having to use both hands to press a combination key (such as Ctrl-F3 to stop execution), you may prefer pressing just a single function key. Before you ask "How lazy can you get?" realize that you want to be able to quickly stop a script that's goes wildly out of control. By default, WinRunner uses the F2 key to initiate "Record". So if you edit Excel formulas or file names in Windows Explorer while you have WinRunner stopped, you'll probably be inadvertantly recording every keystroke you make. This will corrupt whatever script and gui map you have open in WinRunner. So how about reassigning the key to LoadRunner's default of Ctrl+R?
Key Assignments InconsistentMercury did not coordinate the assignment of softkey defaults among its WinRunner and LoadRunner products. Mercury's assignments are also not consistent with other popular developer tools: |
WinRunner differentiates between left and right Alt and Ctrl keys.
By default, no key is assigned to “Sychronize Bitmap and Location of Window". So map it to something by using WinRunner utility softkey.exe from the Programs menu where WinRunner is invoked. This program updates wrun.ini .
|
|
Data Configuration
A Separate Folder For Each AppCreating a separate folder for the application under test helps to avoid work on one application impacting other applications. Save scripts under this folder.This also ensures portability of test assets to other machines. |
|
Font Expert
|
|
Data Conversion
|
|
Test Results
Some prefer to read the plain-text version of this in the Results.txt file WinRunner generates. But there you can't click on the "Show TSL" icon (after a specific line is highlighted) to open the TSL script file at the line number indicated. If you press an up/down cursor key (or a wheel mouse) when this dialog first appears, rather than scrolling lines on the page, you will scroll from "debug" to "exp" and other result folders (which are from previous runs). So click on a line first before scrolling.
|
|
Quality Center
[TestDirector] TDAllowLocalDB=1 ReconnectToServer=0 ReconnectToDB=0 ReconnectOnStart=1 UsePasswordOnStart=1 |
|
Advisor & User Group Hangouts
|
Support.mercury.com requires you to register for a login. |
Consultants: Fee Based Offerings & Jobs
|
|
|
Mercury Product Certification
Mercury's CPS certification program is, the last time I checked, managed by Franz Obermeier (rather than Simran Atwal or Wendy Perilli) in Sunnyvale at 408.822-5579 (fax 822-5517). Mercury's Full Certification Policy
|
|
| Your first name: Your family name: Your location (city, country): Your Email address: |
Top of Page
Thank you! |