Test Overview
This test sends a PATCH request to update a user's email address and verifies the response status and updated data.
This test sends a PATCH request to update a user's email address and verifies the response status and updated data.
pm.test("PATCH request updates user email successfully", function () { pm.sendRequest({ url: 'https://jsonplaceholder.typicode.com/users/1', method: 'PATCH', header: { 'Content-Type': 'application/json' }, body: { mode: 'raw', raw: JSON.stringify({ email: 'newemail@example.com' }) } }, function (err, res) { pm.expect(err).to.be.null; pm.expect(res).to.have.property('status', 200); const jsonData = res.json(); pm.expect(jsonData).to.have.property('email', 'newemail@example.com'); }); });
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Postman test runner is ready | - | PASS |
| 2 | Sends PATCH request to https://jsonplaceholder.typicode.com/users/1 with updated email in JSON body | Request is sent over network | - | PASS |
| 3 | Receives response from server | Response status code 200 OK, body contains updated user data | Check response status code is 200 | PASS |
| 4 | Parses response JSON and verifies 'email' field is 'newemail@example.com' | Response JSON parsed successfully | Verify response JSON has property 'email' with value 'newemail@example.com' | PASS |
| 5 | Test ends with all assertions passed | Test report shows success | - | PASS |