开发者

Cobertura test coverage does not cover tests which extend class under test

开发者 https://www.devze.com 2023-02-12 09:52 出处:网络
I have a class which I need to test eg. MyClass.java I am using Junit4 so in order to test the protected methods as well in MyClass.java I create a test class MyClassTest.java (which is in a complete

I have a class which I need to test eg. MyClass.java

I am using Junit4 so in order to test the protected methods as well in MyClass.java I create a test class MyClassTest.java (which is in a completely different package hence the inability to test the protected method otherwise).

I have written tests for all methods in MyClass and MyClassTest succeeds when run.

When I run the Cobertura test coverage for all classes in the project, this works fine and I get varying coverage from 0-100% according to tests written.

Cobertura reports however that MyClass has 0% coverage as it was not tested - it was infact the subclass that was tested.

Is开发者_开发问答 there any way of making Cobertura pick up the fact that all methods being tested are within the parent class and picking that up as coverage??

Thanks

0

精彩评论

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