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.
Since variables exist separately from request collections in Postman, the variables values are not passed together with a Postman collection upon import to Dotcom-Monitor. Therefore, if you need to import a Postman collection that uses variables to Dotcom-Monitor, you have to redefine the variables values in the Dotcom-Monitor test settings by using the Context Parameters feature.
Defining Context Parameters for Postman Collections in Dotcom-Monitor
To define a value of a Postman environment variable in Dotcom-Monitor, you need to create a context parameter associated with this variable:
- On the Task Configuration sidebar, click the actions menu button and select Manage Context Parameters.
- Specify an exact same name of the variable as it appears in the uploaded Postman collection. Otherwise, the variable will be parsed as text.
- Specify a value of the variable in the corresponding input field and select Done.
Once the Postman Collection test has been saved, the system will use the provided context parameter’s value in the API request.