Generate collection run reports with Newman built-in reporters
Newman has built-in reporters you can use to generate reports for your collection runs. The following reporters are available: CLI, JSON, JUnit, Progress, and Emoji train. You can use more than one reporter for a run, and you can customize the report output to meet your needs.
Use built-in reporters
To generate reports of the current collection run, you can configure reporters using the -r or --reporters options. Then specify the reporters you’d like to generate reports for: cli, json, junit, progress, or emojitrain.
You can specify one or more reporters. If you specify more than one reporter, separate reporter names as a comma-separated list, for example, -r cli,json. To learn more about each reporter, see About built-in reporters.
The CLI reporter (cli) is turned on by default when using Newman in the terminal. If you turn on one or more reporters, for example -r json, the CLI reporter will be turned off. To turn on the CLI reporter, you must specify the CLI reporter, for example, -r cli,json.
The following example runs the cli and json reporters:
If the built-in reporters aren’t right for your use case, you can use an external reporter or build a custom reporter.
About built-in reporters
Each reporter generates a report about your collection run in a different format.
- CLI - Displays the report in the terminal.
- JSON - Creates a JSON file containing the report.
- JUnit - Creates an XML file containing the report.
- Progress - Displays a progress bar in the terminal showing the progress of the collection run.
- Emoji train - Displays emojis in the terminal that represent the report’s details.
Configure built-in reporters
If you specify more than one reporter, you can specify an option for one reporter using the --reporter-[reporter-name]-[reporter-option] option. The following example silences the CLI reporter only:
If you specify more than one reporter, and you want all reporters to accept the same option, you can specify an option for all reporters using the --reporter-[reporter-option] option. The following example passes silent: true to both the CLI and JSON reporters:
CLI reporter
The CLI reporter is turned on by default when using Newman as a CLI, and prints the report to the terminal. You can use the following options to configure the CLI reporter:
The following example prints the time that each request was made:
JSON reporter
The JSON reporter creates a JSON file in your working directory that contains the report. You can use the following option to configure the JSON reporter:
The following example generates the output JSON file for the JSON reporter in the /json-file-reports directory:
JUnit reporter
The JUnit reporter creates an XML file in your working directory that contains the report. You can use the following option to configure the JUnit reporter:
The following example generates the output XML file for the JUnit reporter in the /xml-file-reports directory: