0
0
Postmantesting~20 mins

Example requests and responses in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Postman Testing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:00remaining
What is the response status code for a successful GET request?

In Postman, you send a GET request to a valid API endpoint. What status code do you expect in the response for a successful request?

A200
B404
C500
D302
Attempts:
2 left
💡 Hint

Think about the standard HTTP status code for success.

assertion
intermediate
1:30remaining
Which Postman test script correctly asserts the response body contains a specific key?

You want to check if the JSON response body has a key named userId. Which test script is correct?

Apm.test('Response has userId', () => { pm.response.json().has('userId'); });
Bpm.test('Response has userId', () => { pm.expect(pm.response.json()).to.have.property('userId'); });
Cpm.test('Response has userId', () => { pm.expect(pm.response.body).to.include('userId'); });
Dpm.test('Response has userId', () => { pm.expect(pm.response.json().userId).to.exist; });
Attempts:
2 left
💡 Hint

Use pm.expect with to.have.property to check keys in JSON.

🧠 Conceptual
advanced
1:00remaining
What does a 401 HTTP response code indicate in API testing?

When testing an API, you receive a 401 status code. What does this mean?

AThe request was successful and data is returned.
BThe requested resource was not found on the server.
CThe client is not authorized to access the requested resource.
DThe server encountered an internal error.
Attempts:
2 left
💡 Hint

Think about authentication and permission errors.

🔧 Debug
advanced
1:30remaining
Why does this Postman test script fail with an error?

Look at this test script:

pm.test('Check name', () => { pm.expect(pm.response.json().name).to.equal; });

Why does it fail?

Postman
pm.test('Check name', () => { pm.expect(pm.response.json().name).to.equal; });
AThe <code>to.equal</code> assertion is missing the expected value argument.
BThe test script is missing a semicolon at the end.
CThe <code>pm.response.json()</code> method is incorrect and should be <code>pm.response.body</code>.
DThe <code>pm.expect</code> function cannot be used inside <code>pm.test</code>.
Attempts:
2 left
💡 Hint

Check the syntax of the assertion method.

framework
expert
2:00remaining
Which Postman feature allows running a collection of requests with different data sets automatically?

You want to test an API with many input values without manually changing each request. Which Postman feature helps you do this?

AMock Server to simulate responses
BPre-request scripts to modify headers
CMonitor to schedule requests
DCollection Runner with data files (CSV or JSON)
Attempts:
2 left
💡 Hint

Think about running many tests automatically with different inputs.