0
0
Postmantesting~20 mins

First API request in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
API Testing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
What is the response status code of this GET request?
You send a GET request to https://jsonplaceholder.typicode.com/posts/1 using Postman. What is the expected HTTP status code in the response?
Postman
GET https://jsonplaceholder.typicode.com/posts/1
A404
B500
C200
D301
Attempts:
2 left
💡 Hint
A successful GET request to a valid resource usually returns this status code.
assertion
intermediate
2:00remaining
Which assertion correctly verifies the response body contains userId 1?
You receive this JSON response body from the API: {"userId": 1, "id": 1, "title": "...", "body": "..."}. Which Postman test script assertion correctly checks that userId equals 1?
Postman
pm.test("User ID is 1", function () {
    // assertion here
});
Apm.expect(pm.response.json().userId).to.eql(1);
Bpm.expect(pm.response.json().userId).to.be.undefined;
Cpm.expect(pm.response.json().userId).to.be.null;
Dpm.expect(pm.response.json().userId).to.be.above(1);
Attempts:
2 left
💡 Hint
Check for exact equality of userId to 1.
locator
advanced
1:30remaining
Which JSON path correctly locates the title in the response?
Given the JSON response: {"userId": 1, "id": 1, "title": "foo", "body": "bar"}, which JSON path expression correctly selects the title value?
A$.title
B$.id.title
C$.userId.title
D$.body.title
Attempts:
2 left
💡 Hint
The title is a top-level key in the JSON object.
🔧 Debug
advanced
2:00remaining
Why does this Postman test script fail?
Test script: pm.test("Check status", () => { pm.expect(pm.response.code).to.equal(200); }); Why does this test always fail even if the response status is 200?
Postman
pm.test("Check status", () => {
    pm.expect(pm.response.code).to.equal(200);
});
AThe test name string must be outside pm.test parentheses
Bpm.expect syntax is incorrect; should be pm.assert
CThe arrow function syntax is invalid in Postman tests
Dpm.response.code is undefined; correct property is pm.response.status
Attempts:
2 left
💡 Hint
Check the correct property name for response status code in Postman scripts.
framework
expert
2:00remaining
Which Postman feature allows running tests automatically after each request?
You want to automate running your test scripts every time you send a request in Postman. Which feature should you use?
APre-request scripts
BTests tab scripts
CCollection Runner
DMonitor
Attempts:
2 left
💡 Hint
Tests tab scripts run after the response is received.