You can create a variable and initialize it to an alphanumeric value. Then, within the
test, you can assign the value of the variable to a test element.
Procedure
-
Click the
button displayed on the Test
Editor page.
The Edit button appears only when no active edit branch is
selected.
Alternatively, right-click the test in the test navigator panel and select
Edit.
The Edit branch dialog is displayed.
If the
Edit branch dialog is not displayed, then go to step
3.
-
Select an existing branch or create a new branch.
-
Click the Configure settings and data step in Test
Editor.
The Configure settings and data pane is displayed.
-
Click Add icon
in the
Variables section.
-
Enter a name for the variable in Name.
The name must start with an alphabet, $, or _ and the name must not be a reserved
keyword or contain a space.
-
Enter a value for the variable.
The newly created variable is listed in the Variables
section.
The default variable type is Input.
-
Optional: Click the variable icon
to change the type
to Output or Local.
-
Perform the following steps to assign a variable to a test element:
-
Select a Type or Select step for
which you want to replace the value with the value of a variable.
The step details pane is displayed.
-
Enter the variable name in the Value field for the selected
UI Object in the following format:
${variable_name}For example, you can replace the text that
is saved in the text field for username with the value of the
variable, user_name.
-
Close the step details pane.
The test step is updated with the variable that you chose.
-
Click the Save icon
to save the modifications.
Results
You have created a variable and assigned the value of the variable
to a test element.Note: The variables that you created in Test
Editor are listed in the Variables section of the
Configure settings and data pane as test variables.
What to do next
- Run the test in Test Editor and view the Functional Report to
verify the test steps with the variable assignment. See Running a Web UI test.
- Start the test run from the Execution page, and in the
Execute test asset dialog, navigate to the Configure
settings and data option on the Test Editor page to
view the Test variables defined in the test. See Configuring a run of a Web UI test
and Variables.