From 595f1784c71917fb41a8df8226c9b8850ae1298f Mon Sep 17 00:00:00 2001 From: Stephen Friedrich Date: Wed, 24 Oct 2018 14:20:54 +0200 Subject: [PATCH] Moved test failure message to a build listener, so that the message appears last in the output --- build.gradle | 31 ++++++++++++++++++------------- gradlew | 0 2 files changed, 18 insertions(+), 13 deletions(-) mode change 100644 => 100755 gradlew diff --git a/build.gradle b/build.gradle index afeaa38..d536477 100644 --- a/build.gradle +++ b/build.gradle @@ -68,17 +68,22 @@ task testReport(type: TestReport) { testResultDirs = files("$buildDir/test-results/test/binary", "$buildDir/test-results/testNg/binary") group = 'verification' description = 'Generates a consolidated test report for both JUnit and TestNG tests' - - doLast { - if (testFailureCount > 0) { - def failureText = (project.testFailureCount == 1 - ? 'was one test failure' - : "were ${project.testFailureCount} test failures" - ) - def msg = "There " + failureText + " - see report at file://${testReportDir}/index.html" - println "#" * msg.length() - println msg - println "#" * msg.length() - } - } } + +gradle.buildFinished { + if (project.testFailureCount > 0) { + def failureText = (project.testFailureCount == 1 + ? 'was one test failure' + : "were ${project.testFailureCount} test failures" + ) + def msg1 = "There " + failureText + " in ${project.name}." + def msg2 = "See report at file://${testReportDir}/index.html" + def len = Math.max(msg1.length(), msg2.length()) + println "" + println "#" * len + println msg1 + println msg2 + println "#" * len + println "" + } +} \ No newline at end of file diff --git a/gradlew b/gradlew old mode 100644 new mode 100755