How to send the same request several times

Hi I am new in postman and I need a little help. I need to run the same request with same parameters 4 times, 3 of them should be with success and in 4th time I should receive a backend message and the final result is to check this message. But it is a bit complicated because every time before sending this request I should send another one. Is it possible?

1 Like

Hi @ghazaryan.nelli!

Yes, you can accomplish this by looping using postman.setNextRequest('request_name'); .

You’ll need to make the loop conditional on the number of times you’ve looped already. I’d recommend doing something like this in a test script:

if(!pm.variables.has('counter')) {

var counter = pm.variables.get('counter');
pm.variables.set('counter', counter);

if (counter < 5) {
} else {
1 Like

Hey John-paul. Thank you so much. I’ll set this up.