# Newman - Running Tests

**URL:** <https://community.postman.com/t/newman-running-tests/16282>\
**Category:** Help Hub\
**Tags:** newman-project, tests, variables, collections\
**Created:** [September 28, 2020, 6:58am UTC](https://community.postman.com/t/newman-running-tests/16282 "2020-09-28T06:58:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamalshree2784](https://avatars.discourse-cdn.com/v4/letter/k/f07891/32.png) [@kamalshree2784](https://community.postman.com/u/kamalshree2784)\
**Post date:** [September 28, 2020, 6:58am UTC](https://community.postman.com/t/newman-running-tests/16282/1 "2020-09-28T06:58:35Z")

</div>

What would be the ideal situation in Newman to run a test which resulted in a variable and later use that variable in other tests. I know it is not hard with collections or environment variables in Postman, but is there any better way to communicate?

Please note: For some reason you’re forbidden from using the Postman API.

---

<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:** [September 28, 2020, 11:34am UTC](https://community.postman.com/t/newman-running-tests/16282/2 "2020-09-28T11:34:32Z")

</div>

What kind of options are you looking for? The best practice is typically to use variables for requesting chaining.

---

<div class="post-metadata">

**Author:** ![kamalshree2784](https://avatars.discourse-cdn.com/v4/letter/k/f07891/32.png) [@kamalshree2784](https://community.postman.com/u/kamalshree2784)\
**Post date:** [September 29, 2020, 8:52am UTC](https://community.postman.com/t/newman-running-tests/16282/3 "2020-09-29T08:52:41Z")

</div>

Thanks Allen, I will try Chaining, just checking how about setting the respective value as a global variable (for example) and export the global to a file. Later import the global into the next collection run. What do you think about this approach?

---

<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:** [September 29, 2020, 11:28am UTC](https://community.postman.com/t/newman-running-tests/16282/4 "2020-09-29T11:28:45Z")

</div>

Oh ok, I didn’t understand that’s what you were trying to do.

If you are giving is a local file, you can use the flag `--export-globals` to overwrite it with the values after the collection run.

So your command would be

```auto
newman run myCollection.json --globals globals.json --export-globals globals.json

```

[Here is the documentation](https://www.npmjs.com/package/newman#newman-options) for newman command line arguments
