Test variables
A test variable is a user-defined, name-value pair that stores and refers to information throughout a test. You can assign the value of a variable to a test element or assign the value of a UI object property to a test variable.
When you record a test, the URL of the application is stored in the default variable,
APP_APP1_URL. You can create variables by using the following
options:
- By using the Add local variable
option in the Variables pane.
- By using the Add new variable option when you assign the property of an object to a variable in the Assign step.
- By adding var_name: var_value under vars: section in the Code view of the test script in Test Editor.
You can use the variables for substitution. To substitute data from a test variable, you can
use the Details section of the step details pane. You can perform the
following actions with test variables:
- Provide a default value to the variable during variable creation.
- Change the value of a UI object by replacing the value with a variable. The UI object assumes the value of the variable when the test is run.
- Change the value of the variable using the 'Assign' statement. You can assign an object property to a variable.
- Modify the value of a variable by using the values extracted through RegEx patterns.