Grails 2.4 and Spock integration tests

257 views
Skip to first unread message

Igor Artamonov

unread,
Oct 16, 2014, 12:54:59 PM10/16/14
to grails-de...@googlegroups.com
I've tried to upgraded my application to Grails 2.4.3 and now my spock tests are failing with:
| Failure:  xxx.SomeIntegrationSpec
|  java.lang.NoClassDefFoundError: org/codehaus/groovy/grails/commons/ApplicationHolder
 at grails
.plugin.spock.IntegrationSpec.$spock_initializeSharedFields(IntegrationSpec.groovy)


Do I need to add extra configuration, change something in my tests, or Spock is incompatible with Grails 2.4? 

Igor Artamonov

unread,
Oct 16, 2014, 1:20:08 PM10/16/14
to grails-de...@googlegroups.com


Peter Niederwieser just told me that Grails 2.3+ should support Spock tests out of box. But if I remove test ":spock:0.7" and "org.spockframework:spock-grails-support:0.7-groovy-2.0" from dependencies if fails with:
| Error Error executing script TestApp: java.lang.ClassNotFoundException: grails.plugin.spock.test.GrailsSpecTestType (Use --stacktrace to see the full trace)


So how to use Spock tests for Grails 2.4.3? Docs only says that "The Grails Spock Plugin is one plugin that adds new test types to Grails." without providing any details.

Hans Bogaards

unread,
Oct 16, 2014, 1:43:20 PM10/16/14
to grails-de...@googlegroups.com
When upgrading a grails application, I always create an empty project with the new grails version. And then compare the config files of my application with those of the empty project.

That should help finding which plugins and dependencies you need to use Spock tests in the new version.
--
Hans
--
Sent from my Moto G with K-9 Mail. Please excuse my brevity.

Igor Artamonov

unread,
Oct 16, 2014, 2:06:38 PM10/16/14
to grails-de...@googlegroups.com

Oh, I found the problem, test "org.spockframework:spock-grails-support:0.7-groovy-2.0" dependency is still required. But plugin dependency test ":spock:0.7" should be removed

Igor Artamonov

unread,
Oct 16, 2014, 2:15:05 PM10/16/14
to grails-de...@googlegroups.com
Oh, not so easy, just returned to first state. 

org.spockframework:spock-grails-support:0.7-groovy-2.0 is incompatible with Grails 2.4. So I can't use it as a dependency. But without it i'm getting ClassNotFoundException:grails.plugin.spock.test.GrailsSpecTestType
I don't understand what to use then.

PS sorry, spent 2 days on trying to upgrade grails, it's driving me crazy :(

Igor Artamonov

unread,
Oct 16, 2014, 2:34:16 PM10/16/14
to grails-de...@googlegroups.com
It was because of 3rd party in-place plugin, 2 levels down. That plugin has test ':spock:0.6' { export = false } but seems that Grails simply ignores export = false for inplace plugins, so I got this weirdness.

Eduardo Solanas

unread,
Oct 23, 2014, 12:01:12 PM10/23/14
to grails-de...@googlegroups.com
Same here, to be honest they should provide a better way to do that it is very tidious

Antonio de la Torre

unread,
Oct 23, 2014, 3:47:48 PM10/23/14
to grails-de...@googlegroups.com

Igor, Thanks for sharing all your steps! ;-)

El 16/10/2014 20:34, "Igor Artamonov" <igor.ar...@gmail.com> escribió:
It was because of 3rd party in-place plugin, 2 levels down. That plugin has test ':spock:0.6' { export = false } but seems that Grails simply ignores export = false for inplace plugins, so I got this weirdness.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-disc...@googlegroups.com.
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/8104256c-10bc-4fbf-ab00-6ee9a3189ea0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages