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.
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.
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 test script loaded | — | PASS |
| 2 | Send GET request to the API endpoint | Request sent, waiting for response | — | PASS |
| 3 | Receive response from the server | Response received with status code 200 | — | PASS |
| 4 | Run assertion to check if status code is 200 | Response status code is 200 | pm.response.to.have.status(200); | PASS |
200 usually mean in Postman response testing?pm.test('Check status', () => {
pm.expect(pm.response.code).to.be.oneOf([200, 201]);
});pm.test('Status is 200', () => {
pm.expect(pm.response.code = 200);
});Pass the test and this pattern moves unknown