Grails代码覆盖率不起作用

时间:2014-12-01 13:25:25

标签: grails cobertura

我正在使用Grails 2.2.4并为控制器创建JUnit测试,但代码覆盖率不包括我的测试控制器,下面是我的测试用例详细信息。

//BuildConfig.groovy
plugins {
    test ":code-coverage:2.0.3-3"
}

//MyControllerTests.groovy
@TestMixin(GrailsUnitTestMixin)
@TestFor(MyController)
@TestFor([Domain1,Domain2])
class MyControllerTests {
    void setUp() {
        controller.myService = new MyService()
    }

    void testAction1(){
        controller.action1()
    }
}


//mycontroller.groovy
class MyController {
   def myService
   def action1{
      def msg = myService.myFirstAction()
   }
}

//myservice.groovy
class MyService{
   def myFirstAction(){
     //logic which returns string
     return 'my logic result'
   }
}

0 个答案:

没有答案