0
0
Postmantesting~10 mins

What APIs are and why testing them matters 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 the response status code is 200. It checks that the API is working and returning data correctly.

Test Code - Postman
Postman
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});
Execution Trace - 5 Steps
StepActionSystem StateAssertionResult
1Test startsPostman app is open with the GET request prepared-PASS
2Send GET request to https://jsonplaceholder.typicode.com/posts/1Request sent, waiting for response-PASS
3Receive response with status code 200 and JSON bodyResponse received with data for post id 1Check response status code is 200PASS
4Run test script to verify status codeTest script executed in Postman test tabpm.response.to.have.status(200)PASS
5Test completes successfullyTest result shows PASS in Postman-PASS
Failure Scenario
Failing Condition: API returns a status code other than 200, e.g., 404 Not Found
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify in this API test?
AThe API returns status code 200
BThe API returns a JSON body with user data
CThe API response time is less than 1 second
DThe API requires authentication
Key Result
Always verify the API response status code to confirm the API endpoint is reachable and functioning as expected before testing response data.