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
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
, 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
- Create an execution variable:
- To create an artifact execution variable from a test suite
or test case and then set the default value:
- 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.
- For the type, select Artifact Variable.
- Click Create Execution Variable. In the
window that opens, type a name and a value, and then click OK.
- Save the test suite or test case.
- To create an artifact execution variable from the manual test
editor:
- Open a manual test script.
- On the manual test script editor toolbar, click the Show
Execution Variables View icon
.
- For the type, select Artifact Variable.
- 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 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:
- Open a test case or test suite and click Execution
Variables.
- For the type, select Project Variable.
- Click Add Execution Variable. In the window
that opens, set the default values for the variable.
- Close the window and then save the test case or test suite.
- To add the project variable to a test script:
- From the test script editor, open the Execution Variables view.
- For the type, select Project Variable.
- Click Add Execution Variable. In the window
that opens, set the default values for the variable.
- Close the window and then save the test script.
- Insert an execution variable into the test script:
- Click the step to insert the execution variable into.
- If the Execution Variables view is not open, click the Show
Execution Variables View icon
.
- 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.
- 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
icon. 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 variablee, click the Create
Set Execution Variable Step
icon. 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.
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 Rational Quality Manager using the command-line
adapter.