我将一个大型Grails 1.3.7项目迁移到3.1.6。
Controller 的测试是集成测试。因为测试继承自ControllerSpec,所以效果很好。现在,我应该可以执行以下操作:
@Integration
@TestFor(SampleController)
class SampleControllerIntSpec extends Specification {
因为TestFor批注允许像在单元测试中一样使用model / view / ..字段。
有没有办法做这样的事情?
提前致谢。
最佳答案
没有TestFor
批注专门用于单元测试,而Integration
测试是Grails 3中的全功能测试,您应该使用Geb之类的客户端将请求发送到服务器并声明响应。
关于grails - 结合@TestFor和@Integration注释grails 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36938168/