Changing iteration count on pre-request script

Is there anyway to change the iteration count in pre-request script of collection folder? While running the collection everytime, should i choose the iteration count manually?

Hello @davarci, welcome to the community! :wave:

You won’t be able to modify the iteration count using the pre-request/test script but what is your use-case?

I can help you with an api inside Postman which is postman.setNextRequest

Going through the doc will help you understand how you can use it.

You can make decisions in the script whether you want to jump to a request and re-do a flow or you can choose to end by passing null to postman.setNextRequest as an argument.

Hope this helps you out!

Let me know if you need further assistance around this, please cite your use-case too along with it.

My use case is like following
I have a collection with Authentication API , where i have to test all combinations. for each combination i have created one request ;
request1 - valid credentials
request 2 - invalid credentials

Now I have created CSV with 2 rows - 1 st row has valid credentials and 2nd row invalid credentials.

My test has to 1st row with request1 and second row with request2 in the collection. then it should stop the test

Can you please help