Postman Tutorial Part 45 – Data Driven Testing in Postman Using JSON File

Hello Folks,

We have already seen How to read data from a json file in Postman.

In previous post, we have learnt Achieving Data driven testing using CSV in Postman. I will strongly recommended to go through above two links to understand about Data driven testing of API.

Instead of CSV , we will use JSON to achieve Data Driven testing in Postman.

Creating a JSON file for Postman:-

We need to create a JSON file in specific format so that Postman can read it. It must be a JSON Array of JSON Objects and each JSON Object will be treated as a new data set for execution of an API. If JSON Array consists of five JSON Objects, API will be executed five times with provided set of data one after another in sequence. An example is below:-

MultipleDataForHotelBooking.json :-

Note:- A JSON Array may contains single JSON Object as well as we did in
How to read data from a json file in Postman.

If you compare with csv of post Achieving Data driven testing using CSV in Postman , you can relate that each row of csv (except first row ) as an individual JSON Object.

Now there are similar steps as in Achieving Data driven testing using CSV in Postman . You just need to run API using collection runner and select the JSON file in Data section.

Run the collection, you will see three iteration have run with different data.

Data for iteration 1:-

Data for iteration 2:-

Data for iteration 3:-

You can import example collection from here:-

https://www.getpostman.com/collections/e7d3735a7de9ea07870e

#ThanksForReading

You can find all Selenium related post here.
You can find all API manual and automation related posts here.
You can find frequently asked Java Programs here.

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.
%d bloggers like this: