0
0
Postmantesting~10 mins

Why chaining simulates real workflows 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 environment variable with the response value.

Postman
pm.environment.set('userId', [1]);
Drag options to blanks, or click blank then click option'
Apm.request.url
Bpm.response.text()
Cpm.response.json().id
Dpm.environment.get('userId')
Attempts:
3 left
💡 Hint
Common Mistakes
Using pm.response.text() returns raw text, not parsed JSON.
Trying to get variable from environment instead of response.
2fill in blank
medium

Complete the code to use the environment variable in the next request URL.

Postman
pm.request.url = `https://api.example.com/users/$[1]`;
Drag options to blanks, or click blank then click option'
Apm.environment.get('userId')
Bpm.response.json().id
Cpm.variables.get('userId')
Dpm.request.body
Attempts:
3 left
💡 Hint
Common Mistakes
Using pm.response.json() here is wrong because this is a new request.
Using pm.variables.get() may not access environment variables.
3fill in blank
hard

Fix the error in the test script to correctly check the response status code.

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"200"
Cpm.response.code
D'200'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '200' or "200" as string causes assertion failure.
Using pm.response.code is not valid here.
4fill in blank
hard

Fill both blanks to extract 'token' from response and set it as a global variable.

Postman
const token = pm.response.json().[1];
pm.globals.set('[2]', token);
Drag options to blanks, or click blank then click option'
Atoken
BauthToken
CaccessToken
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong property name like 'id' or 'accessToken'.
Setting environment variable instead of global.
5fill in blank
hard

Fill all three blanks to create a test that checks if the response JSON has a 'success' property set to true.

Postman
pm.test('Response success is true', function () {
  const jsonData = pm.response.[1]();
  pm.expect(jsonData.[2]).to.eql([3]);
});
Drag options to blanks, or click blank then click option'
Ajson
Bsuccess
Ctrue
Dtext
Attempts:
3 left
💡 Hint
Common Mistakes
Using pm.response.text() returns string, not JSON.
Checking 'success' as string 'true' instead of boolean true.