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
26
votes
4 answers

Gradle : How to generate coverage report for Integration test using jacoco

I am new to gradle. I am using the below code. But it generates coverage for unit test cases. But it didn't generate for integration test cases. I have my test classes in the package src/test/java. test { dependsOn jettyRunWar ignoreFailures…
Veera
  • 1,775
  • 2
  • 15
  • 19
25
votes
6 answers

Jacoco: For report generation the same class files must be used as at runtime

I have been working on an android project and use roboletric and powermock to do unitTests. When I run gradle jacocoTestReport, it will show [ant:jacocoReport] Classes in bundle 'app' do no match with execution data. For report generation the same…
alec.tu
  • 1,647
  • 2
  • 20
  • 41
24
votes
1 answer

Jacoco Android createDebugCoverageReport not found

I want to run my tests in Android app and create coverage reports, so I added Jacoco configuration into my build.gradle file, but it doesn't work. apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion…
Margarita Spasskaya
  • 643
  • 2
  • 10
  • 24
24
votes
7 answers

Exclude packages from Jacoco report using Sonarrunner and Gradle

Is there a way to exclude packages from SonarQube(instrumented by gradle + sonar-runner) coverage reports(generated by jacoco) without excluding them completely from the project ? Below is what i tried so far: Version information SonarQube…
fyr
  • 20,227
  • 7
  • 37
  • 53
24
votes
5 answers

Maven JaCoCo plugin error

I have configured the Maven JaCoCo plugin as follows in my pom.xml file: UTF-8 0.5.9.201207300726
kirigiri
  • 269
  • 1
  • 2
  • 5
23
votes
3 answers

How to configure sonar.coverage.jacoco.xmlReportPaths for JaCoCo/SonarQube?

SonarQube 7.7 shows the following warning for a Java project analysis: Property 'sonar.jacoco.reportPath' is deprecated (JaCoCo binary format). 'sonar.coverage.jacoco.xmlReportPaths' should be used instead (JaCoCo XML format). The Gradle based…
JJD
  • 50,076
  • 60
  • 203
  • 339
22
votes
2 answers

Gradle Jacoco - Could not find method jacocoTestReport()

I'm trying to generate a Jacoco test report in Gradle. When I try to sync my code, I will receive the following error: Error:(56, 0) Could not find method jacocoTestReport() for arguments [build_38ehqsoyd54r3n1gzrop303so$_run_closure4@10012308] on…
Guido
  • 1,161
  • 3
  • 12
  • 33
21
votes
4 answers

Sonarqube bad coverage because of lombok @Data

I use jacoco for coverage report. When I look at the jacoco report, coverage seems to be good. But in Sonarqube, the coverage is low because it says that @Dataannotation from lombok is not cover by test. Compiled classes is mark as @Generated but…
Martin Choraine
  • 2,296
  • 3
  • 20
  • 37
21
votes
2 answers

How can I verify the minimum coverage with some excluded classes and with the jacoco plugin?

I need to check the minimum coverage with the new jacoco task jacocoTestCoverageVerification This task is available with in the 3.4.1 gradle release and with the jacoco plugin >= 0.6.3 I could run another task that generates an html report with the…
Juan Pressacco
  • 313
  • 1
  • 2
  • 6
21
votes
1 answer

Sonarqube overall coverage does not match jacoco report coverage

I have a multi-module Android project and I'm seeing a discrepancy between the coverage that jacoco reports and what Sonarqube reports. The project is also a multi-flavor project that generates a lot of different variants. I am using this plugin to…
Nelson Ramirez
  • 7,864
  • 7
  • 28
  • 34
21
votes
4 answers

Gradle Jacoco and JUnit5

We just ported our unit tests to JUnit5. Realizing that this is still rather early adoption with little hints on google. The most challenging was to get jacoco code coverage for the Junit5 tests which we use on jenkins. Since this took me almost a…
C. Ledergerber
  • 261
  • 2
  • 6
21
votes
1 answer

Run single test to check code coverage Jacoco Android

I'm using ./gradlew createDebugCoverageReport to generate a code coverage report of all my Android instrumentation (Robotium) tests. But I need to run all tests in order to get the coverage report now. How can I specify one single test (or single…
Thomas Vervik
  • 4,325
  • 9
  • 36
  • 64
21
votes
4 answers

JaCoCo - SonarQube - No information about coverage per test

I'm using JaCoCo for Code Coverage. The Unit Test reports are created with junit and they are imported correctly, so that the unit test information is shown properly. The problem is, that I get the error message: No information about coverage per…
Stelos10
  • 451
  • 2
  • 6
  • 15
21
votes
2 answers

jacoco's prepare-agent not generating jacoco.exec file

I am running Jacoco's Maven plugin. The prepare-agent goal runs fine, but does not generate jacoco.exec file for some reason. Subsequently the report goal complains Skipping JaCoCo execution due to missing execution data file. Any ideas?
Gili
  • 86,244
  • 97
  • 390
  • 689
20
votes
2 answers

Kotlin JaCoCo, no coverage -> IllegalClassFormatException ... Please supply original non-instrumented classes

kotlin verion: 1.3.61 Android Gradle Plugin: 3.5.3 JaCoCo Version: 0.8.4.201905082037 (default android gradle version) project: https://github.com/goldy1992/Mp3Player/tree/feature/issue-112/migrate-to-kotlin I have a multi module gradle project…
goldy1992
  • 893
  • 11
  • 17