5

We are thinking about utilizing one of these tools in our development procedure. Our environment extensively uses mvn and eclipse.

Which one in your opinion is the best utility for checking test coverage? I realize that it may depend on the situation to determine when it is better to use cobertura over clover and vice-versa.

Thanks in advance

m0j0hn
  • 532
  • 4
  • 16
Marcin Michalski
  • 1,266
  • 13
  • 17
  • 2
    There are two problems with this question. 1) What are your exact goals? For many goals, Cobertura and Clover are equally suitable, but for specific use cases one may prefer one over the other. 2) There will be very few people that have used both and everyone with experience in only one of them will be discouraged to answer, even though a simple 'it worked for us' may be enough for you. – Confusion Feb 02 '11 at 07:26

5 Answers5

7

I have also tried Clover, Cobertura and Emma. We are now using Cobertura. It took me about a day to integrate Cobertura into our headless build, it produces the statistics we require and the eCobertura eclipse plugin is primitive, but useable and informative. There is a very nice Hudson plugin for Cobertura also.

We where previously using Emma. Emma with the EclEmma plugin is about equivalent to Cobertura/eCobertura. Emma integration into Ant is a fracton more complex and doesn't offer a complexity factor. The EclEmma plugin is nicer and more mature then eCobertura. The Hudson plugin is equivalent and as easy to configure. Our reason for moving away from Emma was that the code base has not been maintained for some years now and we where having problems as it is rendered useless if encounters code using Lombok.

I spent a week (in parallel with other tasks) playing with Clover and coudln't get it working. I asked around my colleagues, some with a lot of experience, and only one had heard of somebody getting Clover working in the build, and that was difficult.

As Cobertura provides everything that we required, is easy to work with and is free we saw no reason to spend money on Clover.

James Woods
  • 477
  • 1
  • 4
  • 15
  • I should mention, in response to a previous post, the Cobertura does now offer method level coverage statistics. – James Woods Mar 11 '11 at 06:12
  • Does your Cobertura count coverage of Lomboks annotations (`@Getter @ Setter`)? most of my beans are mostly red, coz of lombok... that's pissing me off :) – dantuch Apr 21 '12 at 21:34
3

One distinction of note is that Cobertura does NOT currently support Java 7:

Cobertura & Java 7 support

Clover 3.1.x DOES support Java 7:

http://confluence.atlassian.com/display/CLOVER/Clover+3.1+Release+Notes

UPDATE: Cobertura 2.0.3 supports Java 7

Community
  • 1
  • 1
wolfcastle
  • 5,850
  • 3
  • 33
  • 46
2

I was faced with a similar dilemma and tested Cobertura, Emma and Clover. Cobertura and Emma. Clover was probably the best out of the 3 tools in terms of the speed and the level of detail one could get into. We could afford to pay for a tool at the time so we decided to go with Clover. Of the two open source ones, I loved the simplicity of using Emma. Also, Emma provided us with Method level coverage, something that Cobertura did not.

At the end of the day. Code coverage metrics are just code coverage metrics, nothing fancy. Just use what you feel comfortable with. The pain point of using any of these tools is minimal.

Deep Kapadia
  • 1,468
  • 8
  • 21
0

I have not used Clover. I have used Cobertura: it was easy to setup and gave the simple C1 coverage results we wanted and expected. There was some issue that it always ran all the tests twice (once with and once without instrumentation), even though we didn't feel we needed that. However, since the test suite was short enough, it never bothered us.

Confusion
  • 16,256
  • 8
  • 46
  • 71
0

We're using Cobertura currently, and I've been very impressed. It was amazingly easy to integrate into our existing build & unit test process (I think it look less than an hour to get fully running.) Also, our software stack is a mix of Java & Groovy, which Cobertura handles just fine, and even does coverage on closures the way you would want. (In my experience, very few Java tools actually work right with non-Java JVM languages, so that was a nice surprise.)

Electrons_Ahoy
  • 36,743
  • 36
  • 104
  • 127