R. E. Cook
Home 
Contact Us 

Dr. Cook
Resume 

RunningShoes Library for WinRunner 
RunningShoes 

Custom WinRunner Functions 
and Utilities,
to Your Specs
Custom 

A Random Collection of WinRunner Solutions
Solutions 

Creating DLLs for WinRunner 
"DLLs Demystified" 
(Mercury Interactive's Worldwide Users Conference 2000)

Reading WinRunner configuration values (wrun.ini)

 

Undocumented and poorly documented features in WinRunner make it possible to read many of WinRunner's configuration values (values stored in wrun.ini). We can read most of the values in two sections in the file, the [WrCfg] and [WrEnv] sections. 

If you need to read values in any other section of wrun.ini, you'll need the RunningShoes library. RunningShoes contains the function WinRunnerGetIniValue(), in the WinRunner Environment function group, which will correctly read any key value in any section of wrun.ini.


Without RunningShoes


Read [WrCfg] with getvar()

The TSL Online Documentation provides a list of options for use with the getvar() statement. Many of those options are stored in the WrCfg section of wrun.ini. The getvar() function can also retrieve other values in the WrCfg section:

# Retrieve the timeout for text recognition.
text_timeout = getvar("XR_TEXT_RECOGNITION_TIMEOUT");

# Retrieve the version of WinRunner.
wr_version = getvar("XR_VERSION_STAMP");


Known error reading [WrCfg] with getvar()

Not all values can be retrieved. One value that usually fails is the path to the keyboard file. The path is usually:

    "C:\Program Files\Mercury Interactive\WinRunner\dat\win_scan.kbd"

However, getvar() retrieves the path only up to the first space, at least in some versions of WinRunner:

# Attempt to retrieve the keyboard file
keyboard_file= getvar("XR_INP_KBD_NAME");

After that call, keyboard_file = "C:\Program"


Read [WrEnv] with getenv()

The TSL Online Documentation provides no list of options for use with the getenv() statement. One set of options for the getenv() function is the values in the WrEnv section of wrun.ini. Just use the key name as the option.

# Retrieve the path to the WinRunner program folder.
const M_ROOT = getenv("M_ROOT");

# Retrieve the startup script with path.
startup = getenv("XR_TSL_INIT");


With RunningShoes


Read any section with WinRunnerGetIniValue()

Need to know whether WinRunner is dropping the parameters from query strings in Netscape? (A query string is the entire URL including any parameters, which appear after the question mark.) The answer is in the [WrNetscapeSupport] section of wrun.ini. Use RunningShoes to capture the value.

# Define section and key names
section = "WrNetscapeSupport";
key = "TRUNC_URL_AFTER_QUESTION_MARK";

# Capture the value in the variable url_is_truncated.
rc = WinRunnerGetIniValue(section, key, url_is_truncated);


Avoid the known error reading [WrCfg] with getvar()

# Define section and key names
section = "WrNetscapeSupport";
key = "XR_INP_KBD_NAME";

# Successfully retrieve the keyboard file
rc = WinRunnerGetIniValue(section, key, keyboard_file);

 



Top of  This Page | R. E. Cook Home Page

Copyright R. E. Cook Consulting, 2000 - 2011.
All rights reserved.

The site is designed to look best when viewed with Internet Explorer 5.0 - 8.0. Results with other browsers will probably deviate from what is intended.

NOTE: This website refers to registered trademarks and service marks that are owned by other companies, including Mercury Interactive, WinRunner, TestDirector, TSL, Microsoft, Windows.