Test Overview
This test sends a request with Basic Authentication headers to verify the server accepts valid credentials and returns a successful response.
This test sends a request with Basic Authentication headers to verify the server accepts valid credentials and returns a successful response.
pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); pm.test("Response contains authenticated user info", function () { const jsonData = pm.response.json(); pm.expect(jsonData).to.have.property('authenticated', true); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Postman is ready to send the request | - | PASS |
| 2 | Postman sends HTTP GET request with Basic Auth header (username and password encoded in header) | Request is sent to the server endpoint requiring Basic Authentication | - | PASS |
| 3 | Server receives request and validates Basic Auth credentials | Server checks Authorization header for correct username and password | - | PASS |
| 4 | Server responds with HTTP 200 status and JSON body indicating authentication success | Response contains status 200 and JSON {"authenticated": true} | Check response status is 200 | PASS |
| 5 | Postman test script runs assertion to verify status code is 200 | Response status code is 200 | pm.response.to.have.status(200) | PASS |
| 6 | Postman test script runs assertion to verify response JSON has property 'authenticated' set to true | Response JSON contains {"authenticated": true} | pm.expect(jsonData).to.have.property('authenticated', true) | PASS |
| 7 | Test ends with all assertions passing | Test report shows pass for all checks | - | PASS |