0
0
Postmantesting~10 mins

Response time 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 check if the response time is less than 200 milliseconds.

Postman
pm.test("Response time is less than 200ms", function () {
    pm.expect(pm.response.[1]).to.be.below(200);
});
Drag options to blanks, or click blank then click option'
Atime
Belapsed
Cduration
DresponseTime
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'time' or 'duration' instead of 'responseTime' causes errors.
2fill in blank
medium

Complete the code to fail the test if response time exceeds 500 milliseconds.

Postman
pm.test("Response time is acceptable", () => {
    pm.expect(pm.response.[1]).to.be.below(500);
});
Drag options to blanks, or click blank then click option'
AresponseTime
Bduration
Celapsed
Dtime
Attempts:
3 left
💡 Hint
Common Mistakes
Using properties like 'duration' or 'elapsed' which do not exist.
3fill in blank
hard

Fix the error in the code to correctly assert response time is under 1000 ms.

Postman
pm.test("Response time check", function() {
    pm.expect(pm.response.[1]).to.be.lessThan(1000);
});
Drag options to blanks, or click blank then click option'
Atime
BresponseTime
Cduration
Delapsed
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'time' or 'duration' causes the test to fail.
4fill in blank
hard

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

Postman
pm.test("Response time range", () => {
    pm.expect(pm.response.[1]).to.be.[2](100).and.to.be.below(300);
});
Drag options to blanks, or click blank then click option'
AresponseTime
Babove
CgreaterThan
DlessThan
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'greaterThan' instead of 'above' causes assertion errors.
5fill in blank
hard

Fill all three blanks to assert response time is between 200 and 400 ms and log it.

Postman
pm.test("Response time check and log", () => {
    const time = pm.response.[1];
    pm.expect(time).to.be.[2](200).and.to.be.[3](400);
    console.log(`Response time: ${time} ms`);
});
Drag options to blanks, or click blank then click option'
AresponseTime
Babove
Cbelow
DlessThan
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up 'lessThan' and 'below' methods causes assertion failures.