0
0
Postmantesting~10 mins

Why monitoring ensures API health in Postman - Test Execution Impact

Choose your learning style9 modes available
Test Overview

This test checks if the API endpoint responds correctly and within an acceptable time, ensuring the API is healthy and available.

Test Code - Postman Tests
Postman
pm.test("API responds with status 200", function () {
    pm.response.to.have.status(200);
});

pm.test("Response time is less than 500ms", function () {
    pm.expect(pm.response.responseTime).to.be.below(500);
});
Execution Trace - 4 Steps
StepActionSystem StateAssertionResult
1Send GET request to API endpointPostman sends request to the API server-PASS
2Receive response from APIAPI server returns HTTP status and response data-PASS
3Check if response status is 200Response status code is 200 OKpm.response.to.have.status(200)PASS
4Check if response time is less than 500msResponse time recorded by Postmanpm.expect(pm.response.responseTime).to.be.below(500)PASS
Failure Scenario
Failing Condition: API returns a status other than 200 or response time exceeds 500ms
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test check first after receiving the API response?
AIf the response status code is 200
BIf the response body contains data
CIf the response headers are present
DIf the response time is exactly 500ms
Key Result
Monitoring API health by checking status codes and response times helps catch issues early, ensuring the API is reliable and performs well for users.