# Newman Run only specific iteration

**URL:** <https://community.postman.com/t/newman-run-only-specific-iteration/20980>\
**Category:** Help Hub\
**Tags:** newman-project\
**Created:** [March 3, 2021, 6:45pm UTC](https://community.postman.com/t/newman-run-only-specific-iteration/20980 "2021-03-03T18:45:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ritman-us](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@Ritman-us](https://community.postman.com/u/Ritman-us)\
**Post date:** [March 3, 2021, 6:45pm UTC](https://community.postman.com/t/newman-run-only-specific-iteration/20980/1 "2021-03-03T18:45:01Z")

</div>

> **Archived topic — this may be out of date.**  
> Newman has been replaced by the **[Postman CLI](https://learning.postman.com/docs/postman-cli/postman-cli-overview/)**, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.  
> Working with an AI coding agent? The [Postman plugin](https://github.com/postmanlabs/postman-plugin) lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.  
> For current help, see the [Postman docs](https://learning.postman.com/docs/), try the free [Postman tools](https://www.postman.com/tools) (no account needed), or join us on [Discord](https://discord.gg/58aNNsRBGR).

I have a number of iterations ( say 10 ) … is it possible to run only iteration number 5 if need be?  
if there is no direct way is there a workaround ?

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [March 4, 2021, 12:43pm UTC](https://community.postman.com/t/newman-run-only-specific-iteration/20980/2 "2021-03-04T12:43:54Z")

</div>

You can set an environment variable for your `maxIterationCount`.

You could add a no-op request at the beginning of your collection (like hitting the postman delay endpoint) and in the tests section add the following code:

```auto
if(pm.info.iteration >= pm.environment.get('maxIterationCount'){
  postman.setNextRequest(null);
}

```

pm.info.iteration is a 0 based counter of how many times the collection has been iterated.

When you’re running newman, all you’d have to do is set an environment variable override to the max number of iterations:

```auto
newman run (standard arguments) --env-var "maxIterationCount=5"
```
