Skip to content

Instantly share code, notes, and snippets.

@Idolon-V
Last active December 22, 2017 11:28
Show Gist options
  • Save Idolon-V/3a4252947f114d90e25d4679b2cde6ac to your computer and use it in GitHub Desktop.
Save Idolon-V/3a4252947f114d90e25d4679b2cde6ac to your computer and use it in GitHub Desktop.
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 …
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment