0
0
Postmantesting~20 mins

Response time assertions in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Response Time Assertion Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
assertion
intermediate
2:00remaining
Check if response time is under 500ms

Which Postman test script correctly asserts that the response time is less than 500 milliseconds?

A;)} ;)005(woleb.eb.ot.)emiTesnopser.esnopser.mp(tcepxe.mp { >= )( ,'sm005 naht ssel si emit esnopseR'(tset.mp
Bpm.test('Response time is less than 500ms', () => { pm.expect(pm.response.responseTime).to.be.below(500); });
Cpm.test('Response time is less than 500ms', () => { pm.expect(pm.response.responseTime).to.be.above(500); });
Dpm.test('Response time is less than 500ms', () => { pm.expect(pm.response.responseTime).to.equal(500); });
Attempts:
2 left
💡 Hint

Look for the correct property name and the correct comparison method.

Predict Output
intermediate
2:00remaining
Output of response time assertion failure

What will be the test result output if the response time is 600ms for the following Postman test?

pm.test('Response time under 500ms', () => { pm.expect(pm.response.responseTime).to.be.below(500); });
Postman
pm.test('Response time under 500ms', () => { pm.expect(pm.response.responseTime).to.be.below(500); });
ATest fails with syntax error
BTest passes successfully
CTest fails with assertion error: expected 600 to be below 500
DTest is skipped automatically
Attempts:
2 left
💡 Hint

Think about what happens when the actual response time is greater than the expected maximum.

🔧 Debug
advanced
2:00remaining
Identify the error in response time assertion script

Find the error in this Postman test script that checks response time:

pm.test('Response time check', () => { pm.expect(response.responseTime).to.be.below(300); });
Postman
pm.test('Response time check', () => { pm.expect(response.responseTime).to.be.below(300); });
AThe variable <code>response</code> is undefined; should use <code>pm.response</code>
BThe method <code>to.be.below</code> does not exist
CThe test name is missing quotes
DThe response time should be checked with <code>pm.response.time</code>
Attempts:
2 left
💡 Hint

Check the object used to access response properties in Postman scripts.

🧠 Conceptual
advanced
2:00remaining
Best practice for response time assertion threshold

Which is the best reason to avoid setting a very low response time threshold (e.g., 10ms) in Postman assertions?

AResponse time assertions are ignored if threshold is below 50ms
BLower thresholds improve test accuracy and should always be used
CPostman does not support response time assertions below 100ms
DNetwork and server variability can cause false test failures even if the API is healthy
Attempts:
2 left
💡 Hint

Think about real-world network conditions and server load.

framework
expert
3:00remaining
Implementing a custom response time assertion in Postman

You want to create a Postman test that fails if the response time exceeds 400ms but logs a warning if it is between 300ms and 400ms. Which script correctly implements this behavior?

Apm.test('Response time check', () => { const time = pm.response.responseTime; if (time > 400) { pm.expect.fail(`Response time too high: ${time}ms`); } else if (time > 300) { console.warn(`Warning: Response time is ${time}ms`); } else { pm.expect(time).to.be.below(300); } });
Bpm.test('Response time check', () => { const time = pm.response.responseTime; if (time > 400) { console.warn(`Response time too high: ${time}ms`); } else if (time > 300) { pm.expect.fail(`Warning: Response time is ${time}ms`); } else { pm.expect(time).to.be.below(300); } });
Cpm.test('Response time check', () => { const time = pm.response.responseTime; if (time > 400) { pm.expect(time).to.be.below(400); } else if (time > 300) { pm.expect(time).to.be.below(300); } });
Dpm.test('Response time check', () => { const time = pm.response.responseTime; if (time > 300) { pm.expect.fail(`Response time too high: ${time}ms`); } else { pm.expect(time).to.be.below(400); } });
Attempts:
2 left
💡 Hint

Consider how to fail a test explicitly and how to log warnings without failing.