Test Overview
This test sends a PUT request to update a user's information on the server. It verifies that the server responds with a success status and the updated data matches the request.
This test sends a PUT request to update a user's information on the server. It verifies that the server responds with a success status and the updated data matches the request.
pm.test("Status code is 200", function () { pm.response.to.have.status(200); }); pm.test("Response has updated user name", function () { const jsonData = pm.response.json(); pm.expect(jsonData.name).to.eql("John Doe"); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Postman app is open with the PUT request prepared | - | PASS |
| 2 | PUT request sent to https://api.example.com/users/123 with JSON body {"name": "John Doe", "email": "john@example.com"} | Request is in progress, waiting for server response | - | PASS |
| 3 | Response received with status code 200 and JSON body {"id": 123, "name": "John Doe", "email": "john@example.com"} | Response displayed in Postman | Check if status code is 200 | PASS |
| 4 | Test script runs assertion to verify response status is 200 | Test script executing | pm.response.to.have.status(200) | PASS |
| 5 | Test script runs assertion to verify response JSON 'name' field equals 'John Doe' | Test script executing | pm.expect(jsonData.name).to.eql("John Doe") | PASS |
| 6 | Test ends with all assertions passing | Postman shows test results as passed | - | PASS |