On 8 May 2017, at 18:49, clr meno wrote:
> Thanks for your response Jeff!
>
> I followed the following steps and got the exception given below when
> I ran
> the Integration test case:
> 1) grails create-plugin example
> 2) created a dummy domain class Book
> 3)grails create-integration-test book
> 4)Executed the integration test file
>
>
> On running the integration test case file "BookIntegrationSpec"
> (extends
> IntegrationSpec) the following error gets thrown:
>
> "java.lang.IllegalStateException: Could not find ApplicationContext,
> configure Grails correctly first
>
> at grails.util.Holders.getApplicationContext(Holders.java:97)
> at
> grails.test.spock.IntegrationSpec.$spock_initializeSharedFields(IntegrationSpec.groovy:41)"
> gets thrown.
>
Earlier in the thread you were talking about testing services. The
above doesn’t say anything about services. The test at
https://github.com/jeffbrown/clrmeno/blob/master/test/integration/demo/BookServiceIntegrationSpec.groovy
seems to run fine. (Note that is a Grails 2.4.4 project so you cannot
use Java 8)
Without knowing what you are trying to do, it can be difficult to say
what is wrong. I suspect there is something wrong in the project but
without being able to reproduce the problem, I can’t say. As I said
in my earlier note, if you could share a project which demonstrates the
problem that you described earlier in the thread, that would make it
easier to troubleshoot. That would make better use of other people’s
time rather than having folks try to guess at what you are doing.