Kwa Kil On Swa

Sunday, July 30, 2006

Cobertura vs Emma

I've used the java coverage tools emma and cobertura before although not in any great depth. JCoverage currently has way prettier reports, and Elliotte Rusty Harold seems to prefer cobertura over emma. So when I was looking to set up test coverage reports for JRuby, I thought I would try cobertura and forget all about emma.

I have just submitted a patch to JRuby complete with a unit test, and I wanted to make sure that my unit test was covering the code properly. However, cobertura showed confusing results for the bit of code I was interested in.

Here it is:


The two iterator methods are showing three lines not being executed by the test, which I was pretty sure was wrong. (And a single commented line not being executed.)

So I tried the same in Emma, and I got the correct code coverage:



Give me ugly but correct, every time! Ok, so maybe this is a nasty corner case, with two embedded anonymous inner types which are created and returned in one statement. But its real code, that I happen to be interested in.

So now a little later cobertura is working fine... and I'm not sure what I did to fix it.

0 Comments:

Post a Comment

<< Home