Compute Response Time in Postman

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);
  2. Check that handlers start work faster.

«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;
  • Maximum (peak) response time to find out the extremes.

To perform such testing we should:

  1. Run required request multiple times through Postman collection runner;
  2. Save each of response time into variable;
  3. Calculate average and maximum timings.

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

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

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

On the last request we will get average and maximum 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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How Content Migration to Headless CMS Could Be Your Last—Tom Marshall, Head of Technology

The Big DevOps Misunderstanding

Controlling Lights with a Raspberry Pi

Scaling Up Your SaaS Product Infrastructure: High-Availability

Install OpendayLight Lithium

UI Libraries by Mobile App Developers —  #6

Make it Yours: Customizing The Portal Dashboard

Mocking integration tests with Flutter

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrey Enin

Andrey Enin

Quality assurance engineer

More from Medium

API Security Testing With Postman and OWASP Zap

How to make application test using Appium and Serenity BDD Screenplay?

Creating User Persona

Create TestNG Project In Eclipse & Run Selenium Test Script