0
0
Postmantesting~10 mins

PUT request in Postman - Test Execution Trace

Choose your learning style9 modes available
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.

Test Code - Postman Tests
Postman
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");
});
Execution Trace - 6 Steps
StepActionSystem StateAssertionResult
1Test startsPostman app is open with the PUT request prepared-PASS
2PUT 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
3Response received with status code 200 and JSON body {"id": 123, "name": "John Doe", "email": "john@example.com"}Response displayed in PostmanCheck if status code is 200PASS
4Test script runs assertion to verify response status is 200Test script executingpm.response.to.have.status(200)PASS
5Test script runs assertion to verify response JSON 'name' field equals 'John Doe'Test script executingpm.expect(jsonData.name).to.eql("John Doe")PASS
6Test ends with all assertions passingPostman shows test results as passed-PASS
Failure Scenario
Failing Condition: Server responds with status code other than 200 or response JSON 'name' field does not match 'John Doe'
Execution Trace Quiz - 3 Questions
Test your understanding
What does the test verify first after receiving the response?
AThat the status code is 200
BThat the response time is less than 1 second
CThat the response body is empty
DThat the server URL is correct
Key Result
Always verify both the HTTP status code and the response content to ensure the PUT request successfully updated the resource.