Search code examples
csvpostmannewman

Need to run collection multiple iterations and need to run csv file which I have declared data for json body


I have exported collection of postman. One request has declare a variable inside the json body . I have csv file with data for that variable. Now I want to run collection with multiple iterations with csv file (data) in Newman command line

Tried this for run multiple times

newman run collection_exported.json -n 3

It runs multiple iterations (For this I did not include that variable)

Json body has below variable

"value":"{{medinfovalues}}"

and csv file has below values

enter image description here


Solution

  • You would need to use the -d <source> or --iteration-data <source> cli flag to tell Newman the location of the data file.

    For example:

    newman run collection_exported.json -d "filepath/myDataFile.csv" -n 3

    More information about all the different cli flags can be found here:

    https://github.com/postmanlabs/newman#newman-run-collection-file-source-options