0
0
Postmantesting~10 mins

Response time assertions in Postman - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to assert the response time is less than 200 milliseconds.

Postman
pm.test('Response time is less than 200ms', function () {
    pm.expect(pm.response.responseTime).to.be.[1](200);
});
Drag options to blanks, or click blank then click option'
Abelow
Bequal
Cabove
DlessThan
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'above' instead of 'lessThan' causes the test to check for greater response times.
Using 'equal' will fail if response time is not exactly 200ms.
2fill in blank
medium

Complete the code to assert the response time is at most 500 milliseconds.

Postman
pm.test('Response time is at most 500ms', function () {
    pm.expect(pm.response.responseTime).to.be.[1](500);
});
Drag options to blanks, or click blank then click option'
Abelow
BatMost
Cabove
Dequal
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'above' will check for greater values, which is incorrect here.
Using 'equal' will fail if response time is not exactly 500ms.
3fill in blank
hard

Fix the error in the assertion to correctly check response time is less than 300 milliseconds.

Postman
pm.test('Response time check', function () {
    pm.expect(pm.response.responseTime).to.be.[1](300);
});
Drag options to blanks, or click blank then click option'
Aless
BlessThan
Cbelow
DgreaterThan
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'less' causes a syntax error because it is not a valid method.
Using 'greaterThan' checks the opposite condition.
4fill in blank
hard

Fill both blanks to assert response time is between 100 and 400 milliseconds.

Postman
pm.test('Response time is between 100 and 400ms', function () {
    pm.expect(pm.response.responseTime).to.be.[1](400);
    pm.expect(pm.response.responseTime).to.be.[2](100);
});
Drag options to blanks, or click blank then click option'
Abelow
Babove
ClessThan
DgreaterThan
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'above' instead of 'greaterThan' causes confusion.
Using 'lessThan' instead of 'below' is valid but inconsistent here.
5fill in blank
hard

Fill all three blanks to assert response time is less than 250ms, greater than 50ms, and not equal to 100ms.

Postman
pm.test('Complex response time assertions', function () {
    pm.expect(pm.response.responseTime).to.be.[1](250);
    pm.expect(pm.response.responseTime).to.be.[2](50);
    pm.expect(pm.response.responseTime).to.not.be.[3](100);
});
Drag options to blanks, or click blank then click option'
Abelow
BgreaterThan
Cequal
DlessThan
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'below' instead of 'lessThan' for the first blank causes inconsistency.
For the last blank, forgetting 'not.be' causes the test to check equality instead of inequality.