Skip to content

Commit

Permalink
Tweak aggregated reports setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jjohannes committed Jun 23, 2024
1 parent f0737d9 commit 7d50ed1
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ tasks.named("mockApiJar") { group = null }

// end-to-end tests
testing.suites.create<JvmTestSuite>("testEndToEnd") {
testType = TestSuiteType.FUNCTIONAL_TEST
targets.named("testEndToEnd") {
testTask {
group = "build"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,33 @@ plugins {
id("org.example.gradle.base.lifecycle")
}

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

tasks.check {
// Generate report when running 'check'
dependsOn(tasks.testCodeCoverageReport)
// Integrate FUNCTIONAL_TEST results into the aggregated UNIT_TEST coverage results
tasks.testCodeCoverageReport {
reports.html.outputLocation = layout.buildDirectory.dir("reports/coverage")
reports.xml.outputLocation = layout.buildDirectory.file("reports/coverage.xml")
executionData.from(
configurations.aggregateCodeCoverageReportResults
.get()
.incoming
.artifactView {
withVariantReselection()
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.VERIFICATION))
attribute(TestSuiteType.TEST_SUITE_TYPE_ATTRIBUTE, objects.named(TestSuiteType.FUNCTIONAL_TEST))
attribute(TestSuiteTargetName.TEST_SUITE_TARGET_NAME_ATTRIBUTE, objects.named("testEndToEnd"))
attribute(
VerificationType.VERIFICATION_TYPE_ATTRIBUTE,
objects.named(VerificationType.JACOCO_RESULTS)
)
attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.BINARY_DATA_TYPE)
}
}
.files
)
}

// Generate report when running 'check'
tasks.check { dependsOn(tasks.testCodeCoverageReport) }
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,35 @@ plugins {
id("org.example.gradle.base.lifecycle")
}

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

tasks.check {
// Generate report when running 'check'
dependsOn(tasks.testAggregateTestReport)
// Integrate FUNCTIONAL_TEST results into the aggregated UNIT_TEST test results
tasks.testAggregateTestReport {
destinationDirectory = layout.buildDirectory.dir("reports/tests")
testResults.from(
configurations.aggregateTestReportResults
.get()
.incoming
.artifactView {
withVariantReselection()
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.VERIFICATION))
attribute(TestSuiteType.TEST_SUITE_TYPE_ATTRIBUTE, objects.named(TestSuiteType.FUNCTIONAL_TEST))
attribute(TestSuiteTargetName.TEST_SUITE_TARGET_NAME_ATTRIBUTE, objects.named("testEndToEnd"))
attribute(
VerificationType.VERIFICATION_TYPE_ATTRIBUTE,
objects.named(VerificationType.TEST_RESULTS)
)
}
}
.files
)
}

// Generate report when running 'check'
tasks.check { dependsOn(tasks.testAggregateTestReport) }

// Clear tasks group 'build' from clutter for a clean set of tasks to be used in daily work
tasks.buildDependents { setGroup(null) }

Expand Down

0 comments on commit 7d50ed1

Please sign in to comment.