unbroken-dome / gradle-testsets-plugin

A plugin for the Gradle build system that allows specifying test sets (like integration or acceptance tests).
MIT License
230 stars 50 forks source link

Support for JaCoCo configuration for higher testing levels #75

Closed rkrisztian closed 5 years ago

rkrisztian commented 5 years ago

I think it would be a useful feature to detect if the official Gradle JaCoCo plugin is applied to the project, and if yes, to apply a reporter task to all test classes created by the testsets plugin. For example like this:

task(type: JacocoReport, "jacoco${integrationTest.name.capitalize()}Report") {
    group integrationTest.group // Or if you prefer: LifecycleBasePlugin.VERIFICATION_GROUP
    description "Generates code coverage report for the ${integrationTest.name} task."
    executionData integrationTest
    sourceSets sourceSets.main
}

For me this worked nicely, as some other defaults are configured by the JaCoCo plugin.

tkrullmann commented 5 years ago

Nice idea. I will look into it.

I suppose this only concerns the JacocoReport task since the jacoco plugin should already attach itself to all tasks of type Test?

rkrisztian commented 5 years ago

Yes, that's right, you can verify that behavior in the plugin source (linked the latest tag): https://github.com/gradle/gradle/blob/v5.5.0-RC2/subprojects/jacoco/src/main/java/org/gradle/testing/jacoco/plugins/JacocoPlugin.java#L150

tkrullmann commented 5 years ago

Implemented in v2.2.0