0
0
Postmantesting~5 mins

Reporter options (CLI, HTML, JUnit) in Postman

Choose your learning style9 modes available
Introduction

Reporters show test results in different ways. They help you understand what passed or failed easily.

You want to see test results quickly in the command line after running tests.
You need a detailed, easy-to-read report to share with your team.
You want to integrate test results with other tools that use JUnit format.
You want to save test results as a file for later review.
You want to automate test reporting in your build or deployment process.
Syntax
Postman
newman run collection.json --reporters cli,html,junit --reporter-html-export report.html --reporter-junit-export report.xml

Use --reporters to specify one or more reporters separated by commas.

Use --reporter--export to save the report to a file.

Examples
Shows test results in the command line interface (CLI) only.
Postman
newman run mycollection.json --reporters cli
Generates an HTML report and saves it as results.html.
Postman
newman run mycollection.json --reporters html --reporter-html-export results.html
Generates a JUnit XML report for integration with CI tools.
Postman
newman run mycollection.json --reporters junit --reporter-junit-export results.xml
Runs tests and outputs results in CLI, HTML file, and JUnit XML file.
Postman
newman run mycollection.json --reporters cli,html,junit --reporter-html-export report.html --reporter-junit-export report.xml
Sample Program

This command runs a Postman collection from a URL using Newman. It shows results in the terminal, creates an HTML report saved as test-report.html, and creates a JUnit XML report saved as test-report.xml.

Postman
newman run https://api.getpostman.com/collections/12345678-1234-1234-1234-123456789abc?apikey=your_api_key --reporters cli,html,junit --reporter-html-export test-report.html --reporter-junit-export test-report.xml
OutputSuccess
Important Notes

CLI reporter is the default and shows results in your terminal.

HTML reporter creates a colorful, easy-to-read report you can open in a browser.

JUnit reporter creates XML files useful for CI/CD tools like Jenkins or GitLab.

Summary

Reporter options let you choose how to see your test results.

Use CLI for quick terminal output, HTML for detailed reports, and JUnit for tool integration.

You can use multiple reporters at once to get different views of your test results.