mojohaus / cobertura-maven-plugin

Cobertura Maven Plugin
https://www.mojohaus.org/cobertura-maven-plugin/
25 stars 20 forks source link

cobertura-maven-plugin doesn't bring up the true coverage of classes. #23

Open syashwanthk opened 8 years ago

syashwanthk commented 8 years ago

The plugin does not show the coverage of the java class for which test cases are written to cover all the flows in the code. Coverage for the same class in Eclipse EclEmma is shown as 90% where as it is shown as 1% in cobertura index.html generated using the plugin. Code coverage is not shown for integration tests also.

mohanaraosv commented 8 years ago

@syashwanthk Please add sample test case and environment details for the same.

syashwanthk commented 7 years ago

I cannot provide the sample data but further analysis from my side is that when I used cobertura-maven-plugin 2.2 I found that the coverage is brought up only for test cases using PowerMock api and others remain at 0% and when I use version 2.7 the issue is vice versa i.e, test cases with PowerMock go to 0% and others go to the extent they are covered.

syashwanthk commented 7 years ago

Example for above is : TestSample1.java covers Sample1.java using PowerMock and EclEmma shows 90% coverage. TestSample2.java covers Sample2.java without using PowerMock and EclEmma shows 80% coverage.

When I use the cobertura-maven-plugin 2.2 I see Sample1.java covered to 90% and Sample2.java covered to 0% when I build the project. When I use the cobertura-maven-plugin 2.7 I see Sample1.java covered to 0% and Sample2.java covered to 80% when I build the project. Please help on the above. I am running the plugin in local machine only through automated maven build.