Skip to content

Instantly share code, notes, and snippets.

@Idolon-V
Idolon-V / postpone_test_failure.gradle
Last active December 22, 2017 11:28
Gradle - ignore test failures, but obtain the final result at the end
project.gradle.taskGraph.whenReady { taskGraph ->
project.tasks.withType(Test).each { Test test ->
test.ignoreFailures = true
test.afterSuite { td, tr ->
print "Tests result: ${tr.resultType}" // one of SUCCESS, FAILURE, SKIPPED
if (td.getParent() == null) {
project.ext.testFailures = tr.getFailedTestCount()
}
// … do something basing on result …