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