grails-2.3.0 and functional test with geb, can't save an object.

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

grails-2.3.0 and functional test with geb, can't save an object.

Mauro
With grails-2.2.4 I could do something like:

@Stepwise
class CategoryCRUDSpec extends GebSpec {
    Sector sector1 = new Sector(name: "Sector1").save()
   
    def "there are no categories"() {
        when:
        to IndexPage
       
        then:
        menuTabActive.text() == "Category"
        subMenuLinkActive.text() == "Category List"
        categoryRows.size() == 0
    }

Now the same test but with grails-2.3.0 I have this error:

there are no categories(supplierregister.CategoryCRUDSpec)
|  groovy.lang.MissingMethodException: No signature of method: supplierregister.Sector.save() is applicable for argument types: () values: []
Possible solutions: save(), save(boolean), save(java.util.Map), wait(), last(), any()
    at supplierregister.CategoryCRUDSpec.$spock_initializeFields(CategoryCRUDSpec.groovy:10)
Reply | Threaded
Open this post in threaded view
|

Re: grails-2.3.0 and functional test with geb, can't save an object.

alxndrsn
I suspect this is because grails 2.3 uses separate processes for
running the server and running the functional tests.  Someone else can
confirm, but if this is the case, you'll need to use the
remote-control plugin (http://grails.org/plugin/remote-control) and
enclose your database interactions like so:

    remote { new Sector(name: "Sector1").save() }

More info at https://github.com/alkemist/grails-remote-control/

On 9 October 2013 22:43, Mauro <[hidden email]> wrote:

> With grails-2.2.4 I could do something like:
>
> @Stepwise
> class CategoryCRUDSpec extends GebSpec {
>     Sector sector1 = new Sector(name: "Sector1").save()
>
>     def "there are no categories"() {
>         when:
>         to IndexPage
>
>         then:
>         menuTabActive.text() == "Category"
>         subMenuLinkActive.text() == "Category List"
>         categoryRows.size() == 0
>     }
>
> Now the same test but with grails-2.3.0 I have this error:
>
> there are no categories(supplierregister.CategoryCRUDSpec)
> |  groovy.lang.MissingMethodException: No signature of method:
> supplierregister.Sector.save() is applicable for argument types: () values:
> []
> Possible solutions: save(), save(boolean), save(java.util.Map), wait(),
> last(), any()
>     at
> supplierregister.CategoryCRUDSpec.$spock_initializeFields(CategoryCRUDSpec.groovy:10)

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: grails-2.3.0 and functional test with geb, can't save an object.

Graeme Rocher-2
Yes, you can't do this in 2.3 without involving the grails-remote-control plugin. 

Cheers


On Thu, Oct 10, 2013 at 9:22 AM, Alex Anderson <[hidden email]> wrote:
I suspect this is because grails 2.3 uses separate processes for
running the server and running the functional tests.  Someone else can
confirm, but if this is the case, you'll need to use the
remote-control plugin (http://grails.org/plugin/remote-control) and
enclose your database interactions like so:

    remote { new Sector(name: "Sector1").save() }

More info at https://github.com/alkemist/grails-remote-control/

On 9 October 2013 22:43, Mauro <[hidden email]> wrote:
> With grails-2.2.4 I could do something like:
>
> @Stepwise
> class CategoryCRUDSpec extends GebSpec {
>     Sector sector1 = new Sector(name: "Sector1").save()
>
>     def "there are no categories"() {
>         when:
>         to IndexPage
>
>         then:
>         menuTabActive.text() == "Category"
>         subMenuLinkActive.text() == "Category List"
>         categoryRows.size() == 0
>     }
>
> Now the same test but with grails-2.3.0 I have this error:
>
> there are no categories(supplierregister.CategoryCRUDSpec)
> |  groovy.lang.MissingMethodException: No signature of method:
> supplierregister.Sector.save() is applicable for argument types: () values:
> []
> Possible solutions: save(), save(boolean), save(java.util.Map), wait(),
> last(), any()
>     at
> supplierregister.CategoryCRUDSpec.$spock_initializeFields(CategoryCRUDSpec.groovy:10)

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

    http://xircles.codehaus.org/manage_email





--
Graeme Rocher
Grails Project Lead
SpringSource
Reply | Threaded
Open this post in threaded view
|

Re: grails-2.3.0 and functional test with geb, can't save an object.

Mauro
running functional test using remote control plugins:

groovyx.remote.RemoteControlException: Error sending command chain to 'http://null:8080null/grails-remote-control'

perhaps I've missed something?

Reply | Threaded
Open this post in threaded view
|

Re: grails-2.3.0 and functional test with geb, can't save an object.

sergiomichels
How do you run your functional tests? I know that this exception occurs if you use the war option:

grails test-app war //fails
grails test-app //works


--
Sérgio Michels


On Thu, Oct 10, 2013 at 8:13 AM, Mauro <[hidden email]> wrote:
running functional test using remote control plugins:

groovyx.remote.RemoteControlException: Error sending command chain to 'http://null:8080null/grails-remote-control'

perhaps I've missed something?


Reply | Threaded
Open this post in threaded view
|

Re: grails-2.3.0 and functional test with geb, can't save an object.

Mauro
On 10 October 2013 16:02, Sergio Michels <[hidden email]> wrote:
How do you run your functional tests? I know that this exception occurs if you use the war option:

grails test-app war //fails
grails test-app //works


under grails interactive:

test-app myPackage.myPage


However I've disinstalled remote-control plugin and create my object in Bootstrap.groovy so that I have them availablee for my tests.