Postman has become the go-to tool for API development, testing, and collaboration. Its user-friendly interface and powerful features simplify the process of working with APIs. In addition to its comprehensive testing capabilities within the application, Postman offers an efficient command-line tool called Newman. This article explores Postman Newman and how it can enhance your API testing workflow.
Table of contents
- What is Postman Newman?
- Installing Newman
- Running Postman collection with Newman
- Advanced features of Newman
- Conclusion
What is Postman Newman?
Postman Newman is a command-line collection runner for Postman. It allows you to run Postman collections, a group of API requests, from the command line interface (CLI). Newman is built on Node.js and is available as an npm package. It offers a convenient way to automate and integrate API testing into your development and deployment pipelines.
Installing Newman
Before using Newman, ensure you have Node.js and npm installed on your system. Follow these steps to install Newman:
- Visit the official Node.js website and download the latest stable version suitable for your operating system. Run the installer and follow the instructions.

- Open your command prompt or terminal and run the following command to check if Node.js is successfully installed:
node -v
This command will display the installed Node.js version if the installation was successful.
- After confirming that Node.js is installed, open your command prompt or terminal and run the following command to install Newman globally:
npm install -g newman

To use Newman, you need a Postman collection. If you do not have a collection, you can refer to our article on mastering Postman collections.
Running Postman collection with Newman
Now that you have Newman installed and a Postman collection ready, it is time to run it using Newman. But before that, copy the path of the exported collection file in JSON format.

- Open your command prompt or terminal. Run the Newman command with the collection file as an argument:
newman run [path_to_collection_file]
Replace [path_to_collection_file] with the actual path to your Postman collection file.
- Press Enter to execute the command.

Newman will start running the collection and display the test results in your command prompt or terminal. You will see detailed information about each request’s response, including the status code, response body, and test results.
Advanced features of Newman
Newman offers several advanced features that can further enhance your API testing workflow. Let us explore some of them:
Environment variables
You can use environment variables in your Postman collection and pass their values to Newman using the --env
flag. This allows you to configure different environments (e.g., development, staging, production) and switch between them easily during testing.
newman run [path_to_collection_file] --env [path_to_environment_file]
Iterating data
If your API testing involves sending multiple requests with different data, Newman allows you to import data files (e.g., CSV, JSON) and iterate over them using the --iteration-data
flag. This feature is helpful for scenarios where you need to test your API with various input values.
newman run [path_to_collection_file] --iteration-data [path_to_data_file]
Generating reports
Newman enables you to create test reports in different formats, such as HTML, JSON, or JUnit. These reports provide detailed insights into your test runs and can help share results with your team or integrate them into your CI/CD pipelines.
newman run [path_to_collection_file] --reporters [reporter_name]
Running in parallel
Newman allows you to execute multiple collections in parallel, significantly speeding up your API testing process. You can run tests concurrently using the --parallel
flag followed by the desired number of iterations.
newman run [path_to_collection_file] --parallel [number_of_iterations]
Final thoughts on streamlining API testing with Postman Newman
Postman Newman is a powerful tool that automates API testing using your Postman collections. Its command-line interface makes integrating your development and deployment pipelines convenient, enhancing your overall testing workflow. By following the steps outlined in this article, you can start leveraging the capabilities of Newman to streamline your API testing process. Additionally, the advanced features offered by Newman, such as environment variables, data iteration, generating reports, and parallel execution, provide flexibility and efficiency in your testing efforts. Happy testing!
This post is part of our comprehensive Postman Mini-Course.
Follow our blog
Be the first to know when we publish new content.