结合@TestFor 和@Integration Annotation grails 3 [英] combine @TestFor and @Integration Annotation grails 3
问题描述
我将一个大型 Grails 1.3.7 项目迁移到 3.1.6.控制器测试是集成测试.这工作正常,因为测试继承自 ControllerSpec.现在我应该能够做这样的事情:
I migrate a large Grails 1.3.7 project to 3.1.6. Tests for Controllers are integration tests. This works fine because the tests inherit from ControllerSpec. Now i´m should be able to do something like this:
@Integration
@TestFor(SampleController)
class SampleControllerIntSpec extends Specification {
因为 TestFor Annotation 允许在单元测试中使用模型/视图/.. 字段.
Because the TestFor Annotation allows usage of model/view/.. fields like in Unit tests.
有没有办法做这样的事情?
Is there a way to do something like this?
提前致谢.
推荐答案
不,TestFor
注释专门用于单元测试,Integration
测试是 Grails 3 中的全功能测试您应该使用像 Geb 这样的客户端向服务器发送请求并断言响应.
No the TestFor
annotations are exclusively for unit tests, Integration
tests are full functional tests in Grails 3 where you should use a client like Geb to send requests to the server and assert responses.
这篇关于结合@TestFor 和@Integration Annotation grails 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!