0
0
Postmantesting~5 mins

Response time in Postman

Choose your learning style9 modes available
Introduction

Response time shows how fast a system answers your request. It helps check if the system is quick enough for users.

Checking if a website loads quickly for visitors.
Testing if an API responds fast enough for an app.
Measuring speed after making changes to a system.
Comparing performance before and after updates.
Ensuring service meets promised speed in contracts.
Syntax
Postman
pm.test("Response time is less than 200ms", function () {
    pm.expect(pm.response.responseTime).to.be.below(200);
});

pm.response.responseTime gives the time in milliseconds.

Use pm.expect() to check if response time meets your limit.

Examples
This test passes if the response time is less than 500 milliseconds.
Postman
pm.test("Response time is under 500ms", function () {
    pm.expect(pm.response.responseTime).to.be.below(500);
});
Using arrow function syntax to check response time under 1 second.
Postman
pm.test("Response time is not too slow", () => {
    pm.expect(pm.response.responseTime).to.be.below(1000);
});
Sample Program

This test checks if the API response time is faster than 300 milliseconds. If yes, the test passes; if not, it fails.

Postman
pm.test("Response time is less than 300ms", function () {
    pm.expect(pm.response.responseTime).to.be.below(300);
});
OutputSuccess
Important Notes

Response time can vary due to network or server load.

Set realistic limits based on typical user experience.

Run tests multiple times to get average response time.

Summary

Response time measures how fast a system replies.

Use pm.response.responseTime in Postman tests.

Check response time to ensure good user experience.