开发者

Configure cobertura to ignore certain blocks of code

开发者 https://www.devze.com 2023-01-12 03:26 出处:网络
Is it possible using Cobertura to tell it to ignore certain bits of code that are identified by start and end comments?

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.


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.


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消