aspose file tools*
The moose likes Testing and the fly likes code coverage tool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "code coverage tool" Watch "code coverage tool" New topic
Author

code coverage tool

paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20636
    ∞

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?


permaculture Wood Burning Stoves 2.0 - 4-DVD set
Eric Nielsen
Ranch Hand

Joined: Dec 14, 2004
Posts: 194
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

Joined: May 26, 2003
Posts: 30762
    
156

I use - and am happy with - Emma. For some reason, that's missing from the java-source.net list


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
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.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

We use Emma too; works nice. I think the project might be dead though; they haven't done a release since 2005.


[Jess in Action][AskingGoodQuestions]
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2503
    
    8

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 ]

OCUP UML fundamental and ITIL foundation
youtube channel
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20636
    ∞

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

Joined: Dec 14, 1998
Posts: 20636
    ∞

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

Joined: May 26, 2003
Posts: 30762
    
156

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

Joined: Aug 15, 2004
Posts: 2874
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

Joined: Dec 14, 1998
Posts: 20636
    ∞

Originally posted by Jeanne Boyarsky:

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


Yes. Still no workee.
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20636
    ∞

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

Joined: Aug 15, 2004
Posts: 2874
Ok. A bit more snippet on lib.dir



where:
lib.dir = /web/WEB-INF/lib
in my case.
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20636
    ∞

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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: code coverage tool