Jacoco code coverage tool

Today I discovered with great pleasure a great project for gathering unit, integration and automation tests code coverage: Jacoco!

I was so excited that I decided to give it a try on my template Maven project and the POM went down 150 lines with greatly improved readability!

No more tricky profiles or instrumented artifacts you need to include explicitly and solely to gather coverage: everything works like a charm!

Obviously my previous post regarding Cucumber tricks is still totally valid.

Thanks Jacoco!


2 thoughts on “Jacoco code coverage tool

  1. Heya Roberto, great articles! I’m considering doing the same at work to combine Cobertura results with EMMA for Android instrumented tests. I hear Jacoco helps on that front as well, was this your experience also or you’re doing straight Java Unit Test and VM instrumentation?


    • I use Jacoco in combination to Cucumber-JVM mainly, sometimes it’s a clear demonstration of value for our tests.

      Please note though you have to accept a lower coverage percentage or integrate your Cucumber tests with jUnit ones as it’s going to be difficult to use Cucumber to test system failure scenarios (read as the exception branches). In those cases Jacaco has demonstrated some limitations with regards the handling of system exceptions due to it’s JavaAgent nature.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s