0
0
Postmantesting~10 mins

Why documentation improves API adoption 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 set the request method to GET in Postman test script.

Postman
pm.request.method = '[1]';
Drag options to blanks, or click blank then click option'
AGET
BPOST
CPUT
DDELETE
Attempts:
3 left
💡 Hint
Common Mistakes
Using POST instead of GET for fetching data.
2fill in blank
medium

Complete the code to check if the response status code is 200 in a Postman test script.

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
B500
C200
D201
Attempts:
3 left
💡 Hint
Common Mistakes
Using 404 which means Not Found.
3fill in blank
hard

Fix the error in the Postman test script to correctly check if the response body contains the key 'userId'.

Postman
pm.test('Response has userId', function () { pm.expect(pm.response.json()).to.have.[1]('userId'); });
Drag options to blanks, or click blank then click option'
Aproperty
Blength
Cstatus
Dheader
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'length' which checks array length, not keys.
4fill in blank
hard

Fill both blanks to create a test that checks if the response time is less than 500 milliseconds.

Postman
pm.test('Response time is fast', function () { pm.expect(pm.response.[1]).to.be.[2](500); });
Drag options to blanks, or click blank then click option'
AresponseTime
Bbelow
Cabove
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'above' which checks if response time is greater.
5fill in blank
hard

Fill both blanks to write a test that verifies the JSON response has a 'name' key with value 'John'.

Postman
pm.test('Name is John', function () { pm.expect(pm.response.json().[1]).to.[2]('John'); });
Drag options to blanks, or click blank then click option'
Aname
Bhave
Cequal
Dlength
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'length' which is for size, not value equality.