0
0
Postmantesting~10 mins

Script execution order 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 a variable in the Pre-request Script.

Postman
pm.variables.set('[1]', '123');
Drag options to blanks, or click blank then click option'
Aconsole.log
BsetVariable
CmyVar
DsendRequest
Attempts:
3 left
💡 Hint
Common Mistakes
Using function names instead of variable names.
Not using quotes around the variable name.
2fill in blank
medium

Complete the code to check the response status in the Tests 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'
A200
B'OK'
C'200'
Dpm.response.status
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string '200' instead of number 200.
Using status text like 'OK' instead of code.
3fill in blank
hard

Fix the error in the Pre-request Script to log the variable value.

Postman
console.log(pm.variables.[1]('myVar'));
Drag options to blanks, or click blank then click option'
Asend
Bset
Clog
Dget
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'set' which assigns a value instead of reading.
Using 'log' which is not a method of pm.variables.
4fill in blank
hard

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

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
Dtime
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'above' instead of 'below' for less than check.
Using wrong property name like 'time'.
5fill in blank
hard

Fill all three blanks to create a test that checks if JSON response has a key 'success' with value true.

Postman
pm.test('Response has success true', function () { const jsonData = pm.response.json(); pm.expect(jsonData.[1]).[2].[3](true); });
Drag options to blanks, or click blank then click option'
Asuccess
Bto
Cequal
Dhave
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'have' instead of 'equal' for value check.
Using wrong key name or missing chaining.