结合@TestFor和@Integration注释grails 3 [英] combine @TestFor and @Integration Annotation grails 3

查看:79
本文介绍了结合@TestFor和@Integration注释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注释允许使用单元测试中的model/view/..字段.

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注释grails 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆