开发者

How to force Sonar to show coverage of test files?

I'm using: Sonar version: 2.10 Emma version: 2.1.5320 Sonar Emma plugin version: 1开发者_如何学Python.2

I'm able to generate an Emma report showing coverage of the tests themselves (ideally this would be 100% but in practice it's not always), but Sonar shows only the coverage of the src files. How do I get it to show the coverage of the test files, too?

Would switching to Cobertura help?


AFAICT from:

public final class NewCoverageFileAnalyzer {
    public boolean shouldDecorate(Resource resource) { 
        return Scopes.isFile(resource) && !Qualifiers.UNIT_TEST_FILE.equals(resource.getQualifier()); 
    }
} 

it looks like coverage of test files can't be shown in Sonar without changing the Sonar code.


Comment:

Counting test classes as coverage might inflate coverage ratio.

Using more test files would allow coverage > 100 % (lines covered / lines of production code).

It might still be usefull to see, if there is some dead test code somewhere.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜