top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

How to run Postman Collections in Newman and generate HTML Report?

Newman is a command-line Collection Runner for Postman. Newman allows to run our Postman Collections from the command line interface where we can type the commands in command prompt. This process is similar to how the Collection is run inside a Postman Collection Runner.


Newman is based on Node.js which is a JavaScript library built for server side scripting. NPM (Node Package Manager) is the default package manager for Node.js. When we install Node.js, the NPM is also installed in our system.


Newman can be integrated with GitHub. If we are able to run our Postman Collection in command line, then we can be able to configure it with Jenkins too. Let us see how to install Newman in our system.




Newman Installation :


Step 1: Install Node.js from https://nodejs.org/en/ . Click on "Other Downloads" to get the stable version.



Step 2: Select "Windows Installer (.msi) " 64-bit. Mac Users can select macOS Installer. Don't choose Windows Binary (.zip).



Step 3: It will download an Installer. Just navigate to 'Next' button till it is done.


Step 4: Once it is done, go to Command Prompt and verify the installation is done properly by typing the following command.

> node -v


Step 5: In Command Prompt, verify the NPM installation is done properly by typing the following command.

>npm -v


Step 6: Install Newman via NPM (Node Package Manager) by typing the following command

>npm install -g newman


Step 7: Once the Newman installation is done, verify it by the following command

>newman -v

Step 8: Install Newman HTML report by the following command

>npm install -g newman-reporter-htmlextra


Now all the installation part is done. We are ready to go for exporting the Postman Collection as .json file in order to run it via Newman.


How to export Postman Collection ?


We can export all our Postman Collection, Environment and Global variables as .json file.


Step 1: Create a folder for Postman Collection in Desktop.


Step2: To export Postman Collection:

Go to Postman. Select the Postman Collection which needs to be exported as .json file. Click on 3 dots (...) next to Collection. Click on 'Export'.


Step 3: Let's have the recommended one and Click on 'Export' button.



Step 4: Navigate to the folder which you created in Desktop and click on 'Save' button to export the Postman Collection as a .json file.


Step 5: To export Environment Variable :

Click on 'Environment Quick Look' icon on the right hand corner.


Step 6: Click on 'Edit' button next to Environment variables. Click on 'Export' option.

Step 7: Navigate to the folder which you created on Desktop and click on 'Save' button to export the Environmental Variables as a .json file.



Step 8: To export Global Variables:

Click on 'Environment Quick Look' icon on the right hand corner.

Click on 'Edit' button next to Global variables. Click on 'Export' button.

Step 9: Navigate to the folder which you created on Desktop and click on 'Save' button to export the Global Variables as a .json file.



To run Postman Collections in Newman:


Step 1: Navigate to the folder which we created on Desktop and type 'cmd' in the address bar.


Step 2: Type the following command to run Postman Collection

>newman run <"collection_filename"> -e <environment_filename> -g <global_filename >


In our case, the command will be

>newman run “Jan23-APICoders-SDET-017.postman_collection.json” -e APIHackathon.postman_environment.json -g workspace.postman_globals.json



Step 3: Postman Collection is run and the result is shown.

To generate Newman HTML report:


To generate Newman HTML report, type the following command

>newman run <Collection_filename> -r htmlextra


In our case, the command will be

>newman run Jan23-APICoders-SDET-017.postman_collection.json -r htmlextra


We can see the HTML report in a folder named "newman" inside the folder we created. Also options are available to view Summary, Total Requests, Failed Tests, and Skipped Tests.



Conclusion :

We can run successfully our Postman Collection through Newman and generate HTML report. It can be easily integrated with CI/CD.














1,850 views2 comments

+1 (302) 200-8320

NumPy_Ninja_Logo (1).png

Numpy Ninja Inc. 8 The Grn Ste A Dover, DE 19901

© Copyright 2022 by NumPy Ninja

  • Twitter
  • LinkedIn
bottom of page