Comparison of code coverage tools

Disclaimer

We've tried to do our best to prepare non-biased, based on features, comparison of various code coverage tools available on the market in order to help in evaluation process. Information gathered here is based on the official tools' documentation as well as on documentation of tools' integrations. In case you'd find some information presented here inaccurate or outdated or if you think that new tool or feature shall be added to the comparison, please do not hesitate to raise an issue - we will review it and update the page accordingly.

Feature

Atlassian Clover

Cobertura

JaCoCo JCov Code Cover PIT
Home page
  atlassian.com/software/clover cobertura.github.io/cobertura eclemma.org/jacoco openjdk.java.net codecover.org pitest.org
Instrumentation
Source files (tick) (error) (error) (error) (error) (error)
Class files (error) (tick) off-line instrumentation (tick) off-line and on-the-fly instrumentation (tick) off-line and on-the-fly instrumentation (tick) (tick)
Coverage metrics

Method

(tick)

(error)

(tick) (tick) (tick) (error)

Statement (1)

(tick)

(error)

(error)

 

linear block

(tick) (error)

Line (1)

(error) (tick) (tick) (error) (tick)

Branch

(tick)

(tick)

(tick) (tick) (tick) (error)
MC/DC (error) (error) (error) (error) (tick) (error)
Instruction (error) (error) (tick) explanation (error) (error) (error)
Global coverage (tick) (tick) (tick) (tick) (tick) (tick)

Per-test coverage

(tick)

(tick) via sonar

(tick) JMX / sonar (tick) via extensions (tick) (tick) lists tests per file
Mutation coverage (error) (error) (error) (error) (error) (tick)
Source code metrics
Available metrics 20+ metrics, also custom ones cyclomatic complexity cyclomatic complexity (question) (error) (error)

Report types

HTML

(tick) more details

(tick)

(tick) (question) (tick) (tick)

PDF

(tick)

(error)

(error) (question) (error) (error)

XML

(tick)

(tick)

(tick) (tick) (error) (tick)

JSON

(tick)

(error)

(error) (question) (error) (error)

Text

(tick)

(tick) via cobertura:check

(error) (question) (error) (error)
CSV (error) (error) (tick) (question) (tick) (error)
Data management and report filtering
Merging of coverage databases (tick) clover:merge (tick) (tick) via <jacoco:merge> (tick) (tick) (error)
Historical reporting (tick) more details (tick) via sonar (tick) via sonar (question) (error) (error)
Selecting scope of code coverage file patterns, class patterns, method patterns (entire signature), code block type, statement's regular expression, code complexity, CLOVER:OFF/ON code comments

file patterns,

code annotations

class patterns (question) file patterns package patterns
Cross-report linking (tick) (error) (tick) via <structure> element (question) (error) (error)
Supported languages
Java (tick) (tick) (tick) (tick) (tick) (tick)
Groovy

(tick)

more...
Clover recognizes Groovy-specific language constructs, such as "?.", "?:" operators, properties, methods with default arguments. It also handles Grails-specific AST transformations such as controller classes. Thanks to this, you can see more accurate data in reports (compared to pure byte-code instrumentation tools).
(tick) (tick) (question) (error) (error)
AspectJ (tick) (details) (question) (question) (question) (question) (question)
Other (error) (tick) instrumentation is class-based so theoretically any JVM language is supported, but it may lack good reporting (esp. for language-specific constructs); it may also have problems with synthetic methods etc.
Supported JDK
 

1.6-1.8 (JRE/JDK)

1.3-1.8 (for "-source" level setting)

1.5-1.7 1.5-1.8 1.0-1.8 1.5-1.7 1.5-1.8
Supported test frameworks
JUnit (tick) (error) (4) (tick) (5)
(question) (tick) (tick)
TestNG (tick) (error) (4) (tick) (5)
(question) (error) (tick)
Spock

(tick)

(error) (4) (error) (4) (question) (error) (tick)
Other

(tick)

more...

It's possible to define custom patterns for tests, based on file names, class signatures, method signatures (including annotations and javadoc tags). More details.

(error) (4) (error) (4) (question)

(tick)

more...

It's possible to define test boundaries by special instructions put in code comments

(error)

IDE integrations

IntelliJ IDEA

(tick) (error) (tick) (question) (error) (tick)

Eclipse

(tick)

(tick) eCobertura

(tick) (question) (tick) (tick)
NetBeans (error) (error) (tick) (question) (error) (error)
Build tools integrations
command line (tick) (tick) (tick) (tick) (tick) (tick)

Ant

(tick)

(tick)

(tick) (question) (tick) (tick)

Maven

(tick)

(tick)

(tick) (question) (error) (tick)

Grails

(tick)

(tick) code-coverage

(error) (question) (error) (error)

Gradle

(tick)

(tick) gradle-cobertura-plugin

(tick) (question) (error) (tick)

SBT

(error)

(tick) cobertura4sbt

(tick) (question) (error) (error)

CI servers integrations

Bamboo

(tick)

(error)

(error) (question) (error) (error)

Hudson

(tick)

(tick)

(error) (question) (error) (error)

Jenkins

(tick)

(tick)

(tick) (question) (error) (tick)

TeamCity

(error)

(error)

(tick) (question) (error) (error)

Other integrations

Sonar

(tick)

(tick)

(tick) (question) (error) (tick)

JIRA

(tick)

(error)

(error) (question) (error) (error)

Development activity

Last release

Clover 4.1.2 is the last release published by Atlassian. Since 11-Apr-2017 Clover is open source. See blog post and FAQ.

minor activity,

last release - 2013

actively developed,

few releases / year

(question)

minor activity,

last release - 2011

actively developed,

few releases / year

Technical support

 

Atlassian Support, 24h response

(for customers with active maintenance subscription)

open source community

open source community (question) open source community open source community
Subjective summary
Advantages

Clover has great and highly configurable HTML reports (showing not only code coverage but also top risks etc), per-test code coverage and test optimization, distributed per-test coverage and many tool integrations; it is being actively developed and supported.

Easy to use thanks to off-line byte code instrumentation. You can measure coverage without having the source code. It has very nice and easy to navigate HTML report. Very easy to integrate thanks to the on-the-fly byte code instrumentation. You can measure coverage without having the source code. It has nice HTML report (example). (question) It has the most detailed code coverage metric (MC/DC), which may be useful for critical systems (medical, aeronautical etc). The Eclipse plug-in comes also with a cool Boolean Expression Analyzer view and a Test Correlation matrix. It has also an interesting feature to start/stop test case via JMX, which can be useful for manual testing. PIT is a tool for mutation coverage, which means it will not only measure line coverage of your code but will also perform mutations in application logic in order to check how well written your tests are.
Disadvantages Due to a fact that Clover is based on source code instrumentation, integration requires a build - it's necessary to recompile code with Clover. Most Clover's integrations have an automatic integration feature, but in some cases you may need to add Clover JAR to a class path or set some Clover options. Classes must be compiled with debug option. Classes must be compiled with debug option. (question) Last release has been performed 3 years ago. The HTML report generated is quite fragmented - source code is shown separately for every method.  

1. Statement and line metrics are roughly similar in terms of their granularity (i.e. code has roughly one statement per line). Statement coverage has huge advantage over line coverage in case when language uses many short statements in a single line (a good example is Java8 stream with several map() and filter() calls) - it's more precise as it can detect partially covered lines.

4. While it's possible to instrument test classes and run test frameworks with Cobertura and JaCoCo, there is no built-in, dedicated support for these frameworks. Which means that standard HTML report shows neither test results nor per-test coverage. There is also no per-test data in Eclipse IDE (EclEmma, based on JaCoCo).

5. Sonar can generate separate coverage data sets for every test case and show them in a combined report. See http://deors.wordpress.com/2014/07/04/individual-test-coverage-sonarqube-jacoco/

 

Q: Why Emma is not included in this report?

A: The original Emma is a dead tool, last release has been made in 2005. On the other hand, the Eclipse Emma (EclEmma), which was originally based on Emma, since version 2.0 (released 2011) is based on JaCoCo. So its feature set is the same as for JaCoCo. 

 

Last modified on Apr 10, 2017

Was this helpful?

Yes
No
Provide feedback about this article

Not finding the help you need?

Ask the community

Powered by Confluence and Scroll Viewport.