Postman Data Driven Testing with CSV file

Dilpreet Johal
3 min readJan 24, 2023

--

Data-driven testing is a powerful technique for automating the testing process with Postman. By using a CSV data file, you can run the same test multiple times on different datasets, saving time and reducing the amount of code needed. In this tutorial, I will show you how to import a CSV file into Postman and use it for data-driven testing.

Requirements:

  • Basic knowledge of Postman and JavaScript
  • A CSV data file as a source for your test

Prepare your CSV data file

The first step is to prepare your CSV data file. Make sure the column names match the variables you will use in your tests. In this case, we have columns for User ID, Title, and Body. Each row should contain data for one test case.

Create a new request and set up your test

To create a new request in Postman, click on the “New” button and select “Request.” In the request, you can set up your test by using variables from the CSV data file. For example, you can use the userid, title, and body variables in the request body to send different data for each test case.

Create a collection

To organize your requests, add the request to a collection in Postman and then click on ‘Run Collection’ button.

Import CSV Data file

To use the data from your CSV file, import it into the Postman collection by clicking on ‘Select File’ button. This will map the data from the CSV file into a table. Make sure the mapping is correct before proceeding.

Run the collection

With the collection set up and the CSV data imported, you can now run the collection by clicking on the ‘Run Collection’ button. This will automatically run each request in the collection, using the corresponding data from the CSV file for each test.

Check out the video below for a detailed explanation

By using a CSV data file in Postman, you can easily perform data-driven testing and automate your testing process. This technique can save you time and effort by allowing you to reuse the same test with different data sets.

👩🏻‍💻 It’s time to advance your career by joining the SDET-U Academy today 👇🏻
Join Academy

📧 Subscribe to my mailing list to get access to more content like this as well as be part of amazing free giveaways.

👍 You can follow my content here as well -

Thanks for reading!

--

--

Dilpreet Johal
Dilpreet Johal

Written by Dilpreet Johal

SDET Architect | YouTuber | Tech Blogger | Love to explore new tools and technologies. Get access to all the courses— https://sdetunicorns.com/

No responses yet