38 lines
1.5 KiB
Groovy
38 lines
1.5 KiB
Groovy
|
|
// pretty print test results
|
|
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
|
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
|
tasks.withType(Test) {
|
|
testLogging {
|
|
|
|
events TestLogEvent.FAILED,
|
|
TestLogEvent.PASSED,
|
|
TestLogEvent.SKIPPED,
|
|
TestLogEvent.STANDARD_OUT
|
|
exceptionFormat TestExceptionFormat.FULL
|
|
showExceptions true
|
|
showCauses true
|
|
showStackTraces true
|
|
|
|
debug {
|
|
events TestLogEvent.STARTED,
|
|
TestLogEvent.FAILED,
|
|
TestLogEvent.PASSED,
|
|
TestLogEvent.SKIPPED,
|
|
TestLogEvent.STANDARD_ERROR,
|
|
TestLogEvent.STANDARD_OUT
|
|
exceptionFormat TestExceptionFormat.FULL
|
|
}
|
|
info.events = debug.events
|
|
info.exceptionFormat = debug.exceptionFormat
|
|
|
|
afterSuite { desc, result ->
|
|
if (!desc.parent) { // will match the outermost suite
|
|
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
|
|
def startItem = '| ', endItem = ' |'
|
|
def repeatLength = startItem.length() + output.length() + endItem.length()
|
|
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
|
|
}
|
|
}
|
|
}
|
|
} |