Run and Test Postman Collections Directly from the Command Line with Newman

Newman by Postman is an open source tool that developers and engineers can use to run and test Postman collections directly from the command line. The Newman CLI uses the same runtime as Postman native apps and maintains feature parity with Postman. This CLI tool can be used to run and test a collection once or every time a change is made to an API. The tool allows collections to be executed in the same manner as the collection runner in Postman. Postman 6.0 was released in February of this year.

 

A few examples of the best ways to use this CLI tool are running Newman with a local JSON file, running Newman with the latest collection URL, and integrating with a CI/CD pipeline.

Running Newman with a local JSON file allows a collection to be run in an ad hoc manner. The tool supports output formats including (but not limited to) JSON, HTML, and XML. Running Newman with the latest collection URL, as opposed to exporting a collection file every time an update is made, ensures that team members are working on the correct version of a collection. Integrating with a CI/CD pipeline is beneficial because it allows Postman tests to be run each time the build process is started. Integrating Postman tests with a continuous integration service is the same process regardless of the code deployment pipeline tool used e.g. Jenkins, Travis CI, etc.

Newman is available via GitHub as well as the NPM package registry. You can find more information about the Newman CLI in a post on the Postman blog.

Janet Wagner is a technical writer and contributor to ProgrammableWeb who covers breaking news and in-depth analysis. She specializes in creating well-researched, in-depth content about APIs, machine learning, deep learning, computer vision, analytics, and other advanced technologies.
 

Comments (0)