Hello. I have a test that sends a request who has values set in a csv file. The application I’m testing will then perform a calculation and return a response containing several parameters in JSON. I have a second csv file that contains expected responses. How would I validate the response bodies of each iteration of the test against the expected results in the second csv?
For example: lets say the application multiplies the parameter “AMOUNT” from CSV 1 by 2 and returns the result. “EXTRA” has been added to take the place of other variables that are present, but not important for this specific test.
CSV 1
|TEST ID|EXTRA|AMOUNT|
|ID1|0|1|
|ID2|0|2|
|ID3|0|3|
CSV 2
|TEST ID|EXTRA|AMOUNT|
|ID1|0|2|
|ID2|0|4|
|ID3|0|6|
So far I understand that to send the CSV 1 file on run I would select the file as a “Test data file”, and that by using {{AMOUNT}}
in my request, I can have the test iterate through the rows for each run. Each of these runs correctly returns the responses I’m looking for.
I believe the script would look something like:
pm.expect(jsonData."location in response").to.include("value from CSV2")
How would I tell postman to check this second csv file and to understand to iterate through the rows for each test?