pm.sendRequest works using call back , meaning the request is send in order but will be resolved in future. As you don’t have any dependency for keeping the order , meaning you don’t have to wait for the response to do the next step your code should work.
if you still want to make it print as per loop use something like:
(async()=>{
for (let i = 10; i >= 0; --i) {
// Example with a plain string URL
console.info("before : " + i)
pm.sendRequest('https://postman-echo.com/get', (error, response) => {
if (error) {
console.log(error);
} else {
console.log(response);
}
});
await sleep(500)
console.info("after: " + i)
}
})()
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
setTimeout(()=>{},15000)
Add you full code inside the async function and add await sleep after each pm.sendRequest.
This approach will just slow down your test execution