A Newman HTML reporter that has been extended to include the separation of the iteration runs so these are no longer aggregated together and also some additional handlebars helpers
to enable users to create better custom templates. This reporter comes with a default dashboard style template which also includes a Dark Theme
switcher. There are also a few optional flags available, you can find these all listed below.
To give you an idea of what the final report will look like, I've added a working example here for you to get your hands on:
The installation should be global if newman is installed globally, local otherwise.
For global
install:
npm install -g newman-reporter-htmlextra
For local
install:
npm install -S newman-reporter-htmlextra
In order to enable this reporter, specify htmlextra
in Newman's -r
or --reporters
option. The following command will create a new report in the ./newman
directory, if the directory does not exist, it will be created as part of the Newman run.
newman run collection.json -r htmlextra
CLI Option | Description | Example |
---|---|---|
--reporter-htmlextra-export <path> |
Specify a path where the output HTML file will be written to disk. If not specified, the file will be written to newman/ in the current working directory. |
newman run collection.json -r htmlextra --reporter-htmlextra-export ./results/report.html |
--reporter-htmlextra-template <path> |
Specify a path to the custom template which will be used to render the HTML report. This option depends on --reporter htmlextra and --reporter-htmlextra-export being present in the run command. If this option is not specified, the default template is used |
newman run collection.json -r htmlextra --reporter-htmlextra-template ./template.hbs |
--reporter-htmlextra-showOnlyFails |
Use this optional flag to tell the reporter to display only the requests with failed tests. | newman run collection.json -r htmlextra --reporter-htmlextra-showOnlyFails |
--reporter-htmlextra-testPaging |
Use this optional flag to add pagination to the tests in the request view. | newman run collection.json -r htmlextra --reporter-htmlextra-testPaging |
--reporter-htmlextra-browserTitle |
Use this optional flag to change the name of the title in the browser tab. The default name is "Newman Summary Report". | newman run collection.json -r htmlextra --reporter-htmlextra-browserTitle "My Newman report" |
--reporter-htmlextra-title |
This optional flag can be used to give your report a different main Title in the centre of the report. If this is not set, the report will show "Newman Run Dashboard". |
newman run collection.json -r htmlextra --reporter-htmlextra-title "My Newman Report" |
--reporter-htmlextra-titleSize |
An optional flag to reduce the size of the main report title. The sizes range from 1 to 6 , the higher the number, the smaller the title will be. The default size is 2 . |
newman run collection.json -r htmlextra --reporter-htmlextra-titleSize 4 |
--reporter-htmlextra-logs |
This optional flag shows any console log statements in the collection, on the final report. This is false by default. |
newman run collection.json -r htmlextra --reporter-htmlextra-logs |
--reporter-htmlextra-hideResponse |
An optional flag which allows you to exclude certain Response Bodies from the final report. Enter the name of the request that you wish to hide. |
newman run collection.json -r htmlextra --reporter-htmlextra-hideResponse "Auth Request" |
--reporter-htmlextra-showEnvironmentData |
An optional flag which allows you to show all the Environment variables used during the run, in the final report |
newman run collection.json -r htmlextra --reporter-htmlextra-showEnvironmentData |
--reporter-htmlextra-skipEnvironmentVars |
An optional flag which allows you to exclude certain Environment variables from the final report |
newman run collection.json -r htmlextra --reporter-htmlextra-skipEnvironmentVars "API_KEY" |
--reporter-htmlextra-omitHeaders |
An optional flag which allows you to exclude all Headers from the final report |
newman run collection.json -r htmlextra --reporter-htmlextra-omitHeaders |
--reporter-htmlextra-skipHeaders |
An optional flag which allows you to exclude certain Headers from the final report |
newman run collection.json -r htmlextra --reporter-htmlextra-skipHeaders "Authorization" |
--reporter-htmlextra-skipSensitiveData |
An optional flag that will exclude all the Request/Response Headers and the Request/Response bodies , from each request in the final report. This will only show the main request info and the Test Results. This is false by default. |
newman run collection.json -r htmlextra --reporter-htmlextra-skipSensitiveData |
--reporter-htmlextra-showMarkdownLinks |
An optional flag which allows you render Markdown links from the test names and pm.expect() statements, in the final report. This could be useful if you use an external bug tracker. |
newman run collection.json -r htmlextra --reporter-htmlextra-showMarkdownLinks |
--reporter-htmlextra-noSyntaxHighlighting |
An optional flag which allows you disable the code syntax highlighting. This could enhance the performance of opening larger reports. | newman run collection.json -r htmlextra --reporter-htmlextra-noSyntaxHighlighting |
--reporter-htmlextra-timezone |
An optional flag which allows you to set the timezone on the final report's timestamp | newman run collection.json -r htmlextra --reporter-htmlextra-timezone "Australia/Sydney" |
Custom templates can be passed to the htmlextra
reporter via the --reporter-htmlextra-template <path>
flag. The default template is used in all other cases.
All the CLI functionality is available for programmatic use as well within a nodejs
script. Adding any of the options within the htmlextra
object will enable the functionality of the given feature.
const newman = require('newman');
newman.run({
collection: '../examples/Restful_Booker_Collection.json',
environment: '../examples/Restful_Booker_Environment.json',
reporters: ['htmlextra'],
iterationCount: 1,
reporter: {
htmlextra: {
// export: './report.html',
// template: './template.hbs'
// logs: true,
// showOnlyFails: true,
// noSyntaxHighlighting: true,
// testPaging: true,
// browserTitle: "My Newman report",
// title: "My Newman Report",
// titleSize: 4,
// omitHeaders: true,
// skipHeaders: "Authorization",
// hideResponse: ["Auth Request"],
// showEnvironmentData: true,
// skipEnvironmentVars: ["API_KEY"],
// skipSensitiveData: true,
// showMarkdownLinks: true,
// timezone: "Australia/Sydney"
}
}
});
A docker image dannydainton/htmlextra
has been created for the reporter and can be found on Docker Hub
Using this command, it will pull down the image and run the Postman Collection with Newman. Once the run has completed it will create a new report file in the /newman
dir.
docker run -t -v $(pwd):/etc/newman dannydainton/htmlextra run collection.json -r htmlextra
Using an environment file during the Newman run:
docker run -t -v $(pwd):/etc/newman dannydainton/htmlextra run collection.json -e environment.json -r htmlextra
Using either the Shared Collection link from the Postman App or using the Postman API Link to the files:
docker run -t -v $(pwd):/etc/newman dannydainton/htmlextra run <URL to Collection> -e <URL to Environment> -r htmlextra
Each of these command can be used with the different CLI flags to create the final report that you require.
newman-reporter-htmlextra | newman | node |
---|---|---|
>= v1.1.0 | >= v4.2.3 | >= v10.x |
I would be lying if I said that I've created this reporter all on my own, I need to say a massive Thank You! to the following folks for helping make htmlextra
even better:
If you are interested in talking to the Postman team and fellow Newman users, you can find us on our Postman Community Forum. Feel free to drop by and say hello. You'll find us posting about upcoming features and beta releases, answering technical support questions, and contemplating world peace.
Sign in using your Postman account to participate in the discussions and don't forget to take advantage of the search bar - the answer to your question might already be waiting for you! Don’t want to log in? Then lurk on the side-lines and absorb all the knowledge.
This software is licensed under Apache-2.0. Copyright Postdot Technologies, Inc. See the LICENSE.md file for more information.
This work have been hugely inspired and copied several aspects of the great work done by Martijn Vander Vlag to create the newman-reporter-htmlfull package. Check out that package too, this contains many of the same features.
It was also brought together by reviewing the feature requests, from the official Postman HTML reporter.