Incorporating execution variables into manual tests

To use specific values in a manual test script during testing, define execution variables and then pass their values to the manual test script and keywords. Within a manual test script, you can pass values between that manual test script and the keywords. You can also pass values between keywords.

Before you begin

To create a project execution variable, you must be an administrator and have permission to save project execution variables. Unlike artifact execution variables, project execution variables cannot be modified by testers.

About this task

You define artifact-level execution variables in the Execution Variables section of a test case or test suite. You can also define those variables in the Execution Variables view of the Manual Test editor. With the requisite permissions, project administrators can define project execution variables in the Project Execution Variables section of the Manage Project Properties area. After you define the variables, you can insert them into a manual test script or keyword step. When you run a test, those values are passed to the inserted execution variables. To manage artifact execution variables, use the Execution Variables view. For example, in that view you can insert variables into the current step or into a new step that requires a variable to be set.
  • If you click the Insert Execution Variables in Current Step Insert Execution Variables in current step icon, during the test run, the new value is automatically inserted into the step or keyword. You cannot edit the value.
  • If you click the Create Set Execution Variable Step icon Create Set Execution Variable step, during the test run, you can edit the value in a window that opens. If you assign a new value to a variable, that value becomes the default and is passed to subsequent steps and keywords during that test run.
Remember: When you add an execution variable to a keyword, all other manual test scripts that include the keyword are updated with the execution variable.

In this task, you create an execution variable and insert it into a manual test script.

Procedure

  1. Create an execution variable:
    • To create an artifact execution variable from a test suite or test case, and then set the default value:
      1. In an open test suite or test case, click Execution Variables.
        Tip: If you do not see that section, add it by clicking Manage Sections. To show the available sections, select Show all sections and then add the Execution Variables section to the Selection Sections list.
      2. For the type, select Artifact Variable.
      3. Click Create Execution Variable. In the window that opens, type a name and a value, and then click OK.
      4. Save the test suite or test case.
    • To create an artifact execution variable from the manual test editor:
      1. Open a manual test script.
      2. On the manual test script editor toolbar, click the Show Execution Variables View icon Show Execution Variables View.
      3. For the type, select Artifact Variable.
      4. In the Execution Variables view, you can either create artifact variables to use in the manual test script or add project and artifact variables that were created in a test suite or test case. In this way, you pass the data from the test suite or test case
        • To add a variable that was created in a test suite or test case, click the Create Execution Variable icon Create Execution Variable. In the Create Execution Variable window, type the name of the variable, and then click OK.

          Be sure to use the same name as the variable in the test suite or test case. If you specify a value for the variable, it is used only if no value is set in the test suite or test case.

        • To create an execution variable, click the Create Execution Variable iconCreate Execution Variable. In the Create Execution Variable window, type a name and a value, and then click OK.
    • To create a project execution variable, you must be an administrator and have permission to save project execution variables. From the Admin menu, click Manage Project Properties and then click Project Execution Variables. After you create a project execution variable, you can add it to a test artifact.
      • To add a project variable to a test case or test suite:
        1. Open a test case or test suite and click Execution Variables.
        2. For the type, select Project Variable.
        3. Click Add Execution Variable. In the window that opens, set the default values for the variable.
        4. Close the window and then save the test case or test suite.
      • To add the project variable to a test script:
        1. From the test script editor, open the Execution Variables view.
        2. For the type, select Project Variable.
        3. Click Add Execution Variable. In the window that opens, set the default values for the variable.
        4. Close the window and then save the test script.
  2. Insert an execution variable into the test script:
    1. Click the step to insert the execution variable into.
    2. If the Execution Variables view is not open, click the Show Execution Variables View icon Show Execution Variables View.
    3. In the Execution Variables view, choose between project and artifact execution variables by using the Type list. Select a variable to add it to the script.
    4. Insert the execution variable into a test script, selecting either to always use the default value or to add the option to change the default value during the test run.
      • If you want the default value of the execution variable to be inserted when a test reaches a step that includes the execution variable, click the Insert Execution Variables in Current Step Insert Execution Variables in current step icon.
        Insert execution variable

        This option inserts the current value of the variable into the step.

      • If you want to select which value to insert when a test reaches a step that includes the execution variable, click the Create Set Execution Variable Step Create Set Execution Variable step icon.
        Set execution variable

        When the test reaches the step that includes the execution variable, the Update Execution Variable window opens and you can accept the default value or provide a new one.

      During the execution of a manual test script, you can pass execution variables from the previous step to a keyword step. Keywords use these variables and update their values. Keyword steps can also create new execution variables.

      As soon as the keyword execution is finished, updated execution variables are available in the next step and in the test case result. Updates to the execution variable are available in the next step, whether it is a manual keyword step, an automated keyword step, or a manual step.

Results

After a test run, execution variable values are shown in the Execution Variables section of the test case results.

What to do next

To see an example of how to use execution variables in a command-line adapter test, see Integrating your test tools with IBM Engineering Test Management using the command-line adapter.