Loop over folder in postman

I have several requests in a folder. I want to loop over the FOLDER. (Not one request at a time.)

folder {request1, request2, request3}

Basically I want to be able to hit request1, request2, request3 on the first loop, start next loop and hit request1, request2, request3 again in that order.

(I have two or more different users I need to run the same scenarios on.)

I know there is a way to do this by using setNextRequest() on the very last request in the collection (and doing setup on the very first request) but is there a cleaner way to do this with the logic in one place?

setNextRequest() should work like you described where you chain the requests in a folder and loop back at the last request.
The tricky thing is making it stop which would mean you need some kind of conditional check at the end that, when passed, you setNextRequest(null) to terminate the loop.

Hope this helps! :smile:

1 Like