Environment Variable Not updating when running on Newman

  • Requests are working well in postman and when I tried to export my collection via a file/link and run it in Newman, Predefined environment variable not updating.

  • I’m passing two other parameters after the environment variable but those parameters also not including in the shared link which i used to run in newman.

  • I’ve already tried to place Environment variable in different environments and also changed variable name several times but still getting this error.

Can you post the Newman command line that you are using? To check you are including the environment file in the request?

Can you include a copy of your environment JSON file?

Something like.

newman run postman_collection.json -e postman_environment.json --reporters cli,junit --reporter-junit-export Results\junitReport.xml 

Thank you for your response,

Right now i only use this commands,

newman run postman_collection.json(link)

my previous collection is running without any error with same steps.

@rukshansnookie

Where are your variables set? In particular where is the UUID set?

At the environment level, collection or other?

As you can see here, i passed them to Environment level, “NicGlob” variable working well with requests. “UUID” still not updating when run in newman

@rukshansnookie

If you have them at the environment level, then surely you have to include that environment file in the Newman command line, otherwise it will fail. They are saved in a separate file to the collection and you have to reference both files in your command line. The collection and the environment. (Both are json files).

Similar to the following…

newman run postman_collection.json -e postman_environment.json --reporters cli,junit --reporter-junit-export Results\junitReport.xml 

I can’t answer why NicGlob is working ok. Perhaps it has an initial value set in your code somewhere. Difficult to say without seeing the whole collection.

1 Like

i’ve tried many ways but still getting the same error and finally i decided to remove that environment variable and pass its values through parameters.
btw i really appreciate your support and thank you .

This error is still occurring when passing in an environment json file along with a collection to run using the Newman cli. It does not matter if I pass the host in before or after the collection argument. This is running on the latest ubuntu with the latest versions available. It seems everyone else running into this error is simply hard coding the variables to fix.

@aviation-operator-22

Can you post your Newman command line, a sanitized screenshot of your environment, and a copy of your request where it uses the variables?

Environments work fine with Newman.

I can’t see that it running on Ubuntu would be an issue.
I have a couple of Linux boxes, and can try this out a bit later.