Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I generate an HTML report for Junit results?

Is there a way to (easily) generate a HTML report that contains the tests results ? I am currently using JUnit in addition to Selenium for testing web apps UI.

PS: Given the project structure I am not supposed to use Ant :(

like image 990
Andrei Ciobanu Avatar asked Mar 05 '10 09:03

Andrei Ciobanu


People also ask

Can JUnit generate HTML report?

We can use maven-surefire-report-plugin plugin to generate HTML based reports for our JUnit tests. This report can be exported and shared with the team.

How do you create a test report in HTML?

To generate a HTML report for a Selenium test, we have to install a plugin with the command: pip install pytest-html. To generate the report, we have to move from the current directory to the directory of the Pytest file that we want to execute. Then run the command: pytest --html=report.

How do I export JUnit results from Eclipse?

In the top right corner of the Junit test runner, you can see a dropdown. Click that and you will find an option to export. Export the test result to the desired location. You will get the XML format of the test report in the provided location.

What is JUnit XML file?

JUnit xml is a framework that was used in many applications in the test frameworks. By default, the test will generate xml files which are simple reports used for the execution of the test. These files are used to generate the report which was custom, we can also generate the reports as per the requirement of testing.


1 Answers

I found the above answers quite useful but not really general purpose, they all need some other major build system like Ant or Maven.

I wanted to generate a report in a simple one-shot command that I could call from anything (from a build, test or just myself) so I have created junit2html which can be found here: https://github.com/inorton/junit2html

You can install it by doing:

pip install junit2html 
like image 161
IanNorton Avatar answered Oct 11 '22 10:10

IanNorton