diff --git a/build.gradle b/build.gradle index afe43b9b49..10818763c7 100644 --- a/build.gradle +++ b/build.gradle @@ -394,3 +394,28 @@ buildDeb { arch = 'all' archiveName "${packageName}-${version}.deb" } + +allprojects { + // add a collection to track failedTests + ext.failedTests = [] + + // add a testlistener to all tasks of type Test + tasks.withType(Test) { + afterTest { TestDescriptor descriptor, TestResult result -> + if(result.resultType == org.gradle.api.tasks.testing.TestResult.ResultType.FAILURE){ + failedTests << ["${descriptor.className}::${descriptor.name}"] + } + } + } + + // print out tracked failed tests when the build has finished + gradle.buildFinished { + if(!failedTests.empty){ + println "Failed tests for ${project.name}:" + failedTests.each { failedTest -> + println failedTest + } + println "" + } + } +}