Possible to modify postman variables in newman-nodejs script

Hi Everyone,

I create a few variables in Postman and reference them in the test collection and everything works fine.

Now, I need to run those collections in nodejs and newman and not quite sure how to use Postman environmental variables or overwrite the value of those variables in my script?

thanks,

Jdang

1 Like

I think I found the answer.

Thanks,

Jdang

use the “-e” switch in your command line arguments followed by the path to the envionemnt definition. If there are “spaces” in the path or file name enclose the path file name in “quotes”

E.g. -e “C:\Users\username\Documents\Postman Pro\2- Environment Definitions\APITest Environment Definition.postman_environment.json”

The entire command line string might look like this:
newman run “C:\Users\username\Documents\Postman Pro\1- Combined Collections\13-MO_Internal _API_Objects.postman_collection.json” -e “C:\Users\username\Documents\Postman Pro\2- Environment Definitions\APITest Environment Definition.postman_environment.json”