I'm using Geb to write some functional tests for a Grails app. Is there a way to access Spring beans from such tests. I tried the obvious:
import geb.junit4.GebReportingTest
class AuthenticatedUserTests extends GebReportingTest {
UserService userService
@Test
void shouldCreateNewIdea() {
// throws NullPointerException
userService.doSomething()
}
}
But it doesn't work. A few addtional details which may be relevant:
- I'm using Grails 2.3.7
- I've disabled forking
- I'm running the tests with
grails test-app functional:
, i.e. without the-war
option