I am using Spock to testing with groovy and I want a custom test rule on fail. First i did that with MethodRule which is deprecated now. So I tried TestWacher but Spock caches Exceptions before my rule can cache it.
public class SimpleOnFailed extends TestWatcher {
@Override
protected void failed(Throwable e, Description description) {
print "Prints when test fails"
}
}
and it never prints my print statement from failed method.