mirror of
https://github.com/zhigang1992/AndroidVideoCache.git
synced 2026-06-19 06:36:14 +08:00
display test results during testing
This commit is contained in:
@@ -28,6 +28,35 @@ android.applicationVariants.all { variant ->
|
||||
tasks["compile${productFlavor}${buildType}UnitTestSources"].dependsOn(tasks["merge${productFlavor}${buildType}Assets"])
|
||||
}
|
||||
|
||||
// display test progress http://stackoverflow.com/a/36130467/999458
|
||||
tasks.withType(Test) {
|
||||
testLogging {
|
||||
// set options for log level LIFECYCLE
|
||||
events "passed", "skipped", "failed", "standardOut"
|
||||
showExceptions true
|
||||
exceptionFormat "full"
|
||||
showCauses true
|
||||
showStackTraces true
|
||||
|
||||
// set options for log level DEBUG and INFO
|
||||
debug {
|
||||
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
|
||||
exceptionFormat "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} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
|
||||
def startItem = '| ', endItem = ' |'
|
||||
def repeatLength = startItem.length() + output.length() + endItem.length()
|
||||
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':library')
|
||||
testCompile 'org.slf4j:slf4j-simple:1.7.21'
|
||||
|
||||
Reference in New Issue
Block a user