Slackbot
12/14/2023, 3:06 PMVampire
12/14/2023, 3:22 PMjacoco-report-aggregation is mainly for aggregating reports from multiple projects per test type, so all test in one report and all integTest in another report. It does not have built-in support to do an overall report. If you only have that one project, you can simple add one JacocoReport task and configure its execution data to be the one of both test tasks.
The more fancy approach that would also work for multiple projects is something like this:
plugins {
`jacoco-report-aggregation`
}
[...]
val coverageDataElementsForAllTests by configurations.creating {
description = "Binary data files containing results of Jacoco test coverage reporting for all test suite targets."
isVisible = false
isCanBeResolved = false
isCanBeConsumed = true
attributes {
attribute(CATEGORY_ATTRIBUTE, objects.named(VERIFICATION))
attribute(TEST_SUITE_TYPE_ATTRIBUTE, objects.named("all"))
attribute(VERIFICATION_TYPE_ATTRIBUTE, objects.named(JACOCO_RESULTS))
}
}
[...]
testing {
suites {
withType<JvmTestSuite>().configureEach {
targets.configureEach {
coverageDataElementsForAllTests.outgoing.artifact(testTask.map { it.the<JacocoTaskExtension>().destinationFile }) {
type = BINARY_DATA_TYPE
}
}
}
}
}
}
[...]
reporting {
reports {
val overallCodeCoverageReport by registering(JacocoCoverageReport::class) {
testType.set("all")
}
}
}Simon Kågedal Reimer
12/14/2023, 3:28 PMand configure its execution dataI think this was the word I needed! 😄 Thanks, I'll try the simple approach and see where it gets me!