Configure cobertura to ignore certain blocks of code

五迷三道 提交于 2019-12-23 11:39:08

问题


Is it possible using Cobertura to tell it to ignore certain bits of code that are identified by start and end comments?

For example,

public class Foo {

    public void static doSomething() {
        ...
        // Cobertura-Ignore-Start
        ...
        // Cobertura-Ignore-End
}

would result in Cobertura not including the code in between the start and end comments when calculating coverage statistics.

Edit: I am using the cobertura Ant task.


回答1:


No, it's not possible. Cobertura does not have a feature that lets it skip over code. The only thing you can ignore is method calls to certain packages and/or classes.

You'd probably have to dig into the code and see whether it's possible to extend it in such a way as to ignore blocks.




回答2:


You can ignore at the class level only as far as I know (which means any method from the ignored classes is not counted, it is instrumented though so no speed up by doing so).



来源:https://stackoverflow.com/questions/3527734/configure-cobertura-to-ignore-certain-blocks-of-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!