Postman-Newmann-how to pass env.var for iteration

I am trying to execute my collection in more than one environment and brand.
To execute in single Environment , we use JSON environment file and try to use --env-var {Variable Name}={Variable Value}. in newmann command .It get the value which i specified in the gitlab.

At the same time i have a csv file which has multiple environment and brand ( i have 4 iteration) , when i try to use the same env-var , its not working.
Can you share the syntax how can i pass the environment variable when its an csv file

Hey @anita.christobel :wave:

Welcome to the Postman Community! :postman:

Are the titles in the CSV file, the variable names in your Collection?

Have you tried appending -d <your CSV filename> to the Newman command so that it picks up the values in the file and resolves the variables?

Hi @danny-dainton ,

Thank you for the reply . I am able to use `-d in the newman command.It pick the values also .My requirement is i want to use --env-var {Variable Name}={Variable Value} along with -d to pass the value which i enter in gitlab .Please find the screenshot .I want to use QA and also PROD .Don;t want to maintain two CSV file .Can we achieve the same
image

Are you not able to use both flags in the same command?

newman run collection.json -d <file> --env-var "variable_name=variable_value" 

You can use multiple --env-var flags in the same command, if needed.

I don’t think I fully understand what you’re trying to do here or what the end result would look like for you.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.