1

I need to run the test case by reading data from an external CSV data file(By uploading the data file from collection runner). I'm able to read the values of an external CSV file in 'pre-request script' as well as in 'tests'. But facing difficulty to read the file in POST API request body. How to read and replace the input in API request body?

I tried below things to read in the request body.

External CSV file to be read enter image description here

To access values of 'Summer' column I used

  1. data.columnName i.e data.Season

  2. pm.iterationData.get(columnName) i.e pm.iterationData.get("Season")

Both of them could not fetch the value. Whereas if I run the same code in 'pre-request script' Or in 'tests', the statements were successfully fetching the values. Please help me to access the content of datafile in the request body.

viz
  • 51
  • 8

1 Answers1

0

In the request body, simply use {{Season}} and {{ClothMeterial}}.

Christian Baumann
  • 3,188
  • 3
  • 20
  • 37