1
votes

So i'm using postman, I have an URL that I can send POST request to, with a single json in the body where the key is "coupon" and the value is some number.

I want to run a test from postman that will place different numbers to the value of the coupon, and see all the responses that I will get.

I tried to read about the runner in postman, I figured that I can build a data file with all of the numbers for the coupon.

How can I replace the value in the post request with those numbers from the file data?

I'm trying to put a different number to this value, send it and get a response for each number.

Here

Thank you!

1
send it as raw data - Vikram Saini
But how I place it into the "value" of the json? - user8446864

1 Answers

2
votes

In the collection runner, load a CSV file that looks like:

value
123456
234567
345678

... and so on, one line for each coupon number. Then you replace the number in the key-value parameter editor with {{value}}. In the pre-request or test script, you could access it with data.value. See also the Postman documentation on working with data files.