Newman htmlextra Report - Customizing

Currently using the newman htmlextra reporter. For Passed test cases the displayed information is sufficient and for failed test case is it possible to add some other details to it while displaying?

Say like for example, in the above screenshot we can add some other details to make it more clear. i.e some details from response body or the endpoint url used so on.

All of those details can be found within the original request in the main view so it would be like replicating that in 2 different areas.

The reporter is run on templates, you are in full control to add/remove any information you like by just creating a new template. :grin:

You would just pass that new template file path in the flag, from the CLI:

--reporter-htmlextra-template newTemplate.hbs

@dannydainton Thanks Danny!

I can even start editing the default template right?

I tried to pick the same code and tried it before editing. Got the below error:

Please advise on what I am missing.

I have no idea what you changed to even begin to help :smile: - I know what that error is but without even a tiny bit of context, I won’t be able to do/or suggest anything. :smile:

That is a link to the template the reporter uses by default, you could copy that locally and make changes or craft something entirely different. Then pass that on the CLI as your template.

@dannydainton I am yet to do any changes to the existing script. I copied the HTML code which you have for default report, tried to save it as hbs file and passed it into my command. Once this is successfully I thought of editing the default report to fit in my needs.

What version are you using?

Newman version - 5.1.2
Postman version - 7.31.1

The htmlextra reporter version - The latest is 1.19.0 which will work with that template but earlier versions might not.

Doing an npm update newman-reporter-htmlextra or npm update -g newman-reporter-htmlextra depending where you’re using the reporter should update it to the latest version.

1 Like