简体   繁体   English

grails测试应用程序集成覆盖率错误

[英]grails test-app integration coverage giving error

My code 我的密码

def baseRecordList = DealerBaseInfo.findAll("from DealerBaseInfo as dealers",[cache: false])

is giving the below error inside PriorApprovalController.groovy PriorApprovalController.groovy内部给出以下错误

groovy.lang.MissingMethodException: No signature of method: DealerBaseInfo.findAll() is applicable for argument types: () values: []
Possible solutions: findAll(), findAll(), findAll(groovy.lang.Closure), findAll(java.lang.Object), findAll(java.lang.String), findAll(groovy.lang.Closure)
at DealerBaseInfo.findAll(DealerBaseInfo.groovy)
at DealerBaseInfo$findAll.call(Unknown Source)
PriorApprovalController.<init>(PriorApprovalController.groovy:37)
... 42 more
| Error Exception occurred trigger event [TestPhasesEnd]: Could not create a new instance of class [PriorApprovalController]!`

grails version is 2.1.1 and code-coverage plugin 1.2.5 Why is that and how do I fix it? grails的版本是2.1.1,代码覆盖插件是1.2.5,为什么?如何解决?

Have a look at the findAll() supported signatures: http://grails.org/doc/2.1.0/ref/Domain%20Classes/findAll.html 看一下findAll()支持的签名: http : //grails.org/doc/2.1.0/ref/Domain%20Classes/findAll.html

To use the queryParams, I think you should do something like this: 要使用queryParams,我认为您应该执行以下操作:

def baseRecordList = DealerBaseInfo.findAll("from DealerBaseInfo as dealers", [], [cache: false])

实际上,错误是由于对findAll方法的类级别访问而来的,我在域中为findAll编写了一个静态方法并在控制器中访问该方法,然后它起作用了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM