Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to get the response time of the API call.
Postman
pm.test('Response time is recorded', function () { var responseTime = pm.response.[1]; pm.expect(responseTime).to.be.a('number'); });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect property names like responseTimeMs or responseTimeInMs.
✗ Incorrect
The correct property to get response time in Postman is responseTime.
2fill in blank
mediumComplete the code to assert the response time is less than 200 milliseconds.
Postman
pm.test('Response time is under 200ms', function () { pm.expect(pm.response.[1]).to.be.below(200); });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using properties that do not exist on the response object.
✗ Incorrect
Use responseTime property to get the response time in milliseconds for assertion.
3fill in blank
hardFix the error in the code to correctly log the response time.
Postman
console.log('Response time:', pm.response.[1] + 'ms');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect or non-existent property names.
✗ Incorrect
The correct property to access response time is responseTime.
4fill in blank
hardFill both blanks to create a test that fails if response time exceeds 500ms.
Postman
pm.test('Response time check', function () { pm.expect(pm.response.[1]).to.be.[2](500); });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'above' instead of 'below' for the assertion.
✗ Incorrect
Use responseTime to get the time and below to assert it is less than 500ms.
5fill in blank
hardFill all three blanks to create a test that logs response time and asserts it is less than 300ms.
Postman
pm.test('Response time logging and check', function () { var time = pm.response.[1]; console.log('Response time:', time + '[2]'); pm.expect(time).to.be.[3](300); });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong property names or assertion methods.
Using 'milliseconds' string instead of 'ms' for logging.
✗ Incorrect
Use responseTime to get time, append ms string for logging, and below for assertion.