Is there already a possibility to generate an HTML report when JUnit tests were started via Gradle? Any hint or comment is appreciated.
相关问题
- Could not read entry … from cache taskArtifacts.bi
- Dependencies while implementing Mocking in Junit4
- Configure gradle plugin based on future tasks
- How to fix the error Cannot change strategy of con
- Include pom.xml in Jar with gradle
相关文章
- Android BuildConfig Field generating String incorr
- Setup and Tear Down of Complex Database State With
- JUnit continue to assert things after expected exc
- Gradle Could not find method “() for arguments on
- Gradle Custom Plugin: gradleApi() vs Explicit Depe
- Android Studio 3.5 ERROR: Unable to resolve depend
- How to specify @category in test task in gradle?
- How to clean your build with Flutter RP2 in Androi
UPDATE
Gradle 4.6 provides built-in support for the JUnit Platform which allows you to run JUnit Jupiter tests using the standard Gradle
test
task which generates HTML reports out of the box.Answer for Gradle versions prior to 4.6
The JUnit Platform Gradle Plugin generates JUnit 4 style XML test reports.
These XML files are output to
build/test-results/junit-platform
by default.So, if your build server knows how to parse JUnit 4 style XML reports, you can just point it to the XML files in that directory and let the build server generate the HTML report for you.
However, if you are asking if Gradle can generate an HTML report for your tests run via the
junitPlatformTest
task, then the answer is "No, unfortunately not." The reason is that the standard Gradletest
task only generates HTML reports based on its own proprietary "binary" report format. Since thejunitPlatformTest
task does not generate reports in Gradle's binary format, Gradle itself cannot generate HTML reports for JUnit Platform tests.Having said that, however, there is in fact a work around: you can use Ant within your Gradle build. Ant has a task for aggregating JUnit 4 based XML reports and generating an HTML report from those aggregated reports. The output is not very modern, but it is at least human readable. The downside is that the default XSLT stylesheet does not display the test class names for tests run via the JUnit Platform.
In any case, you can configure Ant's JUnitReport task in Gradle as follows.
Then, executing
gradle check
will generate an HTML report inbuild/test-reports/index.html
.Regards,
Sam (Core JUnit 5 committer)
Yes, you can using Jacoco plugin.
Here is an example:
Regards.
Adding below line to my java command created
TEST-junit-jupiter.xml
in mytarget/test-result
folder. This xml file has all info about number of testcases run, number of tests passed/failed etc