Update user email using PATCH request
Preconditions (2)
✅ Expected Result: Response status code is 200 OK and response body contains updated email 'newemail@example.com'
pm.test('Status code is 200', function () { pm.response.to.have.status(200); }); pm.test('Response has updated email', function () { const jsonData = pm.response.json(); pm.expect(jsonData.email).to.eql('newemail@example.com'); });
The first test checks that the server responded with status code 200, meaning the PATCH request was successful.
The second test parses the JSON response body and asserts that the 'email' field matches the updated email we sent.
Using pm.test helps organize tests with clear names. pm.response.to.have.status and pm.expect are Postman assertion methods.
Now add data-driven testing with 3 different email inputs to update the user email
PATCH request in Postman?{
"phone": "+1234567890"
}
If the server responds with status 200 and the updated user data including the new phone, what does this indicate?name, email, and address. You only want to update the address but accidentally send the entire user object with email set to null. What is the likely outcome?address updates, but email becomes null on the server -> Option BPass the test and this pattern moves unknown