Data‑Driven API Testing with Postman Collection Runner and CSV Files
Learn how to drive Postman API tests with external CSV data using the Collection Runner, including setup, a worked example, trade‑offs, and verification steps.
24 Feb 2026, 07:39 UTC

Problem: Repeating the same request with different parameters
When you need to verify an API endpoint against many input values—such as checking a user‑lookup service for a list of IDs—manually creating a separate request for each value is tedious and error‑prone. Postman’s Collection Runner solves this by feeding a collection with rows from an external data file, turning a single request into a data‑driven test suite.
Thesis
Using the Collection Runner with a CSV (or JSON) file lets you execute a Postman collection multiple times, automatically mapping file columns to variables, while keeping the test logic inside Postman’s test scripts. This approach is quick to set up, requires no external code, and provides immediate pass/fail feedback for each iteration.
Setting Up the Runner
- Open the collection you want to run in Postman Desktop.
- Click the Runner tab at the bottom of the workspace.
- Drag the collection into the right‑hand panel or use Add Collection to select it.
- Under the Data section, choose Select File and point to a UTF‑8 encoded CSV (or JSON) file.
- Postman will display the column headers; ensure they match the variable names you plan to use (e.g.,
id). - Click Start Run to begin.
Worked Example: GET /users/{{id}}
Suppose you have a simple GET request that retrieves a user by ID:
GET https://api.example.com/users/{{id}}
Attach a test script to validate the response:
pm.test('Status 200', () => {
pm.response.to.have.status(200);
});
pm.test('ID matches', () => {
const json = pm.response.json();
const expected = pm.variables.get('id');
pm.expect(json.id).to.equal(expected);
});
Create a CSV file named users.csv with the following content:
id
1
2
3
4
5
When you run the Collection Runner:
- Postman reads each row, assigns the
idcolumn to the variable{{id}}. - The request URL becomes, for example,
https://api.example.com/users/1for the first iteration. - The test script runs after each response, marking the iteration as pass or fail.
After the run, the Runner UI shows a table with one row per CSV line, indicating pass/fail status and response time.
Trade‑off and Limitations
- Execution time: Large data files increase total run time because each iteration performs a full HTTP request. If you have thousands of rows, consider sampling or splitting the file.
- Memory usage: The Runner loads the entire data file into memory; very large files may affect Postman Desktop performance.
- Debugging complexity: Pre‑request scripts that depend on iteration‑specific data can be harder to troubleshoot than in a dedicated test framework where you can set breakpoints per iteration.
- Variable precedence: Collection or global environment variables with the same name as a CSV column will override the data file value. Be aware of this scope order to avoid unexpected values.
Verifying the Results
- After the run finishes, look at the Summary bar at the top of the Runner output; it shows total iterations, passed, and failed.
- Click any iteration in the table to open the request/response details for that specific row.
- Optionally, click Export Results to download a JSON or CSV report containing each iteration’s status, response time, and any test assertions.
- To confirm that the correct ID was used, open the exported report and verify that the
urlfield for each iteration contains the expected/users/<value>pattern.
Actionable Closing
Start small: create a collection with a single request, attach a CSV of three to five rows, and run the Collection Runner. Observe the pass/fail table and export the report to ensure the data mapping works as expected. Once comfortable, scale up to larger datasets while monitoring run time and memory usage. This approach gives you repeatable, data‑driven API validation without leaving the Postman environment.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.