• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

code coverage tool

 
paul wheaton
Trailboss
Pie
Posts: 21387
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I remember there was a product called "clover", and later there were a couple of other competing free options.

I would like to find something that would generate reports and maybe a copy of source showing lines with coverage and lines without.

And free.

Anybody have any favorites that would fit the bill?

this page was pretty useful in showing a list of options ... but which is great and which is ... not so great?
 
Eric Nielsen
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used both Cobertura (free) and Clover (not-free, but free for FOSS projects meeting certain guidelines). I greatly prefer Clover, but will use Cobertura when circumstances dictate. Cobertura generates summary reports as well as show line coverage, so I would suggest starting there...
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34207
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use - and am happy with - Emma. For some reason, that's missing from the java-source.net list
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Cobertura too. Its good and generating the reports which give line by line coverage. Never tried any other.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've mainly used Cobertura. It works well enough and produces almost as pretty reports as Clover does. It also includes Cyclomatic Complexity for all classes, which is a nice extra.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We use Emma too; works nice. I think the project might be dead though; they haven't done a release since 2005.
 
Jan Cumps
Bartender
Posts: 2586
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the project might be dead though; they haven't done a release since 2005.
Not shure. The Emma CVS statistics on SourceForge show 0 CVS commits for the last twelve months, but the Emma team actively assists in the user forums, and there is a recent release of the NetBeans Unit Tests Code Coverage Plugin that uses Emma. It colours the covered lines in the NetBeans editor.

Regards, Jan
[ January 18, 2008: Message edited by: Jan Cumps ]
 
paul wheaton
Trailboss
Pie
Posts: 21387
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I grabbed cobertura and thought "I'll just fire this up, it will work great and then I'll pop back to the forum and say 'thanks everybody! it works great!'" .... and I now have two hours invested in



Here is the beginning of my target. You can see all the ways I have tried to feed the path to log4j.

 
paul wheaton
Trailboss
Pie
Posts: 21387
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I now hate cobertura.

And I hate log4j.

And I'm thinking of scrapping the whole idea of learning about the coverage! ARGH!

Anybody spot anything here that I'm not seeing?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34207
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jan Cumps:
Not shure. The Emma CVS statistics on SourceForge show 0 CVS commits for the last twelve months, but the Emma team actively assists in the user forums

Maybe that means it's stable . Seriously, we implemented Emma in our central build about two years ago and haven't touched it since. It does everything we need it to and doesn't require we mess with it. I do think Ernest's comment is more likely, but I can hope.

Originally posted by Paul Wheaton:
I grabbed cobertura and thought "I'll just fire this up, it will work great and then I'll pop back to the forum and say 'thanks everybody! it works great!'"

I'm surprised it isn't that easy. Emma took about 30 minutes to set up. There's a sample in PickWinners (in JavaRanch's SVN repository) if you want it. Of course that doesn't help if you want to use cobertura.

Anybody spot anything here that I'm not seeing?

Did you try <classpath refid="cobertura.classpath" /> ?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,


Yes these were there in the fileset dir. path, like all other libraries, but we need to include these separately, since not working without it.
 
paul wheaton
Trailboss
Pie
Posts: 21387
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:

Did you try <classpath refid="cobertura.classpath" /> ?


Yes. Still no workee.
 
paul wheaton
Trailboss
Pie
Posts: 21387
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Adeel Ansari:
Hi Paul,


Yes these were there in the fileset dir. path, like all other libraries, but we need to include these separately, since not working without it.


I tinkered along these lines for a while and made no progress.

(grumble grumble grumble)
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. A bit more snippet on lib.dir



where:
lib.dir = /web/WEB-INF/lib
in my case.
 
paul wheaton
Trailboss
Pie
Posts: 21387
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has been something a little on my back burner - something to do when I get a few minutes here and there.

So here is the final report.

I scrapped it all. It turns out that intellij has emma built in. I had a little trouble finding it, but I sent an email to their support and said "either I can't find it, or I would like to suggest a feature ..." and they replied in about two minutes with one sentence that gave me everything I needed to pull it off.

Very nice!

Thanks everybody for your help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic