Execute some action when Spock test fails
I'd like to execute some action when Spock test fails. Specifically, take a screenshot. Is it possible? How to do it? Tomasz Dziurko Create a listener class class ExampleListener extends AbstractRunListener { def void error(ErrorInfo error) { println "Actual on error logic" } } then add it to each specification using implementation of IGlobalExtension that is executed for each Spec class GlobalSpecExtension implements IGlobalExtension { @Override void visitSpec(SpecInfo specInfo) { specInfo.addListener(new ExampleListener()) } } and finally create file named org.spockframework.runtime