Test Overview
This test checks if the Postman environment variable baseUrl is correctly used to send a GET request and verifies the response status code is 200.
This test checks if the Postman environment variable baseUrl is correctly used to send a GET request and verifies the response status code is 200.
pm.test("Status code is 200", function () { pm.sendRequest({ url: pm.environment.get("baseUrl") + "/api/users", method: 'GET' }, function (err, res) { pm.expect(res).to.have.property('status', 200); }); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Postman test runner is ready to execute the test script | - | PASS |
| 2 | Retrieve environment variable 'baseUrl' | Environment variable 'baseUrl' is set, e.g., 'https://reqres.in' | Check that 'baseUrl' is not null or empty | PASS |
| 3 | Send GET request to 'https://reqres.in/api/users' | Request sent to the server using the URL constructed from environment variable | - | PASS |
| 4 | Receive response from server | Server responds with HTTP status code 200 and user data JSON | Verify response status code equals 200 | PASS |
| 5 | Assertion checks pass confirming status code is 200 | Test runner logs success for the assertion | pm.expect(res).to.have.property('status', 200) | PASS |