Generating HTML report for API testing using Newman.

Shubham Pandey
Version 1
Published in
2 min readJan 2, 2023

Introduction

In this article, I will explain how to generate HTML reports for API testing using Newman.

Pre Requisites

  1. Postman Tool.
  2. A collection containing APIs.

Postman

Postman is a widely used API(application programming interface) development tool which helps to build, test and modify APIs. All the functionality needed by any developer is available in this tool. It can make various types of HTTP requests ( GET, POST, PUT, PATCH).

About Newman-html extra

Newman is a command line collection runner. Using Newman we can run and test Postman collection directly from the command line. Using Newman the collection can also be integrated with CI/CD tools like Jenkins, Azure DevOps. HTML Extra is a Postman/Newman reporting Dashboard which provides Postman test result into interactive UI.

To Generate the HTML extra dashboard report first we need to export Postman Collection:

Export Postman Collection

Steps to Generate report using the Postman Collection:

  1. First we need to install the latest version of Node.js.
  2. Install Newman using the below command
npm install -g Newman

3. Install HTML Extra Reporter( Install it globally so that it can be used from any path)

npm install -g newman-reporter-htmlextra

Now we are all set to generate the HTML report for our Postman Collection.

Steps for running the collection and generating the report:

  1. Navigate to the path where collection has been exported.
  2. Open command prompt.
  3. run the below command:
newman run <path of your collection> --reporters cli,junit,htmlextra --reporter-junit-export <path where Junit report need to be generated> --reporter-htmlextra-export <path where html report need to be generated> --delay-request 5000

After running the above command navigate to the path provided in the command, you will get report as below:

HTML report
Summary Report

About the Author:

Shubham Pandey is a Test Engineer at Version 1.

--

--