IntegrationSpec with Custom plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

IntegrationSpec with Custom plugin

clr meno
I have moved all shared service files to a custom plugin and I am including it in the applications that needs these shared files, through BuildConfig.groovy. I am using Grails 2.4.4. But one of the service file has Integration tests written which is extending grails.test.spock.IntegrationSpec. On running this Integration test case it fails indicating that grailsApplication is missing. I don't have an applicationContext file as it is a plugin and not an application. Is there a way I could get the Integration test case to execute successfully with in the plugin.



Following is the error:

Fatal error running tests: Error creating bean with name 'grailsApplication': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.commons.DefaultGrailsApplication]: Constructor threw exception; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: resources (Use --stacktrace to see the full trace)
.Tests FAILED 

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/69f0c518-1e78-4585-840c-4b776c0f5b0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: IntegrationSpec with Custom plugin

clr meno
Any advise is much appreciated!

On Monday, May 8, 2017 at 9:25:01 AM UTC-4, clr meno wrote:
I have moved all shared service files to a custom plugin and I am including it in the applications that needs these shared files, through BuildConfig.groovy. I am using Grails 2.4.4. But one of the service file has Integration tests written which is extending grails.test.spock.IntegrationSpec. On running this Integration test case it fails indicating that grailsApplication is missing. I don't have an applicationContext file as it is a plugin and not an application. Is there a way I could get the Integration test case to execute successfully with in the plugin.



Following is the error:

Fatal error running tests: Error creating bean with name 'grailsApplication': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.commons.DefaultGrailsApplication]: Constructor threw exception; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: resources (Use --stacktrace to see the full trace)
.Tests FAILED 

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/df1b4066-7983-46cb-89fb-51177cb50ad0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: IntegrationSpec with Custom plugin

clr meno
Is there anyway to run Integration Tests in the custom plugin for service classes present in the plugin

On Monday, May 8, 2017 at 9:27:13 AM UTC-4, clr meno wrote:
Any advise is much appreciated!

On Monday, May 8, 2017 at 9:25:01 AM UTC-4, clr meno wrote:
I have moved all shared service files to a custom plugin and I am including it in the applications that needs these shared files, through BuildConfig.groovy. I am using Grails 2.4.4. But one of the service file has Integration tests written which is extending grails.test.spock.IntegrationSpec. On running this Integration test case it fails indicating that grailsApplication is missing. I don't have an applicationContext file as it is a plugin and not an application. Is there a way I could get the Integration test case to execute successfully with in the plugin.



Following is the error:

Fatal error running tests: Error creating bean with name 'grailsApplication': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.commons.DefaultGrailsApplication]: Constructor threw exception; nested exception is org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Class not found loading Grails application: resources (Use --stacktrace to see the full trace)
.Tests FAILED 

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/0af330d2-344c-4958-ac90-f67768931188%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: IntegrationSpec with Custom plugin

Jeff Scott Brown-4
On 8 May 2017, at 11:39, clr meno wrote:

> Is there anyway to run Integration Tests in the custom plugin for
> service
> classes present in the plugin
>

Yes.

If you could share a project which demonstrates the problem that you
described earlier in the thread, that would make it easier to
troubleshoot.




JSB

--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/08BD1206-4881-4249-95CC-061129233A32%40objectcomputing.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: IntegrationSpec with Custom plugin

clr meno
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.




On Monday, May 8, 2017 at 1:52:12 PM UTC-4, Jeff Scott Brown wrote:
On 8 May 2017, at 11:39, clr meno wrote:

> Is there anyway to run Integration Tests in the custom plugin for
> service
> classes present in the plugin
>

Yes.

If you could share a project which demonstrates the problem that you
described earlier in the thread, that would make it easier to
troubleshoot.




JSB

--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
<a href="http://www.autismspeaks.org/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.autismspeaks.org%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHLOilSQBYB1lzLN6Ms6K6DtQY5DQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.autismspeaks.org%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHLOilSQBYB1lzLN6Ms6K6DtQY5DQ&#39;;return true;">http://www.autismspeaks.org/

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/649338b1-c88a-423c-b20f-68f0dbb49dcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: IntegrationSpec with Custom plugin

Jeff Scott Brown-4
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.





JSB

--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/C5216A7B-9EB4-44CF-B2BD-7C1E50755ECD%40objectcomputing.com.
For more options, visit https://groups.google.com/d/optout.