← Back to Chapters

Collection Runner

? Collection Runner

? Quick Overview

Collection Runner in Postman is a powerful feature that allows you to execute an entire collection of API requests in sequence. It is mainly used for automation, data-driven testing, and validating multiple endpoints at once.

? Key Concepts

  • Run multiple requests in a defined order
  • Use environment and global variables
  • Support for iterations using CSV / JSON files
  • View detailed test results after execution
  • Ideal for regression and automated API testing

? Syntax / Theory

A Postman Collection contains folders and requests. When executed via the Collection Runner, Postman runs each request sequentially for a defined number of iterations. During execution, pre-request scripts and tests are triggered automatically.

? Code Example(s)

? View Code Example
// Tests tab script to validate response status
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});

// Store token from response into environment variable
var jsonData = pm.response.json();
pm.environment.set("authToken", jsonData.token);

? Live Output / Explanation

Execution Result

When the collection is run, each request executes sequentially. Test results are shown as passed or failed for every iteration. Variables such as authToken can be reused across subsequent requests.

? Interactive Example / Visual Flow

Collection Runner executes requests in the following flow. Click the "Run Collection" button below to simulate how Postman processes a list of API calls sequentially.

My API Collection
  • POST /api/login Pending
  • GET /api/users/me Pending
  • PUT /api/users/update Pending
Ready to run...
  • Load environment & data file
  • Execute pre-request script
  • Send API request
  • Run tests
  • Repeat for next iteration

? Use Cases

  • Automated API regression testing
  • Bulk data validation using CSV files
  • Performance checks with repeated executions
  • End-to-end API workflow testing

? Tips & Best Practices

  • Use meaningful test names for better reports
  • Prefer environment variables over globals
  • Keep collections modular and reusable
  • Validate both response body and headers

? Try It Yourself

  1. Create a new Postman collection
  2. Add at least two API requests
  3. Write a test script to validate status code
  4. Run the collection using Collection Runner
  5. Observe iteration-wise results