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
210
votes
25 answers

Getting "Skipping JaCoCo execution due to missing execution data file" upon executing JaCoCo

I'm using Maven 3.0.3, JUnit 4.8.1, and Jacoco 0.6.3.201306030806, and I am trying to create test coverage reports. I have a project with unit tests only, but I can't get reports to run, I'm repeatedly getting the error: Skipping JaCoCo execution…
Dave
  • 15,639
  • 133
  • 442
  • 830
184
votes
16 answers

Filter JaCoCo coverage reports with Gradle

Problem: I have a project with jacoco and I want to be able to filter certain classes and/or packages. Related Documentation: I have read the following documentation: Official jacoco site: http://www.eclemma.org/jacoco/index.html Official jacoco…
Jared Burrows
  • 54,294
  • 25
  • 151
  • 185
163
votes
13 answers

How to configure multi-module Maven + Sonar + JaCoCo to give merged coverage report?

I've searched up and down the internet for this one. There's lots of half-answers out there, to do with Maven properties such as ${sonar.jacoco.reportPath}, or org.jacoco:jacoco-maven-plugin:prepare-agent or setting maven-surefire-plugin argLine…
Stewart
  • 17,616
  • 8
  • 52
  • 80
146
votes
9 answers

Maven Jacoco Configuration - Exclude classes/packages from report not working

I have a maven multi-module project and I'm using jacoco-maven for code coverage reports. Some classes should not be reported, as they're Spring configuration and I'm not interested in them. I have declared the maven-jacoco plugin as…
resilva87
  • 3,325
  • 5
  • 32
  • 43
104
votes
12 answers

how to use jacoco.exec report

I generated a code coverage report from jacoco, which is jacoco.exec. But I don't know how to use it ... The way I generated it is through command line: java -javaagent:/path/to/jacocoagent.jar=include=some.package.*,output=file…
wlhee
  • 2,334
  • 4
  • 18
  • 19
80
votes
8 answers

JaCoCo SonarQube incompatible version 1007

I'm using SonarQube for code quality control and suddenly builds that would otherwise pass can't be analyzed and fails. [INFO] [00:00:03.630] Analysing /mySuperProject/target/jacoco.exec -> java.io.IOException: Incompatible version 1007 When I…
Padvinder
  • 971
  • 1
  • 6
  • 9
80
votes
10 answers

SonarQube not picking up Unit Test Coverage

I am having issues with sonar picking up the jacoco analysis report. Jenkins however is able to pick up the report and display the results. My project is a maven build, built by Jenkins. The jacoco report is generated by maven (configured in the…
anton91
  • 993
  • 2
  • 10
  • 12
78
votes
10 answers

Cannot use jacoco JVM args and surefire JVM args together in maven

I am using maven with the jacoco plugin to generate code coverage metrics. I am having some difficulty in configuring the surefire plugin with the java options required by the jacoco plugin. I've seen some answers about this already on Stack…
John Q Citizen
  • 3,138
  • 4
  • 26
  • 31
72
votes
6 answers

How would I add an annotation to exclude a method from a jacoco code coverage report?

I have some code in Java that I want to exclude from code coverage. How would I do this? I want to be able to add an annotation. Is there a way to configure or extend jacoco (as used in gradle) to use this? Example: public class Something { …
Don Rhummy
  • 24,730
  • 42
  • 175
  • 330
63
votes
6 answers

8 branches for try with resources - jacoco coverage possible?

I've got some code that uses try with resources and in jacoco it's coming up as only half covered. All the source code lines are green, but I get a little yellow symbol telling me that only 4 of 8 branches are covered. I'm having trouble figuring…
Gus
  • 6,719
  • 6
  • 37
  • 58
58
votes
4 answers

JaCoCo: exclude generated methods (using it with Lombok)

I am using JaCoCo and it is considering methods generated by Lombok (generated in the bytecode, not trace of them in the source code). How can I configure JaCoCo to ignore them?
Federico Tomassetti
  • 2,100
  • 1
  • 19
  • 26
55
votes
7 answers

Testng, Emma, Cobertura, coverage and JDK 7 result in ClassFormatError and VerifyError

I have switched to the newest JDK 7 and I am having problems with running testng unit test on byte code that is fiddled by emma coverage tool. None of my test cases are run correctly and for most of them I am receiving such errors. …
Jagger
  • 10,350
  • 9
  • 51
  • 93
51
votes
6 answers

Jacoco coverage in Jenkins Pipeline

Can anyone suggest if there is a way to execute Jacoco in a Jenkins Pipeline? I have downloaded the plugin but I do not get the option for Jacoco in the 'Pipeline Syntax', which is the Pipeline script help . Referred this URL:…
user5917011
  • 1,137
  • 5
  • 14
  • 22
47
votes
7 answers

maven jacoco: not generating code coverage report

I am trying to setup jacoco for my project's code coverage My project is based on Java 1.8 Here is how things look in my project's pom.xml org.jacoco jacoco-maven-plugin
daydreamer
  • 87,243
  • 191
  • 450
  • 722
44
votes
10 answers

Merging Integration and Unit test reports with JaCoCo

I am generating failsafe and surefire reports with maven with the JaCoCo plugin, but I can only manage to get them in separate reports. I would like to have a overall coverage view (merge between both Unit Tests and Integration Tests) as well.…
1
2 3
99 100