Skip to content

Commit

Permalink
Moved test failure message to a build listener, so that the message
Browse files Browse the repository at this point in the history
   appears last in the output
  • Loading branch information
Stephen Friedrich committed Oct 24, 2018
1 parent 5ab9258 commit 595f178
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
}
}
Empty file modified gradlew
100644 → 100755
Empty file.

0 comments on commit 595f178

Please sign in to comment.