Global variables are also known as predefined or initial variables. These variables are defined before the execution of test cases. A good example will be "baseURL" and it can be used in all the test cases. Each project in vREST will have their own separate set of variables. Further these global variables are grouped under Environments. Few points regarding environments:
- A 'Default' environment is always available in each project. User can define any common variables in this environment.
- For multiple environments like dev, staging, qa, prod etc., user can define custom environments for each.
- Custom environment inherits and overrides all the variables from Default environment.
To define a global variable / environment, follow the steps below:
- Select the "More" > "Global Variables / Environments" option in "Test Cases" tab's toolbar
- [Optional] Either use Default environment or create custom environment by clicking on button 'Create New' like below:
- Then select the project appropriate environment and define the variables for the selected projectenvironment.
Note on Share Value Column: If "Share Value?" column is ticked, only then this variables value is shared among other team members of this project else team members will be having these variables, but the values will be shown as blank and they have to fill in their own values for these variables. Possible use case might be, every team member uses their own credentials for the authentication. For these type of variables, share value column can be un-ticked.
- User can switch the environment by setting value in the Current Environment dropdown available on the left hand side of the test cases tab as shown in the following figure.