IBM Engineering Test Management execution variables

If you use IBM® Engineering Test Management to run functional test scripts, you can create variables for parameters within a functional test script that is associated with a Engineering Test Management test suite, test case, or test script. These variables, known as execution variables, can be passed to the functional test script to be used during playback.

When the Engineering Test Management test case is run, the execution variables that have been created are obtained by the functional test adapter and passed to the functional test script to be used on playback. Values for the execution variables can be supplied from the command-line prompt, a text file or worksheet, or from the associated test suite, test case, or test script. The details of the execution variables that are passed to the functional test script are displayed on the Execution Variable tab on the Execution Results page in Engineering Test Management.

For example, to log values for data such as user name and password in a functional test script, you can create variables for user name and password, either in Engineering Test Management or in the functional test script. When the associated test case is run in Engineering Test Management, the functional test adapter obtains the user name and password variables and provides them to the functional test script on playback. Values for the user name and password execution variables can be specified at the command line prompt, in a comma-separated values (CSV) file or text file. The values can also be specified in the associated test suite, test case or test script. Details of the user name and password variables are displayed on the Execution Variable tab on the Execution Results page in Engineering Test Management. The values for user name and password are displayed in the log.

Note: By using execution variables, you can pass parameters at the test script, test case or test suite levels. To pass details only to a specific script, you can also use arguments to the testMain() method in the script. For more information, see IBM Engineering Test Management script arguments.
Note: The execution variables feature is available only with Engineering Test Management, version 3.0.1.

Reading variables

When a Engineering Test Management test case or test script is run, the functional test adapter reads the execution variables that were created for the test case or script and passes the variables to the functional test script playback engine. The functional test playback engine provides the variables to the functional test script that is associated with the Engineering Test Management test case or script. On playback, the functional test script uses the variables and obtains values for the variables.

You must modify the functional test script to enable it to read the Engineering Test Management execution variables during playback. This code is provided in the IVariablesManager API:
IVariablesManager vm=getVariablesManager()
You must modify functional test script to enable it to read the parameter names for the Engineering Test Management execution variables during playback. This code is provided in the IParameter API:
IParameter name = vm.getInputParameter("name")

Creating variables

You can create execution variables within the associated functional test script.

To create execution variables within the functional test script, this code is provided in the IVariablesManager API:
IVariable <var name> = vm.createOutputVariable("<var name>", "<var value>");

Modifying variables

You can modify execution variables created in Engineering Test Management either in the test suite, test case, or test script. You can modify execution variables created in the functional test script.
Note: Execution variables created in Engineering Test Management cannot be modified in the functional test script, but can only be read.
To modify execution variables that were created earlier in the functional test script, this code is provided in the IVariable API and the IVariablesManager API:
<var name>.setValue("<new var value>");
vm.setOutputVariable(<var name>);

Test cases in a test suite

For test cases in a test suite, the functional test output variables for a test case, if any, are provided as input variables for the next test case in the suite.

Rational® Functional Tester in stand-alone mode

When Rational® Functional Tester is in stand-alone mode without Engineering Test Management, the execution variables can be read from the command line, or from a text file or worksheet.

Use a -var extension to enable Rational® Functional Tester to read execution variables and their values from the command line. For example, type:
<playbackcmd> -var "username=user1;password=pass1"
Use the -varfile extension to enable Rational® Functional Tester to read execution variables and their values from a text file or worksheet, for example:
<playbackcmd> -varfile <file containing values>
In the text file or worksheet, each variable name and value pair must be on a new line. If comma -separated values are provided, they are treated as a single value.