Running Tests Locally with Newman

Learn how to run Postman tests locally with Newman.


Now that we have built some API tests with Postman, it’s time to move from the Postman UI to a command-line interface. While the UI is nice, the CLI lets us run tests from simple scripts, quickly launch them, and make it easier to incorporate test runs into our regular development habits.

To run Postman tests, we can use a CLI utility called Newman, which is a tool created by the Postman team. It supports running test collections directly from the command line and outputting the results for viewing or storing within our project. Once we have Newman, we’ll need to pull one of our test collections from Postman and save it locally.

Exporting a Postman collection

The first step to running tests locally is to export an existing test collection from the Postman application to our workstation. To do that, let’s open the Postman client and locate a collection to export in the left sidebar. For this example, let’s pick the “Company Home API Tests” collection we were using earlier.

To start the export, click the three dots next to the collection name to bring up the dropdown menu. Select “Export” from the menu to call up the “Export Collection” dialog box, as shown in the following screenshot:

Get hands-on with 1200+ tech skills courses.