Data Driven Testing in Postman

Hirudini Udugama
2 min readMar 9, 2022
  1. How to get data from csv file

First I will create a POST request under collection3 as Register user

URL: https://reqres.in/api/register/preprod

Request body:

{

“email”: “eve.holt@reqres.in”,

“password”: “pistol”

}

Now let’s use variables at the global level and refer to them.

Now let’s create a new .csv file as follows and I’ll save it as Data1.csv

Then in postman I’ll run Collection3 through the collection runner. In the collection runner window I’ll select the Data1.csv file as follows.

Here if we want to preview a file, we can just click on the preview button and you will be able to see data which were contained in the csv file.

Once you click on the run collection3 button our collection will be run.

Here we can see data on request URL, request headers, request body, response headers and response body. Also you can notice that this has been run 2 times since we added 2 records.

2. How to get data from JSON file

Same as the above when we run the collection we can add a json file. I’ll add the Data2.json file.

Once you run this you will be able to achieve the same result as above.

--

--