Only Software matters

Experiences in software development

  • Enter your email address to follow this blog and receive notifications of new posts by email.

    Join 638 other followers

  • MVB

  • JavaCodeGeeks

    Java Code Geeks

  • My recent tweets

Archive for December, 2012

Code Coverage Tools (JaCoCo, Cobertura, Emma) Comparison in Sonar

Posted by Patroklos Papapetrou on December 19, 2012

For those that are not familiar with Sonar, ( I hope this post will make you at least try it or see it in action at )  you can take a look at an earlier post I’ve written some time ago. In one sentence Sonar is an open source platform that allows you to track and improve the quality of your source code. One of the key aspects when talking about software quality is the test coverage or code coverage which is how much of your source code is tested by Unit tests. Sonar integrates with the most popular open source code coverage tools ( JaCoCo, Cobetura, Emma ) and the well-known commercial Clover by Attlassian. By default it uses the JaCoCo (Java Code Coverage) engine and you’ll shortly find out why 🙂

Before we move on, I’d like to give many kudos to Evgeny Mandrikov. This article is inspired by one of his older posts and its intention is to present a more updated comparison of the supported code coverage tools by Sonar and point out some differences regarding their results and the way they work. Recently Sonar changed its default code coverage tool to JaCoCo and this post tries to explain the reasons behind that decision. Some of the information is borrowed by Evgeny’s post and the image is also taken from Evgeny’s presentation about JaCoCo. So thanks a lot Evgeny!

Now let’s go to the meat. For the comparison you’ll see, I’ve used the latest available Sonar version 3.3, Maven 2.2.1, Java 1.6 and all analysis launched in a Windows 7 machine (Intel Core i3-2120 CPU @ 3.30GHz)  with 8GB RAM. The projects were carefully selected ( a small, medium-sized and a large one – not that large as Java code base but large enough to extract some results ). I ran five analysis for each open source code coverage tool ( I excluded the commercial Clover from my comparison version ) and another five by disabling the code coverage mechanism. So that’s a total of 60 analysis ). In the following tables you can find some information about the code coverage tools and some basic metrics about the selected projects. Pay attention to the date of the latest stable release. Emma hasn’t been updated since dinosaurs era and cobertura is almost three years inactive. One might think that this isn’t an issue  if they are stable and don’t need any new release. Well, the truth is that both of them have bugs that frustrate end-users and there’s no one to fix them. On the other hand JaCoCo is continuously evolving and improving…





The results of the analysis are displayed next. Some important notices. Emma doesn’t support Branch coverage that’s why you’re not seeing any metrics. Furthermore there are differences in the results of Line and Branch coverage, which are more concrete for larger projects. For instance in Sonar Jira plugin all three tools produce the same results whereas in Sonar analysis and Commons Lang projects you can see that the numbers are not the same.



Now take a look at a graph that illustrates in a more readable way which tool is the fastest.


It seems that Emma and JaCoCo need the same amount of time to compute their metrics… but… as we already mentioned there’s a huge difference. There’s no branch coverage in Emma reports.  Cobertura is always slower than JaCoCo so again the winner is JaCoCo. Of course you can get even faster results by running a Sonar analysis without computing code coverage metrics 🙂

One last thing: JaCoCo, as the following figure shows is the only tool that analyses bytecode on-the-fly which is more . Cobertura and Emma run an offline analysis and use a class loader whereas JaCoCo has its own java agent for analysis code. This configuration allows JaCoCo to be very flexible, possible integrated with many other tools and frameworks and can be used with any language in a JVM environment.



So, to sum up, if you’re using Sonar ( if you don’t , you SHOULD ), then it strongly advisable to keep the default code coverage engine ( JaCoCo) , unless you have really important reasons for that.

Finally don’t forge to check Sonar’s Community 2013 unofficial survey and the upcoming book about Sonar by Manning Publications. The release date is in about 3-4 months but you can get an early access version here.

As always, feel free to comment or suggest improvements about the article and its content.



Posted in software | 8 Comments »

Sonar 2013 Community Survey

Posted by Patroklos Papapetrou on December 11, 2012

It’s time for the Sonar Community to vote for Sonar’s annual survey.
As last year there’s an unofficial survey with 10 Sonar questions regarding the user community.

You are all welcome to reply anonymously to 10 simple Sonar-related questions. I expect that you won’t need more than 5 minutes to complete it.
The survey will be open until 31 of January and the results will be published in a following post some days later.

Just click on the following link and send your responses

Best Regards




Posted in quality, sonar | 3 Comments »

Manning’s Countdown to 2013 – All technical books down to 50% during Christmas

Posted by Patroklos Papapetrou on December 11, 2012

Manning Publications is, IMHO, by far the most professional publisher when talking about technical books. They don’t publish books for every possible technology – I wonder who’s buying books for OpenNI or Yii. They carefully select the topics and all their books are of the highest quality, compact, easy to ready, without “noise”. But the best of all is that every  December they’re giving away free books. This year’s countdown to 2013 has already started with plenty of offers and some guys have already claimed their free books. 

In particular, each Monday is 50% off on a particular type of book. Yesterday was MEAP day!

As a heads up:

Monday Dec 17—Half off all eBooks with code dotd1217au
Monday Dec 24 and Tuesday Dec 25 —Half off any purchase, eBook, pBook, or MEAP with codes dotd1224au and dotd1225au

There’s more about the Countdown to 2013 at, including how to get a shot at an iPad Mini !!

In this post I suggest several books for topics that are currently hot and have an increased interest. So here they are!!!


1. Software Quality / Metrics
No matter what’s your favorite language, your programming style, your build tool, your development methodology, there’s something in common : the need of measuring source code quality. If I had to pick up only one tool for that that would be Sonar. Manning’s Sonar in Action is the only available book for Sonar that covers all seven axes of quality It explains core metrics, provides best practices for tuning, configuring and administering Sonar and includes a bonus chapter about writing your own plugin. 


2. Typesafe stack technologies
The Typesafe Stack is an integrated distribution that includes the Scala programming language, Akka event-driven middleware, and the Play web framework, along with a robust suite of development tools. It includes

  • The Scala programming language and standard library
  • The Akka event-driven middleware, with Scala and Java APIs
  • The Play framework for developing real-time Web applications, with Scala and Java APIs

Manning is here again and offers a variety of books to quickly learn the above technologies


3. Android
Getting better and better after every new version, Android is the #1 choice for mobile application development. Manning’s books cover all levels of experience, so even if you’re a novice or an experienced professional you’ll surely find a book that’s for you!


4. Big Data – NoSQL databases
RDBMS are dead. Long live NoSQL databases… Well RDBMS are not dead and will surely live for many years, but who can deny that NoSQL databases or a combination of these two technologies is the future of managing Big Data? Manning offers a series of books, that either target general concepts or focus on specific tools. 

So make up your mind and wait for Monday 17th or Christmas Day and Christmas Eve to buy your favorite books !!!

Posted in software | Tagged: , , | Leave a Comment »

%d bloggers like this: