0
0
Postmantesting~10 mins

Status codes reading in Postman - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test sends a GET request to a sample API endpoint and verifies that the response status code is 200, which means the request was successful.

Test Code - Postman
Postman
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});
Execution Trace - 4 Steps
StepActionSystem StateAssertionResult
1Test startsPostman app is open with the test script loaded-PASS
2Send GET request to the API endpointRequest sent, waiting for response-PASS
3Receive response from the serverResponse received with status code 200-PASS
4Run assertion to check if status code is 200Response status code is 200pm.response.to.have.status(200);PASS
Failure Scenario
Failing Condition: The API returns a status code other than 200, for example 404 or 500
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify in this Postman script?
AThe response body contains specific data
BThe response status code is 200
CThe request method is POST
DThe response time is less than 1 second
Key Result
Always verify the HTTP status code in your API tests to confirm the server responded as expected before checking response content.