Skip to content

Commit 5a434d9

Browse files
committed
Tweak aggregated reports setup
1 parent f0737d9 commit 5a434d9

File tree

3 files changed

+53
-6
lines changed

3 files changed

+53
-6
lines changed

gradle/plugins/src/main/kotlin/org.example.gradle.feature.test-end-to-end.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ tasks.named("mockApiJar") { group = null }
99

1010
// end-to-end tests
1111
testing.suites.create<JvmTestSuite>("testEndToEnd") {
12+
testType = TestSuiteType.FUNCTIONAL_TEST
1213
targets.named("testEndToEnd") {
1314
testTask {
1415
group = "build"

gradle/plugins/src/main/kotlin/org.example.gradle.report.code-coverage.gradle.kts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,33 @@ plugins {
55
id("org.example.gradle.base.lifecycle")
66
}
77

8+
// Make aggregation "classpath" use the platform for versions (gradle/versions)
89
configurations.aggregateCodeCoverageReportResults { extendsFrom(configurations["internal"]) }
910

10-
tasks.check {
11-
// Generate report when running 'check'
12-
dependsOn(tasks.testCodeCoverageReport)
11+
// Integrate FUNCTIONAL_TEST results into the aggregated UNIT_TEST coverage results
12+
tasks.testCodeCoverageReport {
13+
reports.html.outputLocation = layout.buildDirectory.dir("reports/coverage")
14+
reports.xml.outputLocation = layout.buildDirectory.file("reports/coverage.xml")
15+
executionData.from(
16+
configurations.aggregateCodeCoverageReportResults
17+
.get()
18+
.incoming
19+
.artifactView {
20+
withVariantReselection()
21+
attributes {
22+
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.VERIFICATION))
23+
attribute(TestSuiteType.TEST_SUITE_TYPE_ATTRIBUTE, objects.named(TestSuiteType.FUNCTIONAL_TEST))
24+
attribute(TestSuiteTargetName.TEST_SUITE_TARGET_NAME_ATTRIBUTE, objects.named("testEndToEnd"))
25+
attribute(
26+
VerificationType.VERIFICATION_TYPE_ATTRIBUTE,
27+
objects.named(VerificationType.JACOCO_RESULTS)
28+
)
29+
attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.BINARY_DATA_TYPE)
30+
}
31+
}
32+
.files
33+
)
1334
}
35+
36+
// Generate report when running 'check'
37+
tasks.check { dependsOn(tasks.testCodeCoverageReport) }

gradle/plugins/src/main/kotlin/org.example.gradle.report.test.gradle.kts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,35 @@ plugins {
55
id("org.example.gradle.base.lifecycle")
66
}
77

8+
// Make aggregation "classpath" use the platform for versions (gradle/versions)
89
configurations.aggregateTestReportResults { extendsFrom(configurations["internal"]) }
910

10-
tasks.check {
11-
// Generate report when running 'check'
12-
dependsOn(tasks.testAggregateTestReport)
11+
// Integrate FUNCTIONAL_TEST results into the aggregated UNIT_TEST test results
12+
tasks.testAggregateTestReport {
13+
destinationDirectory = layout.buildDirectory.dir("reports/tests")
14+
testResults.from(
15+
configurations.aggregateTestReportResults
16+
.get()
17+
.incoming
18+
.artifactView {
19+
withVariantReselection()
20+
attributes {
21+
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.VERIFICATION))
22+
attribute(TestSuiteType.TEST_SUITE_TYPE_ATTRIBUTE, objects.named(TestSuiteType.FUNCTIONAL_TEST))
23+
attribute(TestSuiteTargetName.TEST_SUITE_TARGET_NAME_ATTRIBUTE, objects.named("testEndToEnd"))
24+
attribute(
25+
VerificationType.VERIFICATION_TYPE_ATTRIBUTE,
26+
objects.named(VerificationType.TEST_RESULTS)
27+
)
28+
}
29+
}
30+
.files
31+
)
1332
}
1433

34+
// Generate report when running 'check'
35+
tasks.check { dependsOn(tasks.testAggregateTestReport) }
36+
1537
// Clear tasks group 'build' from clutter for a clean set of tasks to be used in daily work
1638
tasks.buildDependents { setGroup(null) }
1739

0 commit comments

Comments
 (0)