Importing data files

You can use data files to pass Postman sets of values to use in a collection run. By selecting a JSON or CSV data file in the Collection Runner, you can test your requests with multiple different values as part of a single run.

Running collections with data files

When you initiate a collection run you will see an option to select a data file. Click Runner at the top left of Postman. Select your collection, and click Select File next to Data.

Setup Collection Run

Select your data file. You will see an option to Preview the data in the file before starting the run.

Data File Preview

Click Run using data files to begin the run with the values from the file.

  • You can try out the steps in this page by first importing the sample collection—download and import it into Postman using the Import button at the top left. Import Collection
  • In the Collection Runner, choose the collection you imported. Download the sample data file and select it in the Runner also.
  • Note that the sample collection contains a POST request which uses a path variable in the URL. This path variable is specified in each record in the data file. The request also uses a value variable in the body which is also pulled from the data file for each iteration. The example request is to the Postman Echo API, a learning resource that returns the data you send it.

The Collection Runner will run the collection requests for each iteration in the data file. The output you see will indicate the results for any tests you have defined in your collection requests.

Tests

Click a request in the Collection Runner Run Results to see more detail on its data.

Collection Run Results

Any data you have defined in the requests will be used when the collection runs, and your request data can reference values defined in the data file.

Data File Value

Accessing data file values

You can reference values defined in the data file throughout your requests, however to access them in scripts, you need to use a different technique. To use values from the data file in your Tests or Pre-request Script code, use the iterationData, which provides access to the current data file record being used to run the request.

//get the 'value' field from the data file for this request run
pm.iterationData.get("value")

See the Sandbox Reference for more on what you can do with iteration data.

Next steps

To continue learning to leverage collection runs, check out the following resources: