Last active
January 1, 2023 13:30
-
-
Save gavvvr/bc3c384a63cabfa455d2c84fd11b5844 to your computer and use it in GitHub Desktop.
Gradle task to collect all jUnit XML test reports from all submodules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Gradle's test-report-aggregation collects only html reports in a single place and ignores XML reports | |
// Here is the custom task to collect all jUnit xml reports in a single place | |
tasks.register<Copy>("testCollectjUnitXmlReports") { | |
val allTestTasks = rootProject | |
.subprojects | |
.flatMap { it.tasks.withType<Test>() } | |
val allJunitXmlLocations = allTestTasks | |
.map { it.reports.junitXml.outputLocation.asFile.get() } | |
from(*allJunitXmlLocations.toTypedArray()) | |
into(rootProject.layout.buildDirectory.dir("test-results/test")) | |
include("*.xml") | |
mustRunAfter(*allTestTasks.toTypedArray()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment