Generating aggregate `TestReport` even on failure

Hi —

I’m trying to generate an aggregate test report in a multi project build. I’d like to have the report generated even on failure. I’m using the following snippet and running via the --continue flag. However the aggregate report is not generated. Can someone help?

task allTests(type: TestReport) {
  reportOn subprojects*.test
  destinationDir = file("${project.buildDir}/reports/tests/allTests")
}

Thanks for you time.

I know this post is very old but I ran into a similar issue today and was able to get aggregate reports with --continue using task finalizers:

    tasks.create('testReport', TestReport) {
        destinationDir = file("${buildDir}/reports/allTests")
    }
    // this ensures the allTests report is generated without creating a dependency on
    // the test tasks which allows the aggregated test reports to be generated even when
    // there are test failures when running with the --continue flag
    tasks.withType(Test).all { Test testTask ->
        tasks.testReport.reportOn testTask.binaryResultsDirectory.locationOnly
        testTask.finalizedBy tasks.testReport
    }

You would need to adjust it for dealing with your subprojects, but I think it should work.