I'm new to the Spock framework, and I have an issue with using an abstract java test class with it.
What I would like to have is a groovy test class, which extends some other java abstract class with some common methods, which in turn extends Specification class.
So, the code is as follows:
class GroovyTest extends AbstractTest {
def "my test"() {
....
}
}
public abstract class AbstractTest extends Specification {
...
some common methods
...
}
When I ran the GroovyTest class I'm getting the following error:
org.spockframework.runtime.InvalidSpecException: Specification 'org.my.package.AbstractTest' was not compiled properly (Spock AST transform was not run); try to do a clean build
When I'm using a groovy abstract class then it works without errors.
So my question is there a way to use Java class with Spock framework?
Spock is a DSL Groovy based testing language. It executes transformations (AST) to canonical Groovy code before test execution. In your case you try to write Java-based Spock test. Spock can't execute AST transformations from canonical Java code and throws IvalidSpecException.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.