Creating and assigning test variables
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.
Before you begin
You must have completed the following tasks:
- Ensured that you are assigned a Team Space Owner, Project Owner, or Member with a Tester role to create or edit a test resource.
- Read and understood the information in Edit branch overview and Create or select an Edit branch.
- Ensured that your project contains a Web UI test in the test navigator panel.
- Opened the test in Test Editor. See Editing a Web UI test.
Procedure
-
Click the
button, if it is displayed on the Test
Editor page. Otherwise, go to step 3.
The Edit branch dialog is displayed. - Select an existing branch or create a new branch.
-
Click the Add local variable
icon
in the Variables pane.
The Add Variable dialog is displayed. -
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.
-
Click Add.
The newly created variable is listed in the Variables pane.
-
Perform the following steps to assign a variable to a test element:
-
Click the Save icon
to save the modifications.
Results
Note: The variables that you created in Test
Editor are listed in the VARIABLES tab of the
Execute test asset dialog 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 VARIABLES tab to view the Test variables defined in the test. See Configuring a run of a Web UI test and Variables.