20

Is there handy code coverage tool to be used with JUnit?

user496949
  • 83,087
  • 147
  • 309
  • 426

4 Answers4

15

I would imagine most code coverage tools can be used pretty easily with JUnit. Previously I've used EMMA, which is good. If you're an Eclipse user, there's an Eclipse plugin called EclEmma to integrate things.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • If you're using Eclipse EclEmma is definitely good and very simple to use. – Eric-Karl Mar 11 '11 at 18:00
  • EclEmma is very nice, but users should read the [FAQ about coverage of exceptions](http://www.eclemma.org/faq.html#trouble02) (in a nutshell, exception code may show up as non-covered even whan it is actually executed). If you find an apparently non-covered block, you can just run it in the debugger to see if it actually gets executed. – DNA Sep 23 '12 at 21:50
  • By "previously" are you implying that you have a new favorite code coverage tool? – David Harkness Sep 25 '12 at 23:15
  • @DavidHarkness: Not particularly - it's just a while since I've configured one directly. The build systems I use now are somewhat different, and may or may not be using EMMA behind the scenes. – Jon Skeet Sep 26 '12 at 05:54
5

Here are my preferences in that order:

  1. EclEmma
  2. Clover

And here is a bunch of open source tools and with comparison.

Hope that helps.

Nilesh
  • 4,137
  • 6
  • 39
  • 53
  • Here you can find another comparison: https://confluence.atlassian.com/display/CLOVER/Comparison+of+code+coverage+tools – Marek Oct 28 '14 at 09:39
2

There are many and google is your friend.

NoUnit

Coverlipse (I would recommend this, but its an eclipse plugin)

Codecover

Nishan
  • 2,821
  • 4
  • 27
  • 36
2

Cobetura http://cobertura.sourceforge.net/

sbridges
  • 24,960
  • 4
  • 64
  • 71