Jul 29th, 2012, 07:11 PM
GGTS3.0.0M3 Integration Spock tests not running
I have a number of Spock Unit Tests that run fine in the IDE when you do a Run As->JUnit Test.
But my Spock Integration Test doesn't run at all. When I run it, I get the following error:
java.lang.NullPointerException: Cannot get property 'mainContext' on null object
at grails.plugin.spock.IntegrationSpec.$spock_initial izeSharedFields(IntegrationSpec.groovy)
This is what happens from the command line when you run JUnit tests and Spock tests together, so I suspect that it's being treated as a pure JUnit test instead of as a Spock test?
The class extends grails.plugin.spock.IntegrationSpec instead of spock.lang.Specification. When I change the extends to Specification, then it gets much further along but that doesn't work since the vanilla Specification doesn't provide integration test support.
Jul 30th, 2012, 07:21 AM
A few questions for you:
1. I assume this is a grails project. What grails version?
2. If this is a grails project, you cannot run integration tests through Run As -> JUnit Test. You must Use Run as -> Grails command (test app). What happens when you try this?
If this doesn't help, then...
3. What STS version?
4. What spock version?
5. Do you have a full stack trace?
6. Where is the stack trace being displayed? In the console or in the Eclipse error log?
7. What is the command you are running on the command line to get this to run?