Proactive API performance testing and monitoring are vitally important within web application development. Postman is one of the most popular API testing tools that allows web developers to create collections of calls with input data to an API and check the accuracy of the output data. In this article we will discuss a way to define and use Postman environment variables in Dotcom-Monitor tests.

If you use Postman to test your API services, and you want to automate your tests and continuous monitoring, the Dotcom-Monitor platform provides you with comprehensive solutions and tools to create and run API load tests and monitoring task using Postman Collections. To learn how to set up an API load test using Postman Collections in our load testing solution, LoadView, read our Web API Load Testing with Postman Collection. To learn more about setting up monitoring devices, see our Postman Monitoring (Collection Tasks) with Dotcom-Monitor APIs article.

Postman Variables

Environment variables can be defined by clicking on the eye icon in the upper-right corner of the Postman window (see the Postman learning center website for details). The variables allow developers to store and reuse parameter values in API requests and scripts. If you need to update a variable value, you can do it in one place and the value will be automatically changed throughout your request collections. The environment variables in Postman can be used in the URLs, in the POST parameters, in the JavaScript code, etc. To specify the variable, use the brackets as a variable name placeholder:


Postman Variables

Since variables exist separately from request collections in Postman, the values of the variables are not passed together with a Postman collection upon import to Dotcom-Monitor. To address this issue Dotcom-Monitor introduces a Postman Variables import functionality.

Importing Postman Variables to Dotcom-Monitor

If you have been using environment variables to run a collection of requests in Postman, you can import the list of the variables from Postman to Dotcom-Monitor in a few simple steps:

  1. First, export the list of variables from Postman to a JSON file.
  2. In Dotcom-Monitor, go to the corresponding Postman Collection task edit page.
  3. On the Task Configuration sidebar, click the actions menu button   and select Manage Context Parameters.
  4. In the Manage Context Parameters, click Import and provide the JSON file with the list of variables exported from Postman.
  5. Click Done. Once imported, the variables will be automatically added to the list of context parameters.

Postman Variables Import

Once the Postman Collection test has been saved, the system will use the provided context parameter’s value in the API request.

Defining Context Parameters for Postman Collections in Dotcom-Monitor

To manually define a new variable in Dotcom-Monitor, you need to create a context parameter associated with this variable:

  1. On the Task Configuration sidebar, click the actions menu button   and select Manage Context Parameters.
  2. Click Add Parameter and specify the exact same name of the variable as it appears in the uploaded Postman collection. Otherwise, the variable will be parsed as text.
  3. Specify a value of the variable in the corresponding input field and click Done.