How to set a delay in Postam Runner using a csv file as input

I’m using postman to test an API which is as follows: (this is a POST)

{
"contact_name": "{{contact_name}}",
"contact_email": "{{contact_email}}",
"answers": [
    {
        "question_id": 1,
        "value": "{{value_1}}"
    },
    {
        "question_id": 2,
        "value": "{{value_2}}"
    }
   ],
  "disable_email": true
}

I have an environment with the corresponding variables:

contact_name,contact_email,value_1,value_2

And I’m using the Runner to load a csv file that contains 100,000 rows.
In fact, it runs good, but I need to put a delay every 10,000 rows for example. Is there a way to perform this? I know that there is a way to set a delay in each iteration, but I’d like to know if there is a way to set a delay (30 secs) after 10,000 iterations.

Thanks!

1 thought on “How to set a delay in Postam Runner using a csv file as input”

  1. Add this to pre-request script

    if((pm.info.iteration+1)===10000){
    setTimeout(()=>{},3000)
    }
    

    This will wait for 3 second before sending the rquest for iteration 10000 , the count starts from ‘0’ thats why adding 1 to that.

    Reply

Leave a Comment