Why does Cobertura report a 0% coverage on startup through the Eclipse plugin?

(There are a ton of these questions, but all the ones I can find are related to Maven. Before you suggest, this is a duplicate, please understand that this has nothing to do with Maven.)

I use Cobertura in Eclipse to determine my percentage of code covered by my JUnit tests. All 99 of my unit tests run successfully inside and outside Cobertura, but Cobertura reports that they covered 0% of my code.

I:

  • I run Cobertura through the Eclipse plugin
  • I am using Java 6, specifically OpenJDK-AMD64 on Ubuntu
  • ensure that unit tests cover some sections of my code.
  • guaranteed that Cobertura runs my entire test folder in the entire src folder
  • tried to clean and rebuild

Why is Cobertura reporting 0%?

+4
source share
1 answer

I found this to be a problem for me because I was collecting source files without line numbers. If this is your problem, you will see

[cobertura-instrument] WARN visitEnd, No line number information found for class com.x.y.z.A.
Perhaps you need to compile with debug=true?

To solve this problem, add debug="true" debuglevel="vars,lines,source"to the command javac.

See also:

http://meera-subbarao.blogspot.co.uk/2008/07/cobertura-instrument-warn-visitend-no.html

How to remove a specific Cobertura warning?

+1
source

All Articles