What is the primary reason to add a delay between requests in a Postman collection run?
Think about how APIs handle many requests in a short time.
Adding delay helps mimic real user traffic and prevents exceeding API rate limits, which can cause errors.
What will be the output behavior when running this Postman pre-request script?
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; });
Consider how async/await works in Postman scripts.
The async function with await delay pauses execution for 2 seconds before the test runs, so the request is delayed and test passes.
Which assertion correctly verifies that a delay of at least 3 seconds occurred before the request was sent?
const startTime = pm.environment.get('startTime');
const endTime = Date.now();
const elapsed = endTime - startTime;Think about how to check if elapsed time is greater than or equal to 3000 milliseconds.
The assertion uses 'gte' (greater than or equal) to confirm the delay was at least 3 seconds.
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;
});Consider how JavaScript handles setTimeout in synchronous code.
setTimeout schedules a callback but does not pause code execution, so the test runs immediately without delay.
Which method correctly implements a 2-second delay between requests when running a Postman collection?
Think about how to pause execution in Postman scripts.
Using async/await with a Promise and setTimeout pauses the pre-request script, effectively delaying the request.