top of page

Let’s see how to run Postman collections/ requests from command line and get HTML report

You can group your Postman requests and examples into collections to keep your workspace organized, to collaborate with teammates, to generate API documentation and API tests, and to automate request runs.

Methods to Share collections:

Sharing a collection is very important when you are working in a company or in a team. There are times when developers create a bunch of Postman Requests while developing APIs to test it. You can request developers to share their collections and you get benefits of it. Or even you create a bunch of Postman Requests, save it to a Collections and share it with your team. Instead of sharing every request one by one. Rather, we share our Collection as a whole to the team members or anyone to whom we want to share through different methods listed below.

  • Through workspace: In Team workspace option, your team can test API simultaneously on one workspace and anyone can edit and update (with permissions).

  • Sharing through link: workspace is completely personal to the user who created it. Collections present in the personal workspace is shared through link

Let’s see steps to follow to run collection from command line:

We have to follow three steps in order to run collection from command line

  • Install Node.js(npm)

  • Export collection and then run from command line.

  • Install Newman

  • Install npm install newman-reporter-html

1)Install NodeJs from Google

  • Download Node js for windows or Mac as required

  • After installation you will verify if Node Js is installed or not on the command line as >Node -v as

shown by staying in the respective Directory.

  • >npm -v (to see the version if installed)

Below is the screenshot to show that NodeJs is installed and we are checking the version of it.

  • On the command line> npm install -g npm@9.1.2

Export collection and then run from command line.

  • On the collection which has multiple requests

Creating new Collection :

Click on the + to create a new collection

  • Click on Add a request to create a new HTTP request as shown above.

  • For each request you need to click New,

  • You can select the GET,POST,PUT,PATCH and DELETE requests and make it a collection

  • Select the request, give the input as shown in the below examples and click save and send. so that it will be added in the existing collection.

What is workspace in Postman:

Postman Workspaces allow you to organize your API work and collaborate with teammates. They act as a common working area where you can group your API projects together and use API builder to start defining APIs or generate API elements.

  • Click on three dots beside the New Collection in the below example and

  • Click Export

  • Select path to save the file as shown below

  • Click Save

Install Newman

Command line :

c:\users\Test Data> newman run NewCollection.postman_collection1.json

Install newman reporter html

  • If it shows as npm install newman-reporter-html

  • Then in the same command prompt type

>npm install newman-reporter-html

  • After installation

  • Verify c:\Users\TestData> newman NewCollection.postman_collection1.json -r html

  • There must be a folder generated in the same directory as shown below saying Node_modules

  • Click on it and click on newman reporter.htm

  • Click on examples and

  • Click on sample-collections-report open the report in browser to view the Newman report in html.

Here is the Newman Report in html

Since Newman can run as a command line, it decreases a lot of dependency on any prerequisites in the form of a console or app, i.e. the only reliance Newman has is a node.This allows Postman collections to run as part of the build pipelines themselves through the Newman command line. Since Newman also can send results in Html format, this is useful and practical. During the execution of the pipeline itself, the HTML results can be sent to a server or sent via email to users desired, etc. The capabilities are infinite as the dependencies are minimal.


The command line integration called Newman allows you to run Postman collections through a command-line interface. It is simply a node package. Any command-line with a node installed alongside Newman should run the Postman collection and generate attractive HTML reports of the collection execution.

The command line integration is also beneficial for integrating Postman-based collection tests with CI tools like Jenkins, Travis, etc., as execution via the command line has no dependencies. However, in the operating system or application, you need a node environment to run the collection.

110 views0 comments

Recent Posts

See All


Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page