top of page

Data Chaining and Data Driven Testing in API Testing using Postman

Testing APIs using Postman is a popular choice due to its user-friendly interface and powerful features. Performing CRUD (Create, Read, Update, Delete) operations in API testing using Postman involves testing the basic functionalities of an API that interacts with data, such as adding new records, retrieving existing records, updating records, and deleting records.


Data Chaining

Data Chaining in API testing using Postman involves passing data from one request to another within a collection. This is particularly useful when the output of one request needs to be used as input for another request. Here's how you can perform Data Chaining testing in Postman:


Here, I am using the "Google Map API" for the data chaining process. I have already performed a Basic CRUD Operation, so I have set the Base URL as "Mapurl" and the key as "Kvalue" in the collection variable.

1.Capture Data from Response:

  • After sending a request,  We can capture data from the response (such as IDs, tokens, or any other dynamic values) using Postman's built-in functionalities like test scripts .

  • For example, We can use

pm.environment.set("variable_name", value) to set environment variables or

pm.globals.set("variable_name", value) to set global variables and

pm.collectionvariable.set("variable name",value) to set collection variable.

Here  we are set a collection variable and set it in a Tests tab.

2.Use Captured Data in Subsequent Requests:

  • Once we have captured the data, we can use it in subsequent requests by referencing the environment , global, collection variables.

  • In the request where we want to use the captured data, we can access it using {{variable_name}} syntax in the URL, headers, body, etc. Example: In This Pic {{KValue}} ,{{Place_id}}

3.Ensure Sequential Execution:

• It's crucial to ensure that requests are executed in the correct order. Postman executes requests in the order they are arranged in the collection by default, but we can also use the Collection Runner to specify the execution order explicitly.

• If a request depends on the response of another request, we can use Postman's "Tests" tab to define scripts that verify the response and set variables accordingly. Sub sequentially we are using place id variable in put request to update the address details.

4.Testing and Validation:

• Verify that the data passed between requests is accurate and consistent.

• Write test scripts to validate the response data and ensure that it meets the expected criteria.

• Use assertions to verify that the data passed from one request to another is correct.

5. Data Chaining

  • Once you have ensured that the collection variable and test script are ready, you can start running the collection.

  • I have created a folder named Positive TC within the collection. Next to the folder, click the three-dot icon button, then select "Run folder".

  • Upon clicking "Run folder", the Run Configuration will open. From there, you can select or deselect the requests you want to run.

  • Finally, click "Run GooglemapAPI". The collection will then run, and the results will be displayed.

6. Console and Logging Features to Debug Scripts

• Utilize Postman's console and logging features to debug scripts and ensure that data chaining is working as expected.

• Monitor variables and responses during test execution to identify any issues with data capture or chaining.

By following these steps, we can effectively perform Data Chaining testing in API testing using Postman, ensuring that data is passed between requests accurately and efficiently.

Data Driven Testing

Data-driven testing in Postman allows you to execute the same API request with multiple sets of data, enabling you to test different scenarios efficiently. Now we are going to perform data driven testing using CSV file.

First we need to setup the request with the variables for example, use {{variable_name}} in the request body during execution. Here we prepare the data under the variable_name in CSV file.

Now go to the Collection Folder Run tab then click on Select File and choose your data file.

Review Results:

• After execution, review the results of each iteration to ensure that the requests were sent correctly and that the responses meet the expected criteria.

• Postman provides detailed logs and reports to help you analyze the test results.

By following these steps, we can effectively perform data-driven testing in Postman, enabling us to test APIs with various input data sets and scenarios efficiently.

Happy Testing!!!

84 views0 comments

Recent Posts

See All


Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page