How to generate your API Test Report In 5 Simple Steps with Newman

Newman is a command-line collection runner for Postman. A postman collection can run and be tested directly from the command-line. The collection runs in the same way it is executed, inside the collection runner in postman. Newman can also be used to generate reports.

How it works

  1. Ensure you have Nodejs installed on your laptop: Check your environment variables and make sure the path contains C:\Program Files\nodejs; and then, go to command prompt and type npm -version in your command prompt then press enterNavigate to environment variables
    Check for npm path
    Ensure you have Nodejs installedIf you don’t have, no need to panic! Head to https://nodejs.org/en/download/  and download the appropriate version for your PC.
  2.  Install Newman: In the command prompt type, this command “npm install -g newman”, press enter and wait patiently till the installation is complete.
    Install newman
  3. Install Newman HTML reporter:  In the command prompt, type this command “npm install -g newman -reporter-htmlextra”, press enter and wait.
    Add HTML Reporter
  4. Export both your collection and environment from Postman to an empty folder on your laptop.
    Copy the path of your folder location
  5. Run the test and generate a test report
    – Copy the path of the folder containing the collection and environment exported from postman

    – On the command prompt type “cd”, then paste the copied path and press enter

    – To run the test, type “newman run collection_name -e environment_name” and press enter. The “collection_name” and “environment_name” is the name your collection and environment are saved as. In this example, they are saved as “collection.json” and “environment.json” respectively.

    – To generate the HTML report, type “newman run collection_name -e environment_name -r htmlextra”


    – Now check the folder containing the collection and environment; a new folder named newman would have been automatically created

    – Open the newman folder created and open the content to view the html report generated
    Hurray!!!
    There you have it, we have successfully run and generated our postman test result using Newman in 5 simple steps.

Leave a comment