Better unit test output

This commit is contained in:
Ceikry 2022-05-02 03:59:24 +00:00 committed by Ryan
parent fc633160ee
commit b06c69136f

View file

@ -46,6 +46,20 @@ test {
useJUnitPlatform()
dependsOn cleanTest
testLogging.showStandardStreams = true
testLogging {
events "passed", "skipped", "failed"
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))
}
}
}
}
/*sourceSets {
@ -58,4 +72,4 @@ jar {
attributes 'Main-Class': 'rs09.Server'
}
from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
}
}