Is there a way to access the iteration number in Postman REST Client?

I don't know if there is an internal way to get the iteration number but I believe you should be able to track this number through code yourself. Here's a quick code snippet:

var value = environment.count;
value++;
postman.setEnvironmentVariable("count", value);

If you put this in the pre-request editor or the test editor of a collection that you are sure will run once per iteration it will effectively track the iteration count.


According to Postman API Reference, pm.info.iteration - is the value of the current iteration being run.

Example:

console.log(pm.info.iteration);

It is possible now! You can access the iteration variable, in the same way you access other variables like responseBody.

Tags:

Postman