Issue with Newman, it is not reading and updating environment variables on runtime

I am running a script where some environment variables are updated on runtime and and used in other request, it works fine while using with postman GUI, but it fails when running with newman as variables are not updating. I have tried to export he environment, but it did not work for me.

what is the best way to achieve this.

1 Like

@raj007 Can you share the collection in which this is happening?
Feel free to retract any sensitive information.
Replace urlโ€™s with postman-echo.com if need be. :slight_smile:

To share the collection: https://www.getpostman.com/docs/v6/postman/collections/sharing_collections

@raj007 I stumbled upon something similar. And figured out that I save some vars to globals. Moved them to environment and all went smooth

yes, I worked well when moved to environment, Thanks :slight_smile:

Canโ€™t we use the global variables? I cannot move these to environment scope as I have multiple environments to work on.

I came across --options command, now I can use the global and environment variables at the same time like this:

newman run Automation.postman_collection.json --globals โ€œC:\Users\praveen\Documents\workspace.postman_globals.jsonโ€ --environment โ€œC:\Users\praveen\Documents\UAT.postman_environment.jsonโ€ --reporters htmlextra

Hey @navigation-observer2 :wave:

A more extensive list of cli options can be found on the Newman repoโ€™s readme

Great use of the htmlextra reporter there tooโ€ฆ :heart:

1 Like

Thank you @danny-dainton