I have serviceA, serviceB, serviceC..., up to service L.

I have a collection with requests for all those services.

Is it possible to set somehow flags for postman runner for requests to be run on different environments?

What I would like to do is to run requestes for all services on DEV environment, but on TEST don't run requests for serviceL and for QA/UAT don't run requests for serviceK and serviceL.

1 Answer 1


Newman has an option to select the environment you want to use, the flag -e

Then, you can run newman run mycollection.json -e serviceAEnv to run the suite with the environment for service A.

Then you can create a script to run many of these commands:

declare -a arr=("serviceAEnv" "serviceBEnv" "serviceCEnv")

for i in "${arr[@]}"
   eval "newman run mycollection.json -e $i"

OBS: It's also very easy to run commands in Python, Javascript, or Java.

OBS 2: See all Newman's options here or by running newman run -h

OBS 3: To to this using Postman Runner, you would need to write a lot of control flow code, using the nextRequest function. It will surely be messy, because it's complicated and you would be mixing the request code with how to execute the request, breaking the Single Responsibility Principle. I would not suggest it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.