Hi,
Our integration tests take a while to run and we are looking to have some sort of fail fast mechanism to save us an ample amount of time. We will like to fail the build once we encounter the first failing test.
In searching, I stumbled upon:
-and-
https://issues.gradle.org/browse/GRADLE-1518
I see on the docs you can hook on to the test listeners. Trying this is still not working for me
test {
...
//fail fast hook
afterTest { descriptor, result ->
if (result.getResultType().equals(TestResult.ResultType.FAILURE)) {
println "$descriptor.name: ${result.getResultType()}... fast failing build!"
throw new RuntimeException("Fast failing build!")
}
}
}
Can you please help shed some light on what I am doing wrong. I see the test is in failed status, the exception is thrown, but the build still continues. I’ll like to halt it on test failures.
Also, will the same work in terms of parallel build executions? i.e. when you have set maxParallelForks to be more than 1