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