0
0
Postmantesting~20 mins

Delay between requests in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Delay Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Delay Between Requests in Postman

What is the primary reason to add a delay between requests in a Postman collection run?

ATo simulate real user behavior and avoid hitting API rate limits
BTo speed up the test execution by sending requests faster
CTo automatically retry failed requests without manual intervention
DTo reduce the size of the response payloads
Attempts:
2 left
💡 Hint

Think about how APIs handle many requests in a short time.

Predict Output
intermediate
2:00remaining
Postman Script Delay Output

What will be the output behavior when running this Postman pre-request script?

Postman
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));

pm.test('Delay 2 seconds before request', async function () {
  await delay(2000);
  pm.expect(true).to.be.true;
});
AThe request will wait 2 seconds before sending, then pass the test
BThe request will send immediately, test will fail due to async error
CThe request will wait 2 seconds but test will timeout and fail
DThe script will cause a syntax error and stop the request
Attempts:
2 left
💡 Hint

Consider how async/await works in Postman scripts.

assertion
advanced
2:00remaining
Assertion on Delay Duration in Postman Tests

Which assertion correctly verifies that a delay of at least 3 seconds occurred before the request was sent?

Postman
const startTime = pm.environment.get('startTime');
const endTime = Date.now();
const elapsed = endTime - startTime;
Apm.test('Delay at least 3 seconds', () => pm.expect(elapsed).to.equal(3000));
Bpm.test('Delay at least 3 seconds', () => pm.expect(elapsed).to.be.lte(3000));
Cpm.test('Delay at least 3 seconds', () => pm.expect(elapsed).to.be.gte(3000));
Dpm.test('Delay at least 3 seconds', () => pm.expect(elapsed).to.be.below(3000));
Attempts:
2 left
💡 Hint

Think about how to check if elapsed time is greater than or equal to 3000 milliseconds.

🔧 Debug
advanced
2:00remaining
Debugging Delay Implementation in Postman Collection Runner

Given this Postman collection runner setup, why does the delay between requests not work as expected?

pm.test('Wait 1 second', () => {
  setTimeout(() => {}, 1000);
  pm.expect(true).to.be.true;
});
AThe delay value 1000 is too small to be noticed by Postman
BsetTimeout is asynchronous and does not block execution, so delay is ignored
Cpm.expect is called inside setTimeout, causing the test to fail
DsetTimeout requires a callback function with parameters to delay properly
Attempts:
2 left
💡 Hint

Consider how JavaScript handles setTimeout in synchronous code.

framework
expert
2:30remaining
Implementing Delay Between Requests in Postman Collection Runner

Which method correctly implements a 2-second delay between requests when running a Postman collection?

AAdd a <code>postman.setNextRequest(null)</code> and manually rerun requests with delay externally
BAdd a <code>delay</code> property in the request body to instruct the server to wait
CUse the <code>setTimeout</code> function inside the pre-request script without async/await
DUse an async pre-request script with <code>await new Promise(resolve =&gt; setTimeout(resolve, 2000))</code>
Attempts:
2 left
💡 Hint

Think about how to pause execution in Postman scripts.