Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Improve test log output

Rich Turner15c5d2ccedb6
diff --git a/test/build.gradle b/test/build.gradle
index 4cc5b8c43..36de55489 100644
--- a/test/build.gradle
+++ b/test/build.gradle
@@ -1,3 +1,6 @@
+import org.gradle.api.tasks.testing.logging.TestExceptionFormat
+import org.gradle.api.tasks.testing.logging.TestLogEvent
+
apply plugin: "java"
apply plugin: "groovy"
@@ -23,9 +26,36 @@ dependencies {
test {
workingDir = findProject(":openremote") != null ? resolveProject("").projectDir : rootProject.projectDir
+ outputs.upToDateWhen {false}
testLogging {
- outputs.upToDateWhen {false}
- // Enable this to show STDOUT/STDERR on console when running tests
- // showStandardStreams = true
+ // set options for log level LIFECYCLE
+ events TestLogEvent.FAILED,
+ TestLogEvent.PASSED,
+ TestLogEvent.SKIPPED
+ 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
+ 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))
+ }
+ }
}
}