Postman Tutorial Part 45 – Data Driven Testing in Postman Using JSON File
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:-
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:-
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.
1 thought on “Postman Tutorial Part 45 – Data Driven Testing in Postman Using JSON File”
Thanks was easily able to follow the tutorial and the steps