Skip to content

Instantly share code, notes, and snippets.

@ohneda
Created December 10, 2011 00:27
Show Gist options
  • Save ohneda/1453983 to your computer and use it in GitHub Desktop.
Save ohneda/1453983 to your computer and use it in GitHub Desktop.
Print Error Log after running Tests/Specs on Grails
# Add the below into $YOUR_APP/scripts/_Events.groovy
# reference: http://d.hatena.ne.jp/masanobuimai/20090615
eventTestSuiteEnd = {type ->
new File(testReportsDir, "plain").eachFileMatch(~/.*[(Spec)|(Test)]\.txt/) { file ->
file.withReader("UTF-8") {reader ->
reader.readLine()
def line = reader.readLine()
(line =~ /.*, Failures: (\d), Errors: (\d), .*/).each {m0, m1, m2 ->
if (m1 == "0" && m2 == "0") return
println "== ${file.name} =============================================="
println line
while ((line = reader.readLine()) != null) println line
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment