Iterate through a collection but execute a particular request once

My question:
When Iterating through a collection, is it possible to execute a request once, even though the iterations amount is more than 1?

Example:

Iterations = 5

Collection:
Test ABC - execute request ONCE
Test DEF - Iterate x 5
Test GHI - Iterate x 5

Do you mean โ€œrequestโ€ rather than tests.

The tests are the code in the tests tab. (You can have requests without any tests).

As far as stopping a particular request from running, I donโ€™t think that is possible.

One workaround would be to have a pre-request script on the โ€œTest DEFโ€ request that reads the iteration counter and if its 1, sends a request using the Postman sendRequest() functionality.

let iterationCounter = pm.info.iteration:Number // The value of the current iteration:

It just means that request is written in code in the pre-request script. (It can still have tests attached).

Postman JavaScript reference | Sending requests from scripts

1 Like