I want to do logging and Test Report Generation with Junit. Logging to a txt file i can achieve using the java logger. To achieve the reporting part, As of Junit 4 there is no such feature. I have heard with Junit 5 it should be possible to generate the test report. Could someone throw some light in to this with their experience of report generation with Junit?
Asked
Active
Viewed 3,074 times
2 Answers
1
As I mentioned in How to create an HTML report for JUnit 5 tests?, the JUnit Platform Gradle Plugin and ConsoleLauncher
already generate JUnit 4 style XML reports.
This is done by the XmlReportWriter which is used by the XmlReportsWritingListener. The latter is simply an implementation of TestExecutionListener
.
So, if you want to generate custom reports, you can simply implement your own TestExecutionListener
and take inspiration from the XmlReportWriter
and XmlReportsWritingListener
.
Regards,
Sam (Core JUnit 5 committer)

Community
- 1
- 1

Sam Brannen
- 29,611
- 5
- 104
- 136
0
If your project is maven bases, then why not try surefire plugin. doc here - http://maven.apache.org/surefire/maven-surefire-report-plugin/report-mojo.html

user3138997
- 230
- 1
- 10