Skip to content

Instantly share code, notes, and snippets.

@cesarferreira
Created October 13, 2016 14:00
Show Gist options
  • Select an option

  • Save cesarferreira/98c5a4c16d39eb2a97a4f8c1e12c843b to your computer and use it in GitHub Desktop.

Select an option

Save cesarferreira/98c5a4c16d39eb2a97a4f8c1e12c843b to your computer and use it in GitHub Desktop.
Pretty print for android error logs
task testLogDecorator {
tasks.withType(Test) {
testLogging {
events "passed", "skipped", "failed", "standardOut"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
debug {
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
exceptionFormat "full"
}
afterSuite { desc, result ->
if (!desc.parent) {
def output = "$project.name test result: [TESTS: ${result.testCount}, PASSED: ${result.successfulTestCount}, FAILED: ${result.failedTestCount}, SKIPPED: ${result.skippedTestCount}]"
def startItem = '### ', endItem = ' ###'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('#' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('#' * repeatLength))
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment