Using Variables
While recording your test, Preflight will suggest variables that you can use to generate random data rather than the static text that is available while recording your text. For example, you can use variables for names, emails and passwords. You can also add variables after recording the test. In addition, you can define custom variables that can be used in all tests.
This topic includes:
Using Variables While Recording
To Use Variables
-
While recording, when you click on a text field, Preflight will suggest variables. The example below shows a suggestion for generating a random email:
-
Click on the suggested variable to implement the suggestion. To view the entire list of variables, click {+} to display the Variables pop-up:
You can also access this list from the recorder. Click { } on the step that you would like to assign a variable:
-
To generate a new randomized variable, select the variable(s) that you want to use from the New tab. You can also manually enter variable combinations such as:
First name: {{name.firstname}}
To achieve this, type "First name:" on the text field that says Type something and enter and click enter. Then pick your variable(s) from the list.
-
To reuse variables you've already used, click the Used tab.
Ensure that you select your used variables from the Used tab as selecting them from the New tab will generate new randomized variables You can also select checkpoints as variables. -
To use a global variable, click the
Other
tab. See Defining Global Variables below for details. -
Click Apply.
Defining Global Variables
To Define Global Variables:
You can define global variables that can be used in any test, and can be accessed during recording from the Other tab in the Variables pop-up or in the recorder.
- In the Navigation bar, select Settings > Variables.
- Define a name and value and click Add Variable. The variable is added to the list of variables and is assigned a unique ID.
Using Global Variables in Tests
To Use Global Variables in Tests
You can use global variables in any step of your test, while recording as described in Using Variables above. In addition, you can type:
{{common.yourVariableName}}
in any Step Type.
You can also use global variables with Run Javascript step types.
Related topics