Setting Testing Options with setvar - WinRunner

You use the setvar function to set the value of a testing option from within the test script. This function has the following syntax:

setvar("testing_option", "value" );

In this function, testing_option may specify any one of the following:

Setting Testing Options with setvar

For example, if you execute the following setvar statement:

setvar ("mismatch_break", "off");

WinRunner disables the mismatch_break testing option. The setting remains in effect during the testing session until it is changed again, either with another setvar statement or from the corresponding Break when verification fails check box in the Run > Settings category of the General Options dialog box.

Using the setvar function changes a testing option globally, and this change is reflected in the General Options dialog box. However, you can also use the setvar function to set testing options for a specific test, or even for part of a specific test.

To use the setvar function to change a variable only for the current test, without overwriting its global value, save the original value of the variable separately and restore it later in the test.

Note:Some testing options are set by WinRunner and cannot be changed through either setvar or the General Options dialog box. For example, the value of the testname option is always the name of the current test. You can use getvar to retrieve this read-only value. For more information, see “Retrieving Testing Options with getvar” on page 858.

For example, if you want to change the delay_msec testing option to 20,000 for a specific test only, insert the following at the beginning of your test script:

To change back the delay testing option to its original value at the end of the test, insert the following at the end of your test script:#Change back the ‘delay_msec’ testing option to its original value.
setvar (“delay_msec”, old_delay) ;

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

WinRunner Topics