0
0
Postmantesting~10 mins

Monitor results analysis in Postman - Test Execution Trace

Choose your learning style9 modes available
Test Overview

This test runs a Postman monitor to check an API endpoint's response status and content. It verifies that the API returns a 200 status code and the expected JSON key.

Test Code - Postman Tests
Postman
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

pm.test("Response has userId key", function () {
    var jsonData = pm.response.json();
    pm.expect(jsonData).to.have.property('userId');
});
Execution Trace - 4 Steps
StepActionSystem StateAssertionResult
1Monitor starts and sends HTTP GET request to the API endpointPostman Monitor dashboard shows the request is running-PASS
2Monitor receives HTTP response with status code 200Response body contains JSON data with userId and other keysCheck if response status code is 200PASS
3Monitor runs test to verify response JSON has 'userId' keyResponse JSON parsed successfullyVerify presence of 'userId' property in JSONPASS
4Monitor completes execution and reports test resultsPostman Monitor dashboard shows tests passedAll tests passedPASS
Failure Scenario
Failing Condition: API returns status code other than 200 or response JSON lacks 'userId' key
Execution Trace Quiz - 3 Questions
Test your understanding
What does the first test in the Postman monitor verify?
AThat the API response status code is 200
BThat the response body contains the word 'userId'
CThat the API request method is POST
DThat the response time is less than 1 second
Key Result
Always verify both the HTTP status code and the expected data in the response body to ensure the API behaves correctly.