I want to register a Listener to all spock geb specs in my grails-app so I added a IGlobalExtension to myapp/src/groovy
package myapp.spock
class TakeScreenshotExtension implements IGlobalExtension {
@Override
void visitSpec(SpecInfo specInfo) {
System.err.println "ADDING LISTENER"
specInfo.addListener(new TakeScreenshotOnFailureListener())
}
}
Afterwards I added the org.spockframework.runtime.extension.IGlobalExtension file to myapp/src/resources/META-INF/services containing the line
myapp.spock.TakeScreenshotExtension
So now from what I understood, when running grails test-app functional:, the Extension should be loaded but I don't see the "ADDING LISTENER" anywhere in the output. What am I doing wrong?