Test Environments & Environment Variables

Create Test Environments

Unlike test variables, environment variables are not scoped to a specific test but are available for all the tests in an API. They allow you to create multiple environments in your test (for instance — production, dev, and staging) and assign different values for variables in different environments.

To create a new environment for your test, go to the API Settings, and create a new environment in the "Test Environments" section.

Click the "+" icon to create a new environment and give it a name.

Create Environment Variables

After your environment is created you can add new variables in it just like you would with test variables. You have two options.

  • An environment variable allows you to see the value of the variable
  • A secret key hides the value of the variable

Adding Environment Variables to Your Tests

Using the variables in your tests works just like using test variables. Either pass their name to assertion actions or use them in other actions with curly braces ({{varName}}).

Remember to use three curly braces if the value in your variable contains special characters (e.g., {{{baseUrl}}}). See here for more details on variables.

Running Your Tests with Environments

When running your test, you can select which environment to run it in using the selector in the left navigation. Select the desired environment before running the test.