Perform some action when spec fails in Spock Framework

Let’s imagine that we need to perform a certain sequence of actions when a spec fails. If you just need to close some resources when spec fails – don’t reinvent the wheel and use an easy and correct method – @AutoCleanup annotation. I wrote about it in detail earlier: https://mchesnavsky.tech/closing-resources-in-spock-framework. Keep in mind that in […]

READ MORE

Closing resources in Spock Framework

If we have any resource and we need to close it when current spec fails or done (for example, ZooKeeper client), the easiest way is to use the @AutoCleanup annotation with the resource: By default, it calls the close() method, but you can put your own: And optionally use quiet mode, when Spock Framework are going […]

READ MORE