Test Multiple Scenarios and Log Response Times

I am working with an API that can be used to get freight transit times and I want to run repeated requests and log the response times to provide feedback to my internal team.

The request will be in JSON and Posted using Postman. The origin city/state/zip will be the same in each scenario but the destination city/state/zip will be variable.

Here is my goal:

I want to somehow be able to set the destination city/state/zip as variables and pull city/state/zips from a list of lets say 500 possibilities.

  • Is it possible to somewhere in Postman provide this library of city/state/zips for my request to pull from?
  • If this is possible can I then run requests one after the other automatically switching destination addresses each time and log the response times in a meaningful way?

Have a look at the Performance testing features of Postman.

Test Your API’s Performance by Simulating Real-World Traffic with Postman | Postman Blog

If you are new to Postman and API’s, I would recommend a trip to the Learning Centre first.

Overview | Postman Learning Center

Including the Postman Training links under “Resources”.

image

I would recommend the “Galaxy APIs 101” course first as it gets you used to the application features.

Then the “Galaxy Testing and Automation” course which teaches you how to assert the responses.

In relation to your two specific questions.

  • Is it possible to somewhere in Postman provide this library of city/state/zips for my request to pull from?
  • If this is possible can I then run requests one after the other automatically switching destination addresses each time and log the response times in a meaningful way?

For the first question, the answer is “yes”, and I will refer you to the Learning Centre in the first instance which teaches you how to use collection and environment variables.

You need to store your destination, state and zip as an array of objects within one of those variable types.

Postman has the Lodash library included in the sandbox, which includes the random function. So you can target your saved array in conjunction with this library to randomly select the details for the current request. You would do this in a pre-request script (which is also covered in the training).

The second question is not so easy as the Postman Sandbox does not have direct access to your local filesystem. So getting meaningful metrics won’t be that easy, hence the recommendation to have a look at the Performance testing features first. To see if the metrics produced there are of any use.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.