Test Overview
This test sends a GET request to a mock server URL in Postman and verifies that the response status code is 200, confirming the mock server is working correctly.
Jump into concepts and practice - no test required
This test sends a GET request to a mock server URL in Postman and verifies that the response status code is 200, confirming the mock server is working correctly.
pm.test("Status code is 200", function () { pm.response.to.have.status(200); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Postman app is open with the mock server request loaded | — | PASS |
| 2 | Send GET request to mock server URL | Request sent to mock server endpoint | — | PASS |
| 3 | Receive response from mock server | Response received with status code 200 and mock data body | — | PASS |
| 4 | Run test script to check status code | Test script executed in Postman test tab | Verify response status code is 200 | PASS |
| 5 | Test ends with PASS | Test result shows status code 200 assertion passed | pm.response.to.have.status(200) passed | PASS |
mock server URL in Postman?https://mockserver.com/12345/api/users, what will happen if you send a GET request to this URL in Postman?https://mockserver.com/api/users. What issue will you face?/products using a Postman mock server. Your mock server URL is https://mockserver.com/abcde. Which is the correct full URL to use in your request to get the mocked /products response?/products directly after the unique ID in the URL.