LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

newman

Run Postman collections from the command line

TLDR

Run Postman collection
$ newman run [collection.json]
copy
Run with environment
$ newman run [collection.json] -e [environment.json]
copy
Run specific folder
$ newman run [collection.json] --folder "[folder name]"
copy
Export results
$ newman run [collection.json] -r [html] --reporter-html-export [report.html]
copy
Run with iterations
$ newman run [collection.json] -n [10]
copy
Run with data file
$ newman run [collection.json] -d [data.csv]
copy
Set timeout
$ newman run [collection.json] --timeout-request [5000]
copy

SYNOPSIS

newman run collection [options]

DESCRIPTION

newman is the command-line companion for Postman that runs exported collections, enabling automated API testing. It executes all requests in a collection sequentially, running pre-request scripts and tests, and reports results.Newman integrates with CI/CD pipelines to automate API testing. It supports data-driven testing through CSV/JSON files, multiple reporters for output formatting, and environment/global variable management.

PARAMETERS

COLLECTION

Postman collection file path or URL.
-e FILE
Specify an environment file.
-g FILE
Specify a globals file.
--folder NAME
Run only a specific folder from the collection.
-r REPORTERS
Comma-separated reporter types (cli, json, junit, html).
-n COUNT
Number of iterations to run.
-d FILE
Data file (CSV or JSON) for iteration variables.
--global-var KEY=VALUE
Set a global variable via the command line (repeatable).
--env-var KEY=VALUE
Set an environment variable via the command line (repeatable).
--bail
Stop the run on the first test failure.
--timeout MS
Time in milliseconds to wait for the entire collection run to complete.
--timeout-request MS
Time in milliseconds to wait for each request.
-x, --suppress-exit-code
Override the default exit code for the run.
--color VALUE
Control color output: on, off, or auto (default).
--help
Display help information.

CAVEATS

Requires Node.js. Collections must be exported from Postman in JSON format. The HTML reporter requires an additional npm package (newman-reporter-html). Collection v1 format is deprecated; use v2 or later.

HISTORY

Newman was created by Postman to enable command-line execution of API collections for testing automation.

SEE ALSO

curl(1), httpie(1), postman(1), npm(1)

Copied to clipboard
Kai