Using Grails Spock plugin for 2.0.3. Unit tests are running fine, but struggling to set up integration tests.I believe I should extend IntegrationSpec, correct?
Is anything autowired for me? for example if I need a service, do I just declare it, or do I need to new it up?
Also, what about integration testing controllers, so I can test the whole stack? How do I access the request and add a param to it?
If you need auto wiring and data isolation, yes.On 30/04/2012, at 10:14 AM, David Hay wrote:
Using Grails Spock plugin for 2.0.3. Unit tests are running fine, but struggling to set up integration tests.I believe I should extend IntegrationSpec, correct?Yes, just declare it.
Is anything autowired for me? for example if I need a service, do I just declare it, or do I need to new it up?
See the testing controllers section of http://grails.org/doc/latest/guide/testing.html#integrationTesting
Also, what about integration testing controllers, so I can test the whole stack? How do I access the request and add a param to it?
It's the same, except you extend IntegrationSpec. I'm sorry I don't have more complete examples for you on hand.
class
TestControllerSpec extends IntegrationSpec {def
testController def setUp = {println controller
println
testController}
def "test controller exists" () {setup:
println
testControllerwhen:
1 == 1then:
true}
}
However, both controller and testController are always null.
I'm at a loss - this should work, right? Can you see anything I'm missing? Can you point me to where to start to debug this?
thanks,
David
--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To post to this group, send email to spockfr...@googlegroups.com.
To unsubscribe from this group, send email to spockframewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spockframework?hl=en.
Did you get anywhere with this?I'm having the same problem.
To unsubscribe from this group and stop receiving emails from it, send an email to spockframewor...@googlegroups.com.
To post to this group, send email to spockfr...@googlegroups.com.
Visit this group at http://groups.google.com/group/spockframework?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.