【问题标题】:combine @TestFor and @Integration Annotation grails 3结合@TestFor和@Integration注释grails 3
【发布时间】:2016-08-24 14:31:05
【问题描述】:

我将一个大型 Grails 1.3.7 项目迁移到 3.1.6。 控制器测试是集成测试。这很好用,因为测试继承自 ControllerSpec。现在我应该可以做这样的事情了:

@Integration
@TestFor(SampleController)
class SampleControllerIntSpec extends Specification {

因为 TestFor 注解允许像在单元测试中一样使用模型/视图/.. 字段。

有没有办法做这样的事情?

提前致谢。

【问题讨论】:

    标签: grails annotations integration-testing grails-3.0 grails-3.1


    【解决方案1】:

    不,TestFor 注释专门用于单元测试,Integration 测试是 Grails 3 中的完整功能测试,您应该使用像 Geb 这样的客户端向服务器发送请求并断言响应。

    【讨论】:

    • 感谢您的快速答复。我知道这样是不可能的。我必须迁移很多测试,我希望有一种解决方法可以做到这一点。能给个提示吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多