The beforeTest(Closure) method is just a shortcut you can use in Groovy. Ultimately, it maps the closure to receive broadcasts the same as the TestListener interface. You can clean up how you handle this vs. using the anonymous class, but essentially: