Use a dataset with a collection run

View as Markdown

Datasets are available on Postman Solo, Team, and Enterprise plans. For more information, see the pricing page.

When you run a collection, you can use a dataset as iteration data. Each row returned by the selected view becomes one iteration, so the same requests run with different inputs. Unlike a data file, a dataset is reusable and queryable, and it isn’t subject to file size limits.

You can also use a dataset with a performance test or a monitor.

Run a collection with a dataset

Select a dataset and view to use as iteration data. The view controls which rows and columns are available during the run.

To run a collection with a dataset, do the following:

  1. Click Items icon Items in the sidebar, then click Collections and select the collection you want to run.

  2. Reference the dataset fields in your requests. See Use iteration data in requests and Use iteration data in scripts.

  3. Select the collection again and click Run icon Run in the upper right.

  4. Select Functional, then select Local.

  5. Click the Iteration data dropdown list and select the Datasets tab.

  6. Select the dataset you want to use, then select a view with the data you want to run against.

    You can click Add icon Create a new dataset or Create a new view to create and select a dataset or view without leaving the collection run configuration.

  7. (Optional) Click the Data tab in the left pane to preview the view you selected.

  8. (Optional) Control how many iterations run.

  9. Click Start run.

The collection run summary shows the data used for each iteration.

Control how many iterations run

By default, Postman sets the number of iterations to the number of rows returned by the selected view, running one iteration for each row. You can change how many iterations run and how Postman assigns data when there are more iterations than rows:

  • Iterations — Enter the number of times to run the collection. If you enter fewer iterations than the number of rows in the view, Postman uses the first rows in the view, one for each iteration.

  • Iteration strategy — Select how the extra iterations get their data when the view’s rows run out:

    • Round robin — Continue from the first row for the remaining iterations.
    • Repeat last — Continue using the last row for the remaining iterations.
    • Stop at end — Stop the run when the rows run out.

Both functional collection runs and performance tests support iteration strategies, but they work differently. In a functional run, the strategy controls how extra iterations get their data when the view’s rows run out. In a performance test, the strategy controls how rows are distributed across virtual users.

Use iteration data in requests

Dataset fields are automatically exposed as variables during the run. You can reference them using the {{variable}} syntax. For example, if your dataset has a userId field, reference it in your request URL as {{userId}}. Learn more about using variables.

GET /user?userId={{userId}}&email={{email}}&name={{name}}

Use iteration data in scripts

You can access the values from the current iteration in pre-request and post-response scripts using pm.iterationData. Learn more about using iteration data variables in scripts.

console.log(pm.iterationData.get("email"));

For more advanced usage, such as querying the dataset beyond the current iteration or referencing datasets, sources, and views by ID, see Use datasets.