What if you could test entire user journeys automatically without missing a single step?
Why Workflow sequencing in Postman? - Purpose & Use Cases
Start learning this pattern below
Jump into concepts and practice - no test required
Imagine testing an online shopping app where you must first log in, then add items to the cart, and finally place an order. Doing this manually means running each step one by one, watching carefully, and remembering to do them in the right order.
Manual testing here is slow and tiring. You might forget a step or do them out of order. If the login fails, you waste time trying to add items. It's easy to make mistakes and miss bugs that only show up when steps happen in the right sequence.
Workflow sequencing lets you automate these steps in the exact order needed. You set up a chain of requests in Postman that run one after another automatically. This saves time, avoids human errors, and ensures the app behaves correctly through the whole process.
1. Send login request 2. Manually check response 3. Send add to cart request 4. Manually check response 5. Send place order request
pm.sendRequest(loginRequest, () => {
pm.sendRequest(addToCartRequest, () => {
pm.sendRequest(placeOrderRequest, () => {
console.log('Workflow complete');
});
});
});Workflow sequencing makes it possible to test complex user journeys automatically and reliably, catching issues that only appear when steps happen in the right order.
Testing a banking app where you must first authenticate, then transfer money, and finally check the transaction history--all automated in sequence to ensure the whole flow works smoothly.
Manual step-by-step testing is slow and error-prone.
Workflow sequencing automates ordered steps to save time and reduce mistakes.
This approach ensures reliable testing of real user journeys.
Practice
Solution
Step 1: Understand workflow sequencing
Workflow sequencing means running requests one after another in a set order.Step 2: Identify the purpose in Postman
It allows passing data from one request to the next, making multi-step testing reliable.Final Answer:
To run multiple requests in a specific order and share data between them -> Option DQuick Check:
Workflow sequencing = ordered requests with data sharing [OK]
- Confusing workflow sequencing with documentation generation
- Thinking it creates charts or encrypts requests
- Believing requests run randomly without order
Solution
Step 1: Recall Postman scripting commands
Postman provides a method to send HTTP requests programmatically inside scripts.Step 2: Identify the correct method for calling requests
The correct method ispm.sendRequest(), which sends a request and handles its response.Final Answer:
pm.sendRequest() -> Option BQuick Check:
Call requests inside scripts = pm.sendRequest() [OK]
- Using non-existent methods like pm.callRequest()
- Confusing with pm.executeRequest() or pm.runRequest() which don't exist
- Misspelling the method name
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?Solution
Step 1: Understand pm.sendRequest callback
The callback receives the response objectres, which can be parsed as JSON.Step 2: Extract and set environment variable
The script setstokentores.json().access_token, which is the access token string from the response.Final Answer:
The access_token value from the JSON response of the called request -> Option AQuick Check:
pm.sendRequest sets env var = access_token value [OK]
- Assuming pm.sendRequest cannot set variables
- Thinking the whole JSON is stored instead of just access_token
- Confusing asynchronous callback behavior
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?Solution
Step 1: Analyze asynchronous behavior of pm.sendRequest
pm.sendRequest runs asynchronously, so the second call may start before the first finishes.Step 2: Understand timing of environment variable setting
The variabledataIdis set only after the first request completes, so the second request may see it as empty if it runs too soon.Final Answer:
Because pm.sendRequest is asynchronous, the second request runs before dataId is set -> Option CQuick Check:
Async calls need chaining to ensure order [OK]
- 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
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?Solution
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.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.Final Answer:
Use pm.sendRequest inside the test script of each step to call the next, setting environment variables for userId -> Option AQuick Check:
Chain requests with pm.sendRequest and env vars for data flow [OK]
- Running requests manually without automation
- Not sharing variables between requests
- Calling requests simultaneously causing race conditions
