0
0
Postmantesting~10 mins

Workflow sequencing 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 set the request method to POST in Postman test script.

Postman
pm.request.method = '[1]';
Drag options to blanks, or click blank then click option'
APUT
BPOST
CGET
DDELETE
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing GET which is used to retrieve data.
Using PUT which is for updating resources.
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'
A500
B404
C200
D201
Attempts:
3 left
💡 Hint
Common Mistakes
Using 404 which means not found.
Using 500 which means server error.
3fill in blank
hard

Fix the error in the code to correctly set an environment variable in Postman.

Postman
pm.environment.[1]('token', pm.response.json().access_token);
Drag options to blanks, or click blank then click option'
Aclear
Bget
Cunset
Dset
Attempts:
3 left
💡 Hint
Common Mistakes
Using get which only retrieves a value.
Using unset which removes a variable.
4fill in blank
hard

Fill both blanks to correctly extract a JSON value and assert it equals 'success' in Postman test script.

Postman
const status = pm.response.json().[1];
pm.test('Status is success', function () { pm.expect(status).to.[2]('success'); });
Drag options to blanks, or click blank then click option'
Astatus
Bequal
Cinclude
Dmessage
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'message' instead of 'status' for the JSON key.
Using 'include' which checks for substring, not exact match.
5fill in blank
hard

Fill all three blanks to create a test that checks if the response time is less than 500ms in Postman.

Postman
pm.test('Response time is fast', function () {
  pm.expect(pm.response.[1]).to.be.[2](450).and.[3](500);
});
Drag options to blanks, or click blank then click option'
AresponseTime
Bbelow
ClessThan
DgreaterThan
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'greaterThan' which checks if response time is more than 500ms.
Using 'time' instead of 'responseTime' for response time.