build: added fancy test logging
This commit is contained in:
parent
ddd0f2f953
commit
77be059d45
44
build.gradle
44
build.gradle
@ -18,6 +18,50 @@ test {
|
|||||||
maxParallelForks = 1
|
maxParallelForks = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Fancy live test output (from https://stackoverflow.com/questions/3963708/gradle-how-to-display-test-results-in-the-console-in-real-time)
|
||||||
|
|
||||||
|
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||||
|
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||||
|
|
||||||
|
tasks.withType(Test) {
|
||||||
|
testLogging {
|
||||||
|
// set options for log level LIFECYCLE
|
||||||
|
events TestLogEvent.FAILED,
|
||||||
|
TestLogEvent.PASSED,
|
||||||
|
TestLogEvent.SKIPPED
|
||||||
|
// TestLogEvent.STANDARD_OUT
|
||||||
|
exceptionFormat TestExceptionFormat.FULL
|
||||||
|
showExceptions true
|
||||||
|
showCauses true
|
||||||
|
showStackTraces true
|
||||||
|
|
||||||
|
// set options for log level DEBUG and INFO
|
||||||
|
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))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
jacocoTestReport {
|
jacocoTestReport {
|
||||||
reports {
|
reports {
|
||||||
html.enabled true
|
html.enabled true
|
||||||
|
Loading…
Reference in New Issue
Block a user