If you haven't created your first collection, check here.
You can pass data via two ways.
Using csv file
Using text file
Let's see how to do that,
Step 1:
First you should create your test data file either in csv format or text file format.
CSV files should be written in a format that first row should have column names next rows will have the data. Numbers and Boolean values are written with (') single quote in front to keep its format.
Text files should be written in JSON format and saved as json file.
Step 2:
Under Body section in your request tab, declare the variables in json format you want to get data from external source.
All variable names should be mentioned within {{ }} double curly braces. String variables should be mentioned within double quotes "{{variable_Name}}".
Step 3:
Go to collection runner, click Run, Select the data file you have your data and click preview to check that correct data file is imported.
Click Run to see that postman picked your data file and executed collections.
You can see there are two iterations executed as we have passed two data sets in our data.json file.
You can check the data passed in console.
Thus we have passed data for our requests from external source successfully.
Happy Testing!!!
Comments