Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is IntegrationSpec in Grails 3

In middle of upgrading to Grails 3.0.1. All good except for integration testing which worked well in 2.4.4.

I've noticed grails.test.spock.IntegrationSpec is not there in org.grails:grails-test:3.0.1 any more.

Tried extending spock.lang.Specification and running via Gradle integrationTest task however it didn't seems to inject Spring resources. Also tried @Integration getting same error, additionally complained by GGTS:

General error during canonicalization: Provider "data" not installed java.nio.file.FileSystemNotFoundException: Provider "data" not installed at java.nio.file.Paths.get(Paths.java:147) at  
org.grails.io.support.MainClassFinder.searchMainClass(MainClassFinder.groovy:37) at 
org.grails.compiler.injection.test.IntegrationTestMixinTransformation.visit(IntegrationTestMixinTransformation.groovy:82) at 
org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:150) at org.codehaus.groovy.transform.ASTTransformationVisitor
...

So I'm wondering if IntegrationSpec still exists in 3.0. How should I get it work?

like image 853
ericbado Avatar asked Dec 25 '22 20:12

ericbado


1 Answers

Alright, figured out @Integration should be applied and to resolve the compilation error I had to specify @Integration(applicationClass = Application.class) because somehow the IDE couldn't find Application class. Of course the test case should extend Specification.

@Autowired to be used for objects that need to be injected into your test classes. Can't use @Autowired in conjunction with @Shared, which you can do in 2.x.

like image 156
ericbado Avatar answered Jan 03 '23 04:01

ericbado