【发布时间】:2014-05-20 17:52:13
【问题描述】:
我正在使用 Geb 为 Grails 应用程序编写一些功能测试。有没有办法从此类测试中访问 Spring bean。我尝试了明显的:
import geb.junit4.GebReportingTest
class AuthenticatedUserTests extends GebReportingTest {
UserService userService
@Test
void shouldCreateNewIdea() {
// throws NullPointerException
userService.doSomething()
}
}
但它不起作用。一些可能相关的附加细节:
- 我使用的是 Grails 2.3.7
- 我已禁用分叉
- 我正在使用
grails test-app functional:运行测试,即没有-war选项
【问题讨论】:
标签: grails selenium functional-testing geb