Questions tagged [jacoco]

JaCoCo a coverage analysis tool. It runs as a JVM Agent and therefore does not require offline instrumentation.

JaCoCo is an EPL-licensed, open-source code coverage analysis tool. It runs as a JVM Agent and therefore does not require offline instrumentation.

Compared to Cobertura, it has lower runtime overhead but less precision. It is unable to record hit counts, it only records red/green, however it can show coverage on class, method, line, complexity, branch and instruction level. It also has the ability to merge the results of multiple analyses when generating a report.

QuickLinks:

Related Tags:

JaCoCo is the successor of the EclEmma Eclipse plugin for the Emma coverage tool. If a search through -tagged questions doesn't help, try searching for the tag.

The tag is used for general topics related to code coverage measurement.

1891 questions
43
votes
5 answers

How do I get a jacoco coverage report using Android gradle plugin 0.10.0 or higher?

I'm trying to get a test coverage report using Gradle Android plugin 0.10.2. But I still can't get a coverage report after running some tests. (connectedAndroidTest). my main module's build.gradle is : apply plugin: 'android' android { …
Taeho Kim
  • 1,865
  • 2
  • 14
  • 16
43
votes
1 answer

Jacoco with Gradle 0.10.0: Remote object doesn't exist

UPDATE Oct 21, 2014: The issue has been confirmed as fixed by using buildtools 21. UPDATE SEPT 18, 2014: The issue's status has been updated to FutureRelease. UPDATE: I have heard that this may not work with Dagger, and since Espresso uses Dagger,…
Maxwell
  • 6,532
  • 4
  • 37
  • 55
42
votes
5 answers

Coverage view shows 0.0% in Intellij when using Jacoco

As discussed in Open JaCoCo report in Intellij IDEA, when I gather code coverage statistics using Jacoco (rather than native IntelliJ tracing) 0.0% (i.e. "no" coverage) is always shown in the coverage window. This is after I have done the whole…
robert
  • 4,612
  • 2
  • 29
  • 39
42
votes
9 answers

Jacoco and Unit Tests Code Coverage with android-gradle-plugin >= 1.1

I recently started integrating android-gradle-plugin 1.1.0 in one of my projects. The project uses robolectric 2.4 to run unit tests. It's a multi module project with very complex dependencies (Some modules depend on other modules). Something like…
Serj Lotutovici
  • 4,370
  • 5
  • 32
  • 41
42
votes
5 answers

JaCoCo Can't add different class with same name: org/hamcrest/BaseDescription

Hi I'm hitting the following exception when running a JaCoCo coverage: org.jacoco jacoco-maven-plugin 0.5.8.201207111220
DarVar
  • 16,882
  • 29
  • 97
  • 146
41
votes
9 answers

Code coverage report using gitlab-ci.yml file

I need to see code coverage report for a java maven project in Gitlab. According to this, this and some other sources: I added jacoco to the list of plugins in pom.xml. Added pages job to my .gitlab-ci.yml file. Added Total.*?([0-9]{1,3})% to code…
AshKan
  • 779
  • 2
  • 8
  • 22
41
votes
12 answers

Unable to get Jacoco to work with Powermockito using offline instrumentation

Given that Jacoco doesn't play nicely with PowerMockito when instrumenting "on the fly", I've been trying to configure offline instrumentation in the hope this will give me proper unit test coverage for classes that use PowerMockito. I've setup my…
MandyW
  • 1,117
  • 3
  • 14
  • 23
41
votes
5 answers

Running jacocoReport

I'm using Gradle 1.7 and Jacoco plugin. My project uses Java and Scala plugins. When I run gradlew -i clean jacocoTestReport Report is not created and I see in the log :bl:jacocoTestReport (Thread[Daemon Thread 13,5,main] -…
Pavel Bernshtam
  • 4,232
  • 8
  • 38
  • 62
40
votes
3 answers

Open JaCoCo report in Intellij IDEA

I am trying to find dead code on our application by using a code coverage tool (rather a static code analysis tool). I have chosen JaCoCo and am able to get a report thanks to the JaCoCo agent. I know that Intellij IDEA works with JaCoCo but I…
tibo
  • 5,326
  • 4
  • 37
  • 53
39
votes
3 answers

JaCoCo returning 0% Coverage with Kotlin and Android 3.0

I am trying to check my code coverage for a test case that I wrote in Kotlin. When I execute ./gradlew createDebugCoverageReport --info, my coverage.ec file is empty and my reports indicate that I have 0% coverage. Please note, the test cases are…
Floam
  • 704
  • 1
  • 8
  • 20
38
votes
6 answers

Jacoco Maven multi module project coverage

Seems like there are couple of questions, which are quite old and things changed from Java 8 support of Jacoco. My Project contains following structure pom.xml | | -----sub module A pom.xml | | -----sub module B pom.xml | | -----sub module C…
RaceBase
  • 18,428
  • 47
  • 141
  • 202
37
votes
5 answers

jacoco code coverage report generator showing error : "Classes in bundle 'Code Coverage Report' do no match with execution data"

I am generating jacoco report by using jacoco:report tag. I am getting errors like : [jacoco:report] Classes in bundle 'Code Coverage Report' do no match with execution data. For report generation the same class files must be used as at…
Nishant Lakhara
  • 2,295
  • 4
  • 23
  • 46
37
votes
4 answers

Android test code coverage with JaCoCo Gradle plugin

I'm new to Gradle and Android testing but I've already converted my Android project to build with Gradle. Now I'm trying to perform test coverage of an Android project with Gradle's JaCoCo plugin. I've added the following to my build.gradle…
Henrique Rocha
  • 1,737
  • 1
  • 19
  • 29
33
votes
4 answers

Sonarqube is not showing code coverage after running

I'm running sonarqube with maven. I have installed it using following way. Using brew, I installed mysql and sonar. When I run I get 7 critical bugs but the code coverage for 88 tests is zero When I run it with IntelliJ's tools, I get the…
Tarun Maganti
  • 3,076
  • 2
  • 35
  • 64
32
votes
5 answers

Minimum code coverage threshold in Jacoco Gradle

How can I set the minimum code coverage in Jacoco Gradle? I want the build to fail if it is not met.
richersoon
  • 4,682
  • 13
  • 44
  • 74