Newman is a powerful command-line collection runner for Postman, enabling users to execute and test Postman collections directly from the command line without the Postman GUI. It is primarily designed for integration into continuous integration and continuous delivery (CI/CD) pipelines and other automated build systems to facilitate automated API testing. The current stable version is 6.2.2. While there isn't a fixed release cadence, the project is actively maintained, with major versions typically introducing Node.js compatibility updates and dependency upgrades (e.g., v6 was released in late 2023). Key differentiators include its seamless integration with Postman collections, support for various output reporters (CLI, JSON, JUnit, HTML), and its capability for programmatic use as a Node.js library, offering a robust solution for automated API testing workflows.
npm install newmanVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically run a Postman collection using Newman as a Node.js library, including specifying reporters and handling the run summary for success or failure states. It generates a temporary collection file and cleans it up after execution.
Upgrade your Node.js installation to version 16 or newer. Use `nvm` or your system's package manager for Node.js management.
Ensure your project's dependencies are compatible. Review the official Newman migration guide for any behavioral changes in the Postman Runtime or script execution logic, especially if you relied on older `tough-cookie` behavior.
Obtain OAuth 2.0 tokens externally (e.g., through a separate script or Postman's GUI) and pass them to Newman as environment variables (`--env-var 'token=your_token'`) or through a Postman environment file.
Use absolute paths for collection, environment, and data files within CI scripts, or explicitly set the working directory for the Newman command. For example, `newman run $(pwd)/path/to/collection.json`.
For development/testing, use `newman run --insecure ...`. For production, configure proper CA certificates using `--ssl-extra-ca-certs` or ensure your environment trusts the certificates.
Install Newman globally: `npm install -g newman`. If already installed, ensure `$(npm config get prefix)/bin` (or `C:\Users\<YourUser>\AppData\Roaming\npm` on Windows) is in your system's PATH.
Install Newman as a local project dependency: `npm install newman`. If using TypeScript, also install types: `npm install @types/newman --save-dev`.
Verify the file path and name are correct. Ensure the user running Newman has read permissions for the file. Use absolute paths, especially in CI/CD environments.
Upgrade your Node.js environment to version 16 or later. For example, use `nvm install 16` and `nvm use 16`, or update your system's Node.js installation.