0
0
Postmantesting~10 mins

Run order and flow control 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 next request to run in Postman.

Postman
pm.setNextRequest([1]);
Drag options to blanks, or click blank then click option'
Apm.request.name
BnextRequest
C'Login'
DsetNextRequest
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put the request name in quotes.
Using a variable name instead of a string.
Calling a non-existent function.
2fill in blank
medium

Complete the code to stop the collection run after the current request.

Postman
pm.setNextRequest([1]);
Drag options to blanks, or click blank then click option'
Anull
Bundefined
Cfalse
D'Stop'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string like 'Stop' instead of null.
Using false which is not recognized.
3fill in blank
hard

Fix the error in the code to conditionally run the next request only if status code is 200.

Postman
if (pm.response.code === 200) {
    pm.setNextRequest([1]);
} else {
    pm.setNextRequest(null);
}
Drag options to blanks, or click blank then click option'
A'NextRequest'
BsetNextRequest
CnextRequestName
Dpm.nextRequest
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a variable without quotes.
Using a property that does not exist.
Forgetting quotes causing syntax errors.
4fill in blank
hard

Fill both blanks to run 'Login' first, then 'GetData' only if login succeeds.

Postman
if (pm.response.code === 200) {
    pm.setNextRequest([1]);
} else {
    pm.setNextRequest([2]);
}
Drag options to blanks, or click blank then click option'
A'GetData'
B'Login'
Cnull
D'ErrorHandler'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the request names.
Using strings instead of null to stop.
Forgetting quotes around request names.
5fill in blank
hard

Fill all three blanks to create a loop that runs 'CheckStatus' until status is 200, then stops.

Postman
if (pm.response.code !== 200) {
    pm.setNextRequest([1]);
} else {
    pm.setNextRequest([2]);
}

// Log the current request name
console.log([3]);
Drag options to blanks, or click blank then click option'
A'CheckStatus'
Bnull
Cpm.info.requestName
D'Start'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong request names.
Not stopping the run properly.
Logging a wrong variable.