Thursday, 13 June 2024

Run API Test with CSV file

 Using CSV files with Postman’s Collection Runner allows you to run a collection of requests with different sets of data. Here are the detailed instructions to use a CSV file and Postman to run the Collection Runner:

Step-by-Step Guide

1. Prepare the CSV File

Create a CSV file with the data you want to use in your requests. The first row should contain the variable names, and subsequent rows should contain the values. Here’s an example:



2. Set Up Postman Collection

  1. Open Postman and create a new collection or use an existing one.
  2. Add Requests to your collection that will use the data from the CSV file.

3. Add Variables in Requests

In your requests, use the variable names from the CSV file inside double curly braces. For example:

  • URL: https://api.example.com/users
  • Body (if it’s a POST request)


4. Run Collection with Collection Runner

  1. Open Postman and click on the Runner button at the top left (it looks like a stopwatch).

  2. Select the Collection you want to run from the left sidebar.

  3. Select the Environment (if any) you want to use.

  4. Select the Data File:

    • Click on the Choose Files button under Data.
    • Select your CSV file.
  5. Set the Iterations to the number of rows in your CSV file, minus the header row.

  6. Click the Start Run button.




No comments:

Post a Comment

map online shopping status with REST API

  Example Sequence of API Calls Browse products : GET /products View product details : GET /products/12345 Add product to cart : POST /cart ...