Compute Response Time in Postman

Sometimes, as a test engineer, you need to perform a non-function testing

Compute Response Time in Postman

When developers start to speed up an API the QA department usually get two types of tasks:

  1. Сheck that handlers work the same way as they worked before (that could be tested by comparison of responses);

«Start work faster» means starting to respond in less time. Response time is a common non-functional requirement for the API or its particular handlers or methods.

Postman allows to test the response time, but one check is often not enough. For complex testing of response time we need to measure:

  • Average response time, based on a large number of requests;

To perform such testing we should:

  1. Run required request multiple times through Postman collection runner;

First of all, we need to create a variable without value.

Global variable = timings
Global variable = timings
Global variable = timings

Then, write a few lines of code in the Tests tab of the request (I took for example one handler of The COVID Tracking Project API). For convenience, I have output the calculated data into the test name.

The only edge case is the first or single request, which should be taken into consideration and properly handled.

Single request
Single request
Single request

Now, we should clear the variable’s value (otherwise it will affect our subsequent results) and run the collection with a significant amount of iterations.

Collection runner
Collection runner
Collection runner

On the last request we will get average and maximum response timings.

Response timings
Response timings
Response timings

When we perform the same test (run this collection with the same number of iterations) for two handlers: the benchmark and the new one, we can compare our metrics.

Of course, such kind of non-functional testing could be made via more professional tools like JMeter or LoadRunner.

Quality assurance engineer