woops need junitXml enabled; add result file/content reporting Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/5908f90a Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/5908f90a Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/5908f90a
Branch: refs/heads/master Commit: 5908f90ae1b090d2c52432b7af52918165835f12 Parents: 84c8d3f Author: Dale LaBossiere <[email protected]> Authored: Wed Sep 28 11:27:01 2016 -0400 Committer: Dale LaBossiere <[email protected]> Committed: Wed Sep 28 11:27:01 2016 -0400 ---------------------------------------------------------------------- build.gradle | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/5908f90a/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index 5d1d4fa..362e05c 100644 --- a/build.gradle +++ b/build.gradle @@ -437,16 +437,38 @@ subprojects { println "$project.path testing ..." } } + ext.failedTestResultPaths = [] + ext.summaryResult = null + ext.printFile = { path -> + ant.concat { fileset(file: path) } + } afterSuite { desc, result -> - if (!desc.parent) { // will match the outermost suite - def duration = String.format('%.3fsec', (result.endTime - result.startTime) / 1000) - println "$project.path $duration $result.resultType ($result.testCount tests, $result.failedTestCount failures, $result.skippedTestCount skipped)" + if (desc.parent && desc.className != null) { // individual test class result + def resultFile = "$testResultsDir/test/TEST-${desc.className}.xml" + println "Testrun results: $resultFile" + if (result.resultType == TestResult.ResultType.FAILURE) { + failedTestResultPaths.add resultFile + } + } + else { // project's overall results + summaryResult = result + } + } + doLast { + if (System.properties['edgent.build.ci'] != null) { + failedTestResultPaths.each { path -> + println path + printFile path + } } + def result = summaryResult + def duration = String.format('%.3fsec', (result.endTime - result.startTime) / 1000) + println "$project.path $duration $result.resultType ($result.testCount tests, $result.failedTestCount failures, $result.skippedTestCount skipped)" } reports { - // individual <project>/build/reports not needed with aggregate junit/jacoco reports - junitXml.enabled = System.properties['edgent.test.projectReports'] != null - html.enabled = System.properties['edgent.test.projectReports'] != null + junitXml.enabled = true // generate build/test-results/test/TEST-*.xml + // individual <project>/build/reports junit/jacoco html reports not needed with aggregate report + html.enabled = System.properties['edgent.test.project.htmlReports'] != null } doFirst { // The project's tests are supposed to run against its target-dir jar.
