Functional tests failing after upgrade to Grails 2.3.6 - Method on class was used outside of a Grails application.

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

Functional tests failing after upgrade to Grails 2.3.6 - Method on class was used outside of a Grails application.

Dave Klein-2
All of our functional tests (Geb 0.9.2.) are failing after upgrading to Grails 2.3.6.  We get the following error:

Method on class [domain class name] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.
In most of the tests, the error is in the setup method when a static method of a domain class is being called. 

I've already updated the BuildConfig as recommended, concerning Tomcat and Hibernate (7.0.50.1 and 3.6.10.8).  I've been working on this upgrade for a while now and have all of our unit and integration tests passing.  Also, moving around in our app, all seems well.  Now, it's just the functional tests.  

Any thoughts or ideas would be appreciated.

Thanks,
Dave
Reply | Threaded
Open this post in threaded view
|

Re: Functional tests failing after upgrade to Grails 2.3.6 - Method on class was used outside of a Grails application.

Graeme Rocher-2
An example attached to a JIRA issue would help

On Mon, Feb 24, 2014 at 5:45 PM, Dave Klein
<[hidden email]> wrote:

> All of our functional tests (Geb 0.9.2.) are failing after upgrading to
> Grails 2.3.6.  We get the following error:
>
> Method on class [domain class name] was used outside of a Grails
> application. If running in the context of a test using the mocking API or
> bootstrap Grails correctly.
>
> In most of the tests, the error is in the setup method when a static method
> of a domain class is being called.
>
> I've already updated the BuildConfig as recommended, concerning Tomcat and
> Hibernate (7.0.50.1 and 3.6.10.8).  I've been working on this upgrade for a
> while now and have all of our unit and integration tests passing.  Also,
> moving around in our app, all seems well.  Now, it's just the functional
> tests.
>
> Any thoughts or ideas would be appreciated.
>
> Thanks,
> Dave



--
Graeme Rocher
Grails Project Lead
SpringSource

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Functional tests failing after upgrade to Grails 2.3.6 - Method on class was used outside of a Grails application.

rsom@certifydatasystems.com
Could this be a regression of http://jira.grails.org/browse/GRAILS-8638?

R,
rahul

On Feb 24, 2014, at 10:39 AM, Graeme Rocher <[hidden email]> wrote:

An example attached to a JIRA issue would help

On Mon, Feb 24, 2014 at 5:45 PM, Dave Klein
<[hidden email]> wrote:
All of our functional tests (Geb 0.9.2.) are failing after upgrading to
Grails 2.3.6.  We get the following error:

Method on class [domain class name] was used outside of a Grails
application. If running in the context of a test using the mocking API or
bootstrap Grails correctly.

In most of the tests, the error is in the setup method when a static method
of a domain class is being called.

I've already updated the BuildConfig as recommended, concerning Tomcat and
Hibernate (7.0.50.1 and 3.6.10.8).  I've been working on this upgrade for a
while now and have all of our unit and integration tests passing.  Also,
moving around in our app, all seems well.  Now, it's just the functional
tests.

Any thoughts or ideas would be appreciated.

Thanks,
Dave



--
Graeme Rocher
Grails Project Lead
SpringSource

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Functional tests failing after upgrade to Grails 2.3.6 - Method on class was used outside of a Grails application.

loic911
In reply to this post by Dave Klein-2
Hi,

I sometimes had this error when running functional tests too after upgrading to 2.3.5.
In my case, it appear when I run more than one grails project (from the same grails version) at the same time (let says test-app project 1 during run-app project 2, using intellij).

Sometimes simply closing the second project works.
Sometimes a "grails clean" or sometimes deleteing ".grails/$version" make it works too.

Loïc
Reply | Threaded
Open this post in threaded view
|

Re: Functional tests failing after upgrade to Grails 2.3.6 - Method on class was used outside of a Grails application.

alex_albr
In reply to this post by Graeme Rocher-2
Hi,
I have raised a Issue with an attached example
https://jira.grails.org/browse/GRAILS-11546
Reply | Threaded
Open this post in threaded view
|

Re: Functional tests failing after upgrade to Grails 2.3.6 - Method on class was used outside of a Grails application.

Shikha Garg
In reply to this post by Dave Klein-2
As per new grails changes, you should try following. It worked for me.

While mocking domain methods or service methods, always give correct parameter type. Eg:
 
def mockTestData = mockFor(TestData)
mockTestData.demand.static.get(){long x ->
//return something
}



Thanks,
Shikha