0
0
PostmanHow-ToBeginner · 4 min read

How to Use Collection Runner in Postman for Automated API Testing

To use the Collection Runner in Postman, open your collection and click the Runner button. Then, select the collection, optionally upload a data file (CSV/JSON) for variable input, and click Start Run to execute all requests sequentially with results shown in the runner window.
📐

Syntax

The Collection Runner interface in Postman follows this usage pattern:

  • Select Collection: Choose the API collection you want to run.
  • Data File (Optional): Upload a CSV or JSON file to provide variable data for each request iteration.
  • Environment: Select an environment to use environment variables during the run.
  • Iterations: Set how many times to run the collection (overrides data file length if set).
  • Run: Click Start Run to begin executing requests in order.
text
Collection Runner Usage Pattern:
1. Open Postman
2. Click on your Collection
3. Click 'Runner' button
4. Select Collection in Runner
5. (Optional) Upload Data File (CSV/JSON)
6. Select Environment
7. Set Iterations
8. Click 'Start Run'
9. View results and logs in Runner window
💻

Example

This example demonstrates running a collection with a data file to test multiple user logins automatically.

Assume you have a collection named User Login with a POST request to /login that uses variables {{username}} and {{password}}.

You prepare a CSV file users.csv with:

username,password
user1,pass1
user2,pass2
user3,pass3

Using Collection Runner, upload this CSV, select the collection, and start the run. Postman will send the login request three times with each user’s credentials.

http
POST /login
Headers:
  Content-Type: application/json
Body (raw JSON):
{
  "username": "{{username}}",
  "password": "{{password}}"
}
Output
Run Results: Iteration 1: user1 login - Passed Iteration 2: user2 login - Passed Iteration 3: user3 login - Passed
⚠️

Common Pitfalls

  • Not uploading a data file when using variables: Requests fail because variables like {{username}} are undefined.
  • Incorrect variable names: Variable names in the data file must exactly match those in the request.
  • Forgetting to select the correct environment: Environment variables won’t resolve, causing errors.
  • Setting iterations incorrectly: Setting iterations higher than data rows causes repeated runs with missing data.

Always double-check variable names and data file format before running.

text
Wrong way:
- Use {{user}} in request but CSV has 'username'
- No data file uploaded but request uses variables

Right way:
- Use {{username}} in request and CSV header is 'username'
- Upload CSV file with correct headers
- Select environment if variables are used
📊

Quick Reference

StepActionNotes
1Open Collection RunnerClick 'Runner' in Postman UI
2Select CollectionChoose the collection to run
3Upload Data FileCSV or JSON for variable input (optional)
4Select EnvironmentUse environment variables if needed
5Set IterationsNumber of times to run (overrides data file length)
6Start RunClick 'Start Run' to execute requests
7View ResultsCheck pass/fail and logs in runner window

Key Takeaways

Use Collection Runner to automate running all requests in a collection sequentially.
Upload CSV or JSON data files to run requests with different variable inputs.
Always match variable names in requests with headers in your data file.
Select the correct environment to resolve environment variables during runs.
Check the runner results window for detailed pass/fail status and logs.