Gradle Merge Junit Report
You should be able to use the Ant task JUnitReport to achieve your goal. Something like the following should work:
configurations {
antJUnit
}
dependencies {
antJUnit 'org.apache.ant:ant-junit:1.9.7'
}
task mergeJUnitReports {
ext {
resultsDir = file("$buildDir/allreports")
targetDir = file("$buildDir/test-results/merged")
}
doLast {
ant.taskdef(name: 'junitreport',
classname: 'org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator',
classpath: configurations.antJUnit.asPath)
ant.junitreport(todir: resultsDir) {
fileset(dir: resultsDir, includes: 'TEST-*.xml')
report(todir: targetDir, format: 'frames')
}
}
}
Keep in mind that you will have to declare a repository to allow Gradle to resolve the ant-junit
dependency.