question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HOw to update the environment variable or global variable with collection results when fired with newman command line

See original GitHub issue
  1. Newman Version (can be found via newman -v):
  2. OS details (type, version, and architecture):
  3. Are you using Newman as a library, or via the CLI?
  4. Did you encounter this recently, or has this bug always been there:
  5. Expected behaviour:
  6. Command / script used to run Newman:
  7. Sample collection, and auxilliary files (minus the sensitive details):
  8. Screenshots (if applicable):

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
kunagpalcommented, Dec 21, 2016

@Sripathi1983 There are two parts to handling this:

  1. Ensure that environment values are updated to their desired values using postman.setEnvironmentVariable("var_name", "var_value");, or postman.setGlobalVariable in your collection request test scripts, where applicable.

  2. To update the environment / globals file, you can use --export-environment / --export-globals, like so:

newman run coll.json -e env.json -g globals.json --export-environment env.json --export-globals globals.json
3reactions
kunagpalcommented, Feb 21, 2018

@tegomass You’ll have to use the export options, like so:

newman.run({
    collection: '/path/to/collection.json',
    exportEnvironment: '/path/to/new/file.json',
    exportGlobals: '/path/to/some/other/file.json'
}, function (err, summary) {
   // change the world here...
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Newman command options | Postman Learning Center
Newman : run and test your collections from the command line. Next Steps. Intro to the Postman API. Postman Newsletter
Read more >
How To Use Command Line Integration With Newman In ...
This Tutorial will Explain How to Integrate or Execute Postman Collections Through the Command-line Integration Tool Newman.
Read more >
Using workflows to deploy an API to multiple environments
From the Project Settings side-menu, click Environment Variables, then clickAdd Environment Variable. Add Environment variable - CircleCI. Add ...
Read more >
API Testing Using Postman: Ultimate Course(With Newman ...
Postman Environment Variables API Testing using Postman (Part 4). 16:02 ... Newman Postman How to Run Postman Command Line. 13:10 ...
Read more >
Testing REST APIs using Postman and Newman
which is a command-line Collection Runner for Postman. ... Here we are referring to the environment variable value using {{variable_name}} ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found