grails - Use GORM inside spock functional test to insert data in db -
I would like to use GORM to set up test data in functional tests written with spock since I do not want to fake the behavior , So I got an exception
java.lang.IllegalStateException: The method was used outside of the Grails application on the [com.test.Person] class. If the use of the Malling API or BootStrap Grails is being correctly implemented in the context of a test
Is there any way to use the Goram in this way? I have seen the remote control plugin, but I do not want to use it and AFAIK should be in the same JVM because I start testing without the - war
switch.
BuildConfig.groovy
(see for more information), if Falb execution is enabled. You have to disable it, but you will also lose some of its other positive aspects. You have only the right option, so use it with some construction (Example from remote-control plugin: def remote = new remote control (def define) (def {} = Remote {Deaf person = new person (name: "m") person.save () person.id} // Some request some HTTP requests and check that person in DB Remote (id) .delete () }}
Comments
Post a Comment