0
0
Postmantesting~10 mins

Why advanced tests handle complex scenarios 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 send a GET request in Postman test script.

Postman
pm.sendRequest({ url: '[1]', method: 'GET' }, function (err, res) { pm.test('Status code is 200', function () { pm.expect(res.code).to.eql(200); }); });
Drag options to blanks, or click blank then click option'
Aheaders
BPOST
Chttps://api.example.com/data
Dbody
Attempts:
3 left
💡 Hint
Common Mistakes
Using HTTP method instead of URL
Leaving the URL blank
Using request body in GET request
2fill in blank
medium

Complete the code to check if the response JSON has a 'userId' property.

Postman
pm.test('Response has userId', function () { const jsonData = pm.response.json(); pm.expect(jsonData).to.have.[1]('userId'); });
Drag options to blanks, or click blank then click option'
Aheader
Blength
Cstatus
Dproperty
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'length' which checks array length
Using 'status' which is unrelated to JSON keys
3fill in blank
hard

Fix the error in the test that checks if response time is less than 200ms.

Postman
pm.test('Response time is fast', function () { pm.expect(pm.response.responseTime) [1] 200; });
Drag options to blanks, or click blank then click option'
A<
B==
C>
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' which is assignment, not comparison
Using '==' which checks equality, not less than
4fill in blank
hard

Fill both blanks to check if the response JSON array length is greater than 0.

Postman
pm.test('Response array is not empty', function () { const jsonData = pm.response.json(); pm.expect(jsonData.[1]).to.be.[2](0); });
Drag options to blanks, or click blank then click option'
Alength
Babove
Cempty
Dbelow
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'empty' which checks if array is empty
Using 'below' which checks for less than
5fill in blank
hard

Fill all three blanks to test if the response header 'Content-Type' includes 'json'.

Postman
pm.test('Content-Type is JSON', function () { pm.expect(pm.response.headers.get('[1]')).to.[2]('[3]'); });
Drag options to blanks, or click blank then click option'
AContent-Type
Binclude
Cjson
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong header name like 'status'
Using incomplete assertion chains