cobertura / cobertura

Cobertura
GNU General Public License v2.0
1.03k stars 277 forks source link

Cobertura Instrumentation Limitations ? #154

Open krekha82 opened 10 years ago

krekha82 commented 10 years ago

Hello, im trying to instrument few packages in our applications. Cobetrura doesnt seem to instrument few very important classes in that packages where we need coverage.Those are not abstract classes. Any idea what are the instrumentation limitaion of cobertura?

Thanks, Rekha

GerritHohl commented 10 years ago

I have a similar problem: I have a Maven projects which includes 438 JUnit tests. And currently I'm writing a JUnit test case which has more than 2500 lines at the moment. The class which is tested by that JUnit test case has about 1300 lines. And I don't get any more lines marked as covered by Cobertura.

First I thought that maybe my test really doesn't covered these lines. I tried to confirm this by stepping though the tests using the Eclipse debugger. But the Java walked over these lines.

Then I thought, okay, maybe there are some reasons that exactly these lines can't be instrumented. So I decided to continue with other tests in that JUnit test case. But the lines of my class which are covered by that additional tests are also now marked as covered by Cobertura.

Now I'm wondering if there is some arbitrary hidden internal limit or maximum.

If the available memory is the problem it should throw an OutOfMemoryException. But it doesn't. So I think that this is not the problem.

I'm using Java 1.7.0 and cobertura-maven-plugin 2.6 which depends on Cobertura 2.0.3.

GerritHohl commented 10 years ago

Okay, now I've finished my JUnit test case. And it seems there is a limit around 750 to 780 lines. All tests which cover lines behind that lines are not shown as covered in the report.

I know that it isn't good practice to write classes with so many lines. But that shouldn't matter, shouldn't it?

christ66 commented 10 years ago

@GerritHohl There have been code changes recently to address this issue. I will be performing a release hopefully this week (or weekend). However it might take a few extra days after to get it working with the cobertura maven plugin (voting process to release a plugin).

GerritHohl commented 10 years ago

@christ66 Thanks for the reply. No problem, I'll wait. So far I had only a few classes which hit the limit. And I tried to cover them as best as possible. I'll check them again when the new version of Cobertura as well as the corresponding Maven plugin is available.