0
0
Postmantesting~10 mins

Why response validation confirms correctness in Postman - Test Your Understanding

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 status is 200.

Postman
pm.test('Status code is 200', function () { pm.response.to.have.status([1]); });
Drag options to blanks, or click blank then click option'
A404
B200
C500
D201
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong status codes like 404 or 500.
2fill in blank
medium

Complete the code to check if the response body contains the key 'success'.

Postman
pm.test('Response has success key', function () { pm.expect(pm.response.json()).to.have.property([1]); });
Drag options to blanks, or click blank then click option'
A'status'
B'error'
C'success'
D'message'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong key names like 'error' or 'message'.
3fill in blank
hard

Fix the error in the assertion to check if the response time is less than 200ms.

Postman
pm.test('Response time is fast', function () { pm.expect(pm.response.responseTime).to.be.[1](200); });
Drag options to blanks, or click blank then click option'
Abelow
Babove
ClessThan
DgreaterThan
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'lessThan' which is not a valid Chai method.
4fill in blank
hard

Fill both blanks to check if the response JSON has a 'status' key equal to 'success'.

Postman
pm.test('Status is success', function () { pm.expect(pm.response.json()).to.have.[1]('status').that.[2]('success'); });
Drag options to blanks, or click blank then click option'
Aproperty
Bequal
Cequals
Dcontain
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'contain' instead of 'equal' for exact match.
5fill in blank
hard

Fill all three blanks to validate the response JSON array length is greater than 0 and contains the key 'id'.

Postman
pm.test('Response array valid', function () { const data = pm.response.json(); pm.expect(data.length).to.be.[1](0); pm.expect(data[0]).to.have.[2]([3]); });
Drag options to blanks, or click blank then click option'
Aabove
Bproperty
C'id'
Dbelow
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'below' instead of 'above' for length check.