Test Overview
This test sends an API request with a Bearer token for authorization. It verifies that the server accepts the token and returns a successful response.
This test sends an API request with a Bearer token for authorization. It verifies that the server accepts the token and returns a successful response.
pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); pm.test("Response contains expected data", function () { const jsonData = pm.response.json(); pm.expect(jsonData).to.have.property('userId'); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Open Postman and create a new GET request to the API endpoint | Postman UI shows the request setup screen with URL field empty | - | PASS |
| 2 | Set Authorization type to Bearer Token and enter the token value | Authorization tab shows Bearer Token selected and token input filled | - | PASS |
| 3 | Send the request to the server | Postman sends HTTP GET request with Authorization header: Bearer <token> | - | PASS |
| 4 | Receive response from server with status code 200 and JSON body | Response tab shows status 200 OK and JSON data including userId | Check that response status is 200 | PASS |
| 5 | Run test script to verify response contains 'userId' property | Test results panel shows test execution | Verify response JSON has property 'userId' | PASS |