-1

I'm writing functional tests with Spock and Geb in Grails 2.5.6 using the remote-control plugin.

I have something like this in a when block:

String someString
remote {
    someString = SomeDomain.findByName("Some Name").someValue
}

In the then block that follows, someString is null. Trying to debug the issue, a breakpoint in the remote block is not hit.

What am I doing wrong?

Raphael
  • 9,779
  • 5
  • 63
  • 94

1 Answers1

0

Due to the way remote-control executes the given closure, the assignment to the local variable is not performed.

Do this instead:

String someString = remote {
    return SomeDomain.findByName("Some Name").someValue
}

Keep in mind that serialization is performed there, so this will not work for every type.

Raphael
  • 9,779
  • 5
  • 63
  • 94