简体   繁体   English

grails test-app -coverage不包括分支模式下的功能测试的范围

[英]grails test-app -coverage doesn't include coverage for functional tests in forked mode

I'm having trouble understanding Grails forked mode and how it's impacting the code coverage reports when I'm running grails test-app -coverage . 我在运行grails test-app -coverage coverage时无法理解Grails分支模式以及它如何影响代码覆盖率报告。 I am using Grails 2.3.1. 我正在使用Grails 2.3.1。

I turned off forked mode for the test configuration 我为测试配置关闭了分叉模式

grails.project.fork = [... test: false  ... ]

And unit tests show up in the coverage report. 单元测试将显示在覆盖率报告中。

However, coverage from functional tests is NOT included in the Cobertura output. 但是,Cobertura输出中不包括功能测试的范围。

If I turn off forked mode for the run option as well, then I do get coverage from functional tests in the Cobertura report. 如果我也关闭了run选项的分叉模式,那么我确实会从Cobertura报告中的功能测试中获得帮助。

Questions: 问题:

  • why does forked mode for run impact the coverage output? 为什么分叉模式run影响coverage输出? aren't the same instrumented classes also deployed to the embedded Tomcat? 嵌入式Tomcat是否也部署了相同的检测类?

  • is there a way to use forked mode normally for run-app, but not when launched incidental to test-app -functional for tests? 有没有一种方法可以在运行应用程序时正常使用分叉模式,但是在test-app -functional附带的情况下启动时无法使用分叉模式?

The problem should be reported at https://github.com/beckje01/grails-code-coverage/issues . 该问题应在https://github.com/beckje01/grails-code-coverage/issues中报告。

Yes, there is a way to use forked mode for run-app but not for test-app. 是的,有一种方法可以将分叉模式用于运行应用程序,而不能用于测试应用程序。 In BuildConfig.groovy you can do something like this: BuildConfig.groovy您可以执行以下操作:

grails.project.fork = [
    test: false,
    run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
    war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
    console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]

That probably doesn't affect functional tests in the way that you want, but does affect other tests. 这可能不会以您想要的方式影响功能测试,但会影响其他测试。

EDIT: 编辑:

See https://github.com/beckje01/grails-code-coverage/issues/11 参见https://github.com/beckje01/grails-code-coverage/issues/11

That probably doesn't help with functional tests and may need to be addressed as a separate problem. 这可能对功能测试没有帮助,可能需要作为一个单独的问题来解决。

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

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