When I run gradlew test jacocoTestReport
the task jacocoTestReport runs and I get a a test report.
When I run gradlew integTest jacocoTestReport
the task jacocoTestReport is skipped.
Here's the relevant excerpts from my build.gradle:
apply plugin: 'jacoco'
jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
doLast {
println 'See report at: file://' + projectDir + '/build/reports/jacoco/test/html/index.html'
}
}
test {
filter {
// only run tests ending in *UnitTest
includeTestsMatching "*UnitTest"
}
}
task integTest(type: Test) {
filter {
includeTestsMatching "*IntegTest"
}
jacoco {
destinationFile = file("$buildDir/jacoco/integTest.exec")
classDumpFile = file("$buildDir/classes")
}
}
The gradle documentation doesn't help me here, and extensive googling hasn't produced any results, either.
Any ideas how I can make jacoco do reports for my intergration tests?
EDIT: Unit- & Integration-Tests are in the same directories, they are distinguished by their filenames, just in case that wasn't clear.
Turns out, this works:
I hope this is helpful :)
EDIT: This needs to be later in the file than the definition of the integTest task.
I have the whole jacoco-configuration at the end of my build.gradle.