Variables
Variables are handy for storing data that you can reference from anywhere in your project.
Setting Variables
Variables can be set in the following ways:
1. Statically
Set variables statically by clicking on the project in the left panel and navigating to "Global variables". These variables are initialized at the start of a run and are available to every test.
2. From Code
You can also set variables dynamically from code. Here's an example of setting a variable in the "Post-response script" section of an API step:
Getting Variables
Retrieve variables in the following ways:
1. Fields Supporting Variables
Most fields in the test support variables. Use double curly braces to represent variables - {{...}}
.
Here's an example of using a variable in the keyboard field:
Fields supporting variables include keyboard input value, element selector, API header and body fields, launch arguments, and environment variables.
2. From Code
You can also retrieve variables dynamically from code. Here's an example of getting using an existing variable to validate a UI field.