Hi,
i test the newman feature and love it. but I have one question I can’t figure out:
Here’s an example of the CSV file for the above set of variables:
url, user_id, id, token_id
http://127.0.0.1:5000, 1, 1, 123123123
http://postman-echo.com, 2, 2, 899899
how to I reference to these columns?
I know how to reference to environment variable by using {{}}
Thank you!
You would just do the same thing for those columns headings, in the Collection.
For example:
If you use them in the URL, Params or Headers, it’s {{url}}
or {{user_id}}
.
If you use them in the scripts, it’s pm.iterationData.get('url')
Thank you for your reply. still not working:
The data.csv file has two lines, and when I ran following command line, it iterate twice, which is good
newman run postman_collection.json --folder Inventory -e postman_environment.json --reporters cli,json --reporter-json-export outputfile.json -d data.csv
csv file contains 2 lines (don’t count the header):
ID
111
222
in the web service request I tried both {{ID}}, and pm.iterationData.get(‘ID’), both give me a 500 error.
if I hardcode 111 in the web service request, server return result as expected.
111
What does that like look in the UI? Showing an image of where you put those variables is a lot easier that trying to describe it
Does this work with the Collection Runner, if it does, then it will work with Newman.
Please see the picture Thank you!
This is talking about a single request and using an environment variable.
Can you Run this collection, in the Runner and use the same CSV data file to resolve the ID value?