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
9
votes
1 answer

What is the difference between jacoco branch coverage and Sonar condition coverage?

I'm trying to analyze java code with the SonarQube Scanner (version 3.1.0.1141). SonarQube version : 5.6.6 Sonar Java plugin version : 4.12.0.11033 jacoco version : 0.8.0 I have filled the sonar-project.properties with those properties : # Sonar…
Alban
  • 123
  • 1
  • 1
  • 5
9
votes
2 answers

IntelliJ IDEA Testing - How to display branch coverage

In Eclipse with jacoco, I can get branch coverage percentage. But in IntelliJ IDEA, I can only get lines&method coverage percentage in coverage window. How to summarize branch coverage in IntelliJ IDEA?
Lixin Wei
  • 441
  • 5
  • 17
9
votes
1 answer

Jacoco generate coverage report for only a single test class

So let us say I have a test @Test public void testA(){ new A().doSomthing(); } And let us say it covers a method doSomething(), Now in my project, I have 10million tests and this test is just one of those. A small test doesn't do much. Now let…
Bhargav
  • 8,118
  • 6
  • 40
  • 63
9
votes
2 answers

Why does stash/unstash not work in this Jenkinsfile?

I've got a Jenkins server running onsite, and it uses a Jenkinsfile to manage a pipeline that uses the parallel test executor plugin to run all my JUnit tests on several agents to speed the test up. We have a blade server we made (way cheaper than…
vextorspace
  • 934
  • 2
  • 10
  • 25
9
votes
2 answers

Could not find method jacocoTestCoverageVerification()

I want to make jacoco plugin to fail when test coverage is not enough. I use example from gradle page : https://docs.gradle.org/current/userguide/jacoco_plugin.html apply plugin: 'jacoco' jacoco { toolVersion = "0.7.6.201602180812" …
Jacob
  • 1,135
  • 5
  • 14
  • 29
9
votes
3 answers

How to configure JaCoCo maven plugin from command line

I'm trying to configure JaCoCo maven plugin from command line instead of using pom.xml. I have managed to execute prepare-agent so far with command: mvn -X -Djacoco.destFile=./coverage/jacoco.exec clean org.jacoco:jacoco-maven-plugin:prepare-agent…
widget
  • 421
  • 1
  • 5
  • 17
9
votes
1 answer

Cobertura : how to cover spring-data @Repository interfaces

Regarding following information : https://stackoverflow.com/a/14601831/704246 Cobertura does not instrument interfaces I'd like to know how to add spring-data interfaces to coverage results, since @Repository implementation classes are only…
Saad Benbouzid
  • 502
  • 6
  • 16
9
votes
3 answers

How can i run Jacoco in android studio for code coverage

I have a debug flavor in android studio already. My gradle config file for my app module contains the following: debug{ testCoverageEnabled true } then i run the following command in the terminal: gradlew createDebugCoverageReport and indeed I…
j2emanue
  • 60,549
  • 65
  • 286
  • 456
9
votes
1 answer

SonarQube unit tests w/o binaries

After endless googling and reading tons of documentations, I am completely finsihed. I want to import already created unit tests reports like .xml and .exec-files (JUnit and Jacoco) into SonarQube. The Problem is Sensor…
TeamHundM
  • 101
  • 1
  • 3
9
votes
3 answers

Display test coverage using jacoco in gradle

I am using a gradle file to build my project. In this file I am using jacoco to produce a test report. What I want to do is modify the build file so that it displays a message if my test coverage isn't 100%. Or at least just display the test…
ThomYorkkke
  • 2,061
  • 3
  • 18
  • 26
9
votes
2 answers

Jacoco - Zero Percent Coverage

I am trying to integrate jacoco to our ant build and evaluate it with a simple test project. The compilation and the other output looks promising, but when I look at the coverage it is always zero. package alg; public class SpecialAlgorithm { …
mkuff
  • 1,620
  • 6
  • 27
  • 39
9
votes
1 answer

Code Coverage with Jenkins

I am being asked to use Jenkins to test code coverage for a Java Project. The issue is I have never used Jenkins and have scarcely little experience with actual code coverage. I have been searching a bit and I have come across JaCoCo and Cobertura…
EasilyBaffled
  • 3,822
  • 10
  • 50
  • 87
9
votes
1 answer

JaCoCo - exclude JSP from report

In the Maven site reports generated by JaCoCo, I get quite bad coverage because all of my compiled JSPs are included (and they are long). I tried the following in reporting: org.jacoco
Michael Piefel
  • 18,660
  • 9
  • 81
  • 112
9
votes
1 answer

jacoco not excluding classes when using ant

I'm having trouble getting a jacoco/junit ant target to exclude classes from coverage. I can get it to exclude packages though with something like this:
adhamh
  • 321
  • 2
  • 5
8
votes
3 answers

How do I make Jenkins, Sonar and the JaCoCo plugin work together for Eclipse Tycho Plugin Projects (or maybe Cobertura)?

my setup is: Jenkins 1.448 Sonar 2.13 Jenkins Sonar Plugin 1.72 a MySql database for Sonar I have the following project: Eclipse Plugin Project using Maven multiple modules (parent maven project, source plugin project, test fragment project) a…
danowar
  • 675
  • 1
  • 11
  • 21