我正在使用 Grails 2.1.1,对于代码覆盖率插件,我正在使用 code-coverage1.2.5
我注意到我的测试用例通过 test-app 命令成功通过,但没有通过命令“test-app -coverage --stacktrace”生成 cobertura 报告
下面是我得到的错误
Flushing results done
Cobertura: Loaded information on 320 classes.
Cobertura: Saved information on 320 classes.
| Error Exception occurred trigger event [TestPhasesEnd]: Could not create a new instance of class [com.sigmainfo.cooptimum.connectplus.priorapproval.PriorApprovalController]! (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: Could not create a new instance of class [com.sigmainfo.cooptimum.connectplus.priorapproval.PriorApprovalController]!
at _Events$_replaceClosureNames_closure5.doCall(_Events.groovy:115)
at _Events.replaceClosureNames(_Events.groovy:113)
at _Events$replaceClosureNames.callCurrent(Unknown Source)
at _Events.replaceClosureNamesInReports(_Events.groovy:105)
at _Events$_run_closure3.doCall(_Events.groovy:59)
at _GrailsEvents_groovy$_run_closure5.doCall(_GrailsEvents_groovy:53)
at _GrailsEvents_groovy$_run_closure5.call(_GrailsEvents_groovy)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at _GrailsTest_groovy$_run_closure1.doCall(_GrailsTest_groovy:223)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at TestApp$_run_closure1.doCall(TestApp.groovy:82)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:591)
at gant.Gant.executeTargets(Gant.groovy:590)
Caused by: groovy.lang.MissingMethodException: No signature of method: com.sigmainfo.cooptimum.connectplus.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 com.sigmainfo.cooptimum.connectplus.DealerBaseInfo.findAll(DealerBaseInfo.groovy)
at com.sigmainfo.cooptimum.connectplus.DealerBaseInfo$findAll.call(Unknown Source)
at com.sigmainfo.cooptimum.connectplus.priorapproval.PriorApprovalController.<init>(PriorApprovalController.groovy:32)
... 42 more
| Error Exception occurred trigger event [TestPhasesEnd]: Could not create a new instance of class [com.sigmainfo.cooptimum.connectplus.priorapproval.PriorApprovalController]!
Flushing results...
Flushing results done
Cobertura: Loaded information on 320 classes.
Cobertura: Saved information on 320 classes.
下面是控制器的代码片段
class PriorApprovalController extends FileUploaderController{
Subject currentUser = SecurityUtils.subject
def baseRecordList = DealerBaseInfo.findAll("from DealerBaseInfo as dealers",[cache: false])
def dataSource
def mailSenderService
def exportService
def priorApprovalInfo
def currentuser
def dealerBaseInfo1
我在线上遇到错误
def baseRecordList = DealerBaseInfo.findAll("from DealerBaseInfo as dealers",[cache: false])