bmuschko / gradle-clover-plugin

Gradle plugin for generating a code coverage report using Clover
Apache License 2.0
74 stars 49 forks source link

Does this plugin work with JUnit5? #79

Closed rajanadar closed 5 years ago

rajanadar commented 7 years ago

hey @bmuschko

thanks for the plugin. quick question, does this plugin work as-is with JUnit 5 tests.

I have the following in my build.gradle

clover {
    licenseLocation = "<license path>"
    report {
        html = true
        xml = true
    }
}

when i run the gradle build cloverGenerateReport task, i get the following output.

:testClasses UP-TO-DATE
:checkstyleTest
:junitPlatformTest UP-TO-DATE
:test SKIPPED
:cloverAggregateDatabases
:cloverGenerateReport UP-TO-DATE

there is no output clover.db or any report generated anywhere.

i also tried adding the clover block within

tasks.whenTaskAdded { task ->
    if (task.name.equals('junitPlatformTest')) {
     // add clover block
}

since JUnit5 has a funky evaluation order. but no reports or invocation of the clover tasks whatsoever.

i understand that the plugin development is not active. so this is just a question to you, since i am new to Gradle and playing around with the tools around it.

does this not understand JUnit 5 output or am i missing a link?

thanks for your time.

bmuschko commented 7 years ago

No, JUnit 5 is not supported by the plugin nor does Gradle core provide native support for it.

Alex-Vol commented 7 years ago

If the Gradle core supports JUnit5 we can revisit this at that time. I do not feel strongly about working on this.

wolfie82 commented 6 years ago

@Alex-Vol Can we revisit this given:

https://docs.gradle.org/4.6-rc-2/release-notes.html#junit-5-support

wlsc commented 6 years ago

That would be helpful for Clover users.

wolfie82 commented 6 years ago

/cc @bmuschko

Alex-Vol commented 6 years ago

Pull requests welcome!

:)

I can take a look but time is precious and not going to be a quick turnaround.

Alex-Vol commented 6 years ago

After a short time experimenting the results are in. This actually works just fine with JUnit5 but the OpenClover library we rely on to generate reports appears to mistake JUnit5 test classes for application code. The result is an odd report that correctly reports coverage but lumps the test classes together with application classes and reports no test results. It does report the combined coverage of test and application code in one which is not what we want. I am not sure I have the ability to improve this situation, I did not find an open issue in the OpenClover.org site regarding this. I will probably do some more testing using just OpenClover and then produce a test case for them to chew on. We might have to hold on for that support to be available from the OpenClover team.