Environment Variables
Change variables values used in the project in one click.
In TestMace you can create changeable variables, for instanсe, to switch between stage and prod environments.
Creating environment variables
In this example we'll create a single variable for stage and prod environments.
Click on the settings icon.
In the pop-up window choose a new environment by clicking on the Add environment button and name it stage.
Create the serverUrl variable and set the stage server url as its value.
Add the prod environment by clicking on the Add environment button.
Create the serverUrl variable and set the prod server url as its value.
Importing environment from Postman
TestMace allows you to import your environments from Postman. To do that, click the + Import environment button, that may be found in the variables editing dialog right under the list with all available environments. After you click the + Import environment button, you'll see the dialog where you should enter the path to the file.
Using Environment Variables
To create a changeable variable use the ${$env.%VARIABLE%}
reference. Change the value of our variable in every node to ${$env.serverUrl}
. Now you can change this variable value anytime.
Where to use environment variables?
Just like plain variables, you can use environment variables in any string field of the node.
Local Environments
Local environments are just usual environments that are not saved into project files, but are stored in the application's local storage. We reccomend you use this environment while working with local and privite data, such as logins, passwords, API-tokens, etc.
You can see local environments at the bottom of the sidebar. Each local environment has the (local)
prefix, so that you could distinguish from other environments.
Drag and drop your local environments to turn them into ordinary ones and vice versa.
Last updated