0
0
Postmantesting~20 mins

PUT request in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PUT Request Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding PUT request idempotency

Which statement best describes the idempotency property of a PUT request in REST API testing?

AA PUT request always creates a new resource regardless of repetition.
BA PUT request can be repeated multiple times with the same effect as a single request.
CA PUT request cannot be repeated without causing errors.
DA PUT request is used only for retrieving data without changes.
Attempts:
2 left
💡 Hint

Think about what happens if you send the same update multiple times.

Predict Output
intermediate
2:00remaining
Output of a PUT request test in Postman

Given this Postman test script for a PUT request, what will be the test result?

Postman
pm.test('Status code is 200', function () {
    pm.response.to.have.status(200);
});
pm.test('Response body has updated name', function () {
    var jsonData = pm.response.json();
    pm.expect(jsonData.name).to.eql('Alice');
});
ABoth tests fail if the response body is empty.
BThe tests pass regardless of response content.
CThe first test fails if status is 200, second test always passes.
DBoth tests pass if the server returns status 200 and the updated name 'Alice'.
Attempts:
2 left
💡 Hint

Check what each test is verifying in the response.

locator
advanced
2:00remaining
Best locator for verifying PUT request response field

In Postman test scripts, which is the best way to access the 'email' field from a JSON response after a PUT request?

Avar email = pm.response.json().email;
Bvar email = pm.response.body.email;
Cvar email = pm.response.get('email');
Dvar email = pm.response.text().email;
Attempts:
2 left
💡 Hint

Consider how to parse JSON response in Postman scripts.

assertion
advanced
2:00remaining
Correct assertion for PUT response status and content

Which Postman test assertion correctly verifies the PUT response has status 204 and an empty body?

Apm.test('Status is 204', () => pm.response.to.have.status(204)); pm.test('Body is empty', () => pm.expect(pm.response.text()).to.eql(''));
Bpm.test('Status is 204', () => pm.response.to.have.status(204)); pm.test('Body is empty', () => pm.expect(pm.response.json()).to.eql({}));
Cpm.test('Status is 204', () => pm.response.to.have.status(204)); pm.test('Body is empty', () => pm.expect(pm.response.body).to.be.null);
Dpm.test('Status is 204', () => pm.response.to.have.status(204)); pm.test('Body is empty', () => pm.expect(pm.response.text()).to.be.null);
Attempts:
2 left
💡 Hint

Think about how to check an empty response body as text.

framework
expert
2:00remaining
Automating PUT request tests with Newman CLI

You want to run a Postman collection with PUT request tests automatically in your CI pipeline using Newman. Which command correctly runs the collection and outputs a JSON report?

Anewman start collection.json -r json -o report.json
Bnewman execute collection.json --output json report.json
Cnewman run collection.json -r json --reporter-json-export report.json
Dnewman run collection.json --json-report report.json
Attempts:
2 left
💡 Hint

Check Newman documentation for JSON reporter options.