Test Overview
This test checks that a Postman mock server returns the correct predefined response when a specific API request is made. It verifies the mock response status and body content.
This test checks that a Postman mock server returns the correct predefined response when a specific API request is made. It verifies the mock response status and body content.
pm.test('Mock response returns status 200', () => { pm.response.to.have.status(200); }); pm.test('Mock response body contains expected message', () => { const jsonData = pm.response.json(); pm.expect(jsonData.message).to.eql('Hello from mock server'); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Send GET request to Postman mock server endpoint | Postman sends request to mock server URL configured with predefined response | - | PASS |
| 2 | Receive HTTP response from mock server | Response status 200 and body {"message": "Hello from mock server"} received | Check response status is 200 | PASS |
| 3 | Parse response JSON and verify 'message' field | Response JSON parsed successfully | Verify response body message equals 'Hello from mock server' | PASS |