Domanda

(There are a tonne of these questions, but all the ones I can find relate to Maven. Before you suggest this one is a duplicate, please understand that this doesn't relate to Maven in any way.)

I am using Cobertura within Eclipse to determine my percentage of code covered by my JUnit tests. All 99 of my unit tests run successfully, both within and outside of Cobertura, but Cobertura reports back that they have covered 0% of my code.

I :

  • am running Cobertura through the Eclipse plugin
  • am using Java 6, specifically OpenJDK-AMD64 on Ubuntu
  • have ensured that the unit tests do cover some sections of my code
  • have ensured that Cobertura is running all my test folder on all of my src folder
  • have tried to clean and rebuild

Why does Cobertura report 0%?

È stato utile?

Soluzione

I found that this was a problem for me because I was compiling my 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, add debug="true" debuglevel="vars,lines,source" to your javac command.

See also:

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

How to remove specific Cobertura warning?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top