Bird
Raised Fist0
Postmantesting~20 mins

Workflow sequencing in Postman - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Workflow Sequencing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Order of request execution in Postman Collection Runner

You have a Postman collection with 3 requests: Login, Get Profile, and Logout. You want to run them in sequence so that Login runs first, then Get Profile, then Logout. How does Postman Collection Runner execute these requests by default?

ARuns requests in the order they appear in the collection, one after another.
BRuns all requests in parallel at the same time.
CRuns only the first request and skips the rest.
DRuns requests randomly without any order.
Attempts:
2 left
💡 Hint

Think about how a playlist works when you play songs one by one.

Predict Output
intermediate
2:00remaining
Output of test script execution order in Postman

Consider this Postman test script attached to a request:

console.log('Start test');
pm.test('Status code is 200', () => {
  pm.response.to.have.status(200);
});
console.log('End test');

What will be the order of console logs when this test runs?

AStart test, End test
BEnd test, Start test
CStart test, End test, Status code assertion result
DOnly Status code assertion result
Attempts:
2 left
💡 Hint

Think about synchronous vs asynchronous code execution.

locator
advanced
2:00remaining
Correct way to reference environment variable in Postman test script

You want to check if the environment variable authToken is set after a login request. Which locator syntax correctly accesses this variable in a Postman test script?

Apm.env.authToken
Bpm.variables.authToken
Cpm.getEnvironmentVariable('authToken')
Dpm.environment.get('authToken')
Attempts:
2 left
💡 Hint

Check Postman API for environment variable access methods.

assertion
advanced
2:00remaining
Assertion to verify JSON response contains a specific key

You receive this JSON response from an API:

{"user": {"id": 123, "name": "Alice"}}

Which Postman test assertion correctly checks that the response has a user key?

Apm.response.to.have.jsonKey('user');
Bpm.expect(pm.response.json()).to.have.property('user');
Cpm.expect(pm.response.body).to.include('user');
Dpm.response.json().has('user');
Attempts:
2 left
💡 Hint

Use Chai assertion style with pm.expect and to.have.property.

framework
expert
2:00remaining
Sequence control using Postman setNextRequest in a collection

You have a Postman collection with requests: Step1, Step2, and Step3. You want to run Step1 and then conditionally run Step3 skipping Step2. Which test script code in Step1 achieves this?

Apm.setNextRequest('Step3');
Bpostman.setNextRequest('Step3');
Cif (pm.response.code === 200) { postman.setNextRequest('Step3'); } else { postman.setNextRequest('Step2'); }
DsetNextRequest('Step3');
Attempts:
2 left
💡 Hint

Remember the exact method name and object to call for controlling request flow.

Practice

(1/5)
1. What is the main purpose of workflow sequencing in Postman?
easy
A. To encrypt API requests for security
B. To create visual charts of API responses
C. To automatically generate API documentation
D. To run multiple requests in a specific order and share data between them

Solution

  1. Step 1: Understand workflow sequencing

    Workflow sequencing means running requests one after another in a set order.
  2. Step 2: Identify the purpose in Postman

    It allows passing data from one request to the next, making multi-step testing reliable.
  3. Final Answer:

    To run multiple requests in a specific order and share data between them -> Option D
  4. Quick Check:

    Workflow sequencing = ordered requests with data sharing [OK]
Hint: Think: run requests step-by-step sharing info [OK]
Common Mistakes:
  • Confusing workflow sequencing with documentation generation
  • Thinking it creates charts or encrypts requests
  • Believing requests run randomly without order
2. Which Postman script command is used to call another request inside a test script for workflow sequencing?
easy
A. pm.callRequest()
B. pm.sendRequest()
C. pm.executeRequest()
D. pm.runRequest()

Solution

  1. Step 1: Recall Postman scripting commands

    Postman provides a method to send HTTP requests programmatically inside scripts.
  2. Step 2: Identify the correct method for calling requests

    The correct method is pm.sendRequest(), which sends a request and handles its response.
  3. Final Answer:

    pm.sendRequest() -> Option B
  4. Quick Check:

    Call requests inside scripts = pm.sendRequest() [OK]
Hint: Remember: sendRequest sends HTTP calls inside scripts [OK]
Common Mistakes:
  • Using non-existent methods like pm.callRequest()
  • Confusing with pm.executeRequest() or pm.runRequest() which don't exist
  • Misspelling the method name
3. Consider this Postman test script snippet inside Request A:
pm.sendRequest('https://api.example.com/token', (err, res) => {
  pm.environment.set('token', res.json().access_token);
});

What will be the value of token in environment after this runs?
medium
A. The access_token value from the JSON response of the called request
B. Undefined, because pm.sendRequest does not set environment variables
C. An error, because pm.sendRequest cannot be used inside test scripts
D. The entire JSON response as a string

Solution

  1. Step 1: Understand pm.sendRequest callback

    The callback receives the response object res, which can be parsed as JSON.
  2. Step 2: Extract and set environment variable

    The script sets token to res.json().access_token, which is the access token string from the response.
  3. Final Answer:

    The access_token value from the JSON response of the called request -> Option A
  4. Quick Check:

    pm.sendRequest sets env var = access_token value [OK]
Hint: pm.sendRequest callback can set env vars from response JSON [OK]
Common Mistakes:
  • Assuming pm.sendRequest cannot set variables
  • Thinking the whole JSON is stored instead of just access_token
  • Confusing asynchronous callback behavior
4. You wrote this Postman test script to run Request B after Request A:
pm.sendRequest('https://api.example.com/data', (err, res) => {
  pm.environment.set('dataId', res.json().id);
});
pm.sendRequest('https://api.example.com/details/{{dataId}}', (err, res) => {
  console.log(res.json());
});

Why might the second request fail or use an empty dataId?
medium
A. Because pm.sendRequest cannot be called twice in the same script
B. Because environment variables cannot be used inside pm.sendRequest URLs
C. Because pm.sendRequest is asynchronous, the second request runs before dataId is set
D. Because console.log is not allowed inside pm.sendRequest callbacks

Solution

  1. Step 1: Analyze asynchronous behavior of pm.sendRequest

    pm.sendRequest runs asynchronously, so the second call may start before the first finishes.
  2. Step 2: Understand timing of environment variable setting

    The variable dataId is set only after the first request completes, so the second request may see it as empty if it runs too soon.
  3. Final Answer:

    Because pm.sendRequest is asynchronous, the second request runs before dataId is set -> Option C
  4. Quick Check:

    Async calls need chaining to ensure order [OK]
Hint: Async calls run out of order unless chained properly [OK]
Common Mistakes:
  • Thinking environment variables can't be used in URLs
  • Believing pm.sendRequest can't be called multiple times
  • Assuming console.log is disallowed in callbacks
5. You want to test a multi-step user signup flow in Postman using workflow sequencing. The steps are:
1. Create user (returns userId)
2. Verify email (needs userId)
3. Set user preferences (needs userId)

Which approach correctly sequences these requests and shares userId between them?
hard
A. Use pm.sendRequest inside the test script of each step to call the next, setting environment variables for userId
B. Run all requests manually in any order and copy userId between them
C. Use separate Postman collections for each step without sharing variables
D. Call all requests simultaneously using pm.sendRequest without waiting for responses

Solution

  1. Step 1: Understand multi-step flow needs ordered execution

    Each step depends on the previous step's userId, so requests must run one after another.
  2. Step 2: Use pm.sendRequest with environment variables to pass data

    Calling the next request inside the previous request's test script and setting userId as an environment variable ensures correct sequencing and data sharing.
  3. Final Answer:

    Use pm.sendRequest inside the test script of each step to call the next, setting environment variables for userId -> Option A
  4. Quick Check:

    Chain requests with pm.sendRequest and env vars for data flow [OK]
Hint: Chain requests with pm.sendRequest and env vars [OK]
Common Mistakes:
  • Running requests manually without automation
  • Not sharing variables between requests
  • Calling requests simultaneously causing race conditions