This information is for planning purposes only. The information herein is subject to change or removal without notice before the products described may become available.
The CE/CLM products were renamed in version 7.0. As the help is updated to reflect the changes, the topics might contain inconsistencies. For details on the name change, see Renaming the IBM Continuous Engineering Portfolio.

Execution variables

To use specific values in your test scripts during a test run, define execution variables in test scripts or keywords. You can also pass execution variables from a test suite or a test case to associated test scripts or keywords. If you are an administrator or a test lead, you can set execution variables at the project level.

You can use execution variables with all manual scripts, command-line scripts, and JUnit Selenium scripts. If you use an adapter that supports execution variables, you can use them with automated test scripts. To determine whether an adapter supports execution variables, consult the adapter-specific documentation.

Artifact- and project-level execution variables

Execution variables can be defined at project or artifact levels. If you are a project administrator and have permission to save project execution variables, you can define project execution variables. Because project-level execution variables are centrally defined, they can be consistently reused across a team. In addition, project execution variables have sets of values, called enumerated values, that are defined for use in test artifacts. The use of enumerated values safeguards testers from accidentally entering an invalid value at run time.

Test authors can define artifact execution variables in the context of test suites, test cases, and test scripts. Those test artifact execution variables can take any value.

  • To use values that are present throughout a test suite or a test case, define artifact execution variables in the Execution Variables section of that test case or test suite.
  • To use an execution variable in a manual test script or keyword, define the variable in the Execution Variables section of the Manual Test editor. After you define a variable, you can insert references to it in a manual test script or keyword step. During a test run, the current value of the execution variable replaces the reference in the step.
  • To set the value of a particular execution variable, you can insert execution variable steps in a manual test or keyword. You can create and insert an execution variable step from the Execution Variables window. During a test run, you are prompted to assign a value to the execution variable. After you set the value, all references to that execution variable have the value that you provided.
At the artifact level, if values for the same variable are defined in multiple places, the values of the higher-level variable override the values of the lower-level variable. For example, a variable is defined in a test suite and in a test case that is within the test suite. The value of the variable that is defined in the test suite overrides the initial value of the variable that is defined in the test case. In another example, a variable is defined in a test case and in a test script that is within the test case. The value of the variable that is defined in the test case overrides the initial value of the variable that is defined in the test script.
Note: For the override operation to work in execution variables, the defined value of lower-level variable cannot be null or blank.
  • The values of test suite execution variables override the values of test case, test script, and keyword execution variables
  • The values of test case execution variables override the values of test script and keyword execution variables
  • A defined test script variable with a null value overrides a keyword execution variable

An artifact can incorporate both project and artifact execution variables. However, if two or more of those variables have the same name, a conflict occurs that prevents the artifact from being saved. You can change the name of a project-level execution variable to match the name of an artifact-level execution variable. In that case, the value of the artifact-level variable overrides the value of the project-level variable when the test is run.

Execution variables in sequential test-suite runs

If you run sequential test suites, you can pass execution variables from one test script to another. For example, the first step in a test suite runs a test script that creates a user and sets an execution variable that is named userID. Subsequent steps in the test suite run test scripts that reference the value of the userID execution variable, update the user information, and verify that the user information is correct. You can enable this behavior in the Test Case section of a test suite or in the Run Test Suite window.

Execution variables in command-line scripts

When you run a command-line test that includes execution variables, the values of the execution variables are provided as environment variables to the process that runs the command-line test. The names of those environment variables start with qm_ to distinguish them from other environment variables.

For example, if a test suite contains an execution variable that is named myVar, an environment variable that is named qm_myVar is created.
Remember: Ideally, execution variable names include only valid Java identifiers: A-Z, a-z, 0-9, _ and $. If an execution variable contains an identifier that is not in Java, an underscore (_) replaces that identifier in the new environment variable name. For example, if you have an execution variable that is named user.Name, the resulting environment variable is qm_user_Name.
In addition, an environment variable that is named qm_ExecutionVariablesFile is created, and its value is an absolute path name to a text file; for example, qm_ExecutionVariablesFile=C:\Users\tneal.DEV\AppData\Local\Temp\QMAdapter1220694107401772431.vars. That file contains name and value pairs: one for each execution variable that is defined when the command-line script runs. For example:

#Execution Variables
#Wed Mar 02 15:48:54 EST 2011
testcase2Var=set statically in testcase2
testcase1Var=set statically in testcase1
testsuite1Var=set statically in testsuite1

When the command-line test is complete, the text file is read. If the test suite allows execution variables to be passed, the contents are used to pass the values of execution variables to the next test script. You can modify the text file to create execution variables or to change the value of execution variables that are passed to other test scripts.

Built-in execution variables

In certain cases, your test might need to retrieve more information about the test execution environment that it is running in. For example, the test might need such the name of the test suite or the test case that is being run. Built-in execution variables provide environment information. To enable built-in variables, select the Include built-in variables check box in the Execution Variables section of the test script editor.

When that check box is selected, these extra execution variables are created:
Note: The execution variables are provided to CLA scripts as environment variables with 'qm_' prefixed to the execution variable name. So to access the name of the test plan from a CLA script you would access the environment variable as 'qm_RQM_TESTPLAN_NAME'.

video icon Video channel
Software Education channel

learn icon Courses

IoT Academy
Skills Gateway

ask icon Community forums library

support icon Support

IBM Support Community
Deployment wiki