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

How to get 100% of coverage on lambda method [JAVA]

I tried everything to get 100% of coverage on this lambda method but no matter what I do I don't get it. private String createMessage(List erros) { return erros.stream().collect(Collectors.toMap(FieldError::getField,…
0
votes
0 answers

Is there a way to set Jacoco as default code coverage tool in IntelliJ?

As the title suggests, I would like to know if there's a way to set Jacoco as default code coverage tool in IntelliJ, meaning that I don't want to edit my run configuration to Jacoco every time I create a new project, which is what I currently have…
0
votes
1 answer

Powermock with jacoco code coverage in maven

Have followed The instructions in https://github.com/jfcorugedo/sonar-scanner/blob/master/pom.xml and also used jacoco offline instrumentation as mentioned in Powermock documentation but when I use the below configuration the code coverage shows…
0
votes
1 answer

Command to publish Jacoco code coverage to sonar

I can see different maven configuration and commands to publish Jacoco coverage to Sonar but is there any command without maven, ant etc which can publish Jacoco coverage to Sonar? I've a Jacoco coverage report file to publish.
Alpha
  • 13,320
  • 27
  • 96
  • 163
0
votes
2 answers

Jacoco coverage percentage maven

When runnning mvn test, my spring boot application builds succesfully. When I do mvn clean install or mvn clean verify, build fails. This is because I have minimum code coverage ratio configured to 80%. When I run mvn clean install/verify, the…
0
votes
0 answers

How to gather Jacoco coverage information in xml file?

I used following command to gather coverage information in xml file - java -javaagent:/home/user/jacoco-0.8.6/lib/jacocoagent.jar=destfile=/home/oracle/jacoco-coverage.xml,append=false,includes=com.myapp.* -jar myapplication.jar This generates…
Alpha
  • 13,320
  • 27
  • 96
  • 163
0
votes
0 answers

How to use regular expressions in gradle exec?

Since the Gradle integrated jacoco plugin cannot be used, there is a task skipped problem. I try to use Jacoco Command Line Interface and Exec - Gradle DSL Version 7.0. def reportTask = tasks.create(reportTaskName, Exec.class) { group =…
Xuesong Ye
  • 505
  • 5
  • 13
0
votes
1 answer

Jacoco not considering coverage for all test classes

I have jacoco running for my build and I noticed if there's 2 test classes testing the same main class, coverage from one of the test classes is missing. For example, I have a class MyApp. Now I have MyAppTest and MyAppLatestTest. In this case only…
Ganesh
  • 109
  • 2
  • 9
0
votes
1 answer

Multi-module Android project code coverage report always shows 0% coverage

I want to generate unit and integration test coverage html report for my Android project. This project is composed of 3 modules: app module (I don't really want to make a report for this module) sdk module (real target of the…
Thibaut
  • 1
  • 2
0
votes
1 answer

how to get coverage report as jacocoTestReport.xml in React project

I am using jenkins pipeline for my React project to with test, build and deploy steps. I integrated sonarqube with my project. But sonar's jacoco doesn't assess my coverage report which is in generic coverage format(test-report.xml) Is there a way…
msahin
  • 1,520
  • 1
  • 16
  • 22
0
votes
1 answer

JACoCo/surefire-plugin does not find tests to run

All my tests are located in src/test/java/... with java marked as a test source folder. They are also all named as ***Test so Surefire plugin should be finding them. However my maven verify fails as all my test coverage is at 0%. I have 20 tests…
shirafuno
  • 387
  • 3
  • 9
  • 24
0
votes
1 answer

Cobertura coverage failing

I am running into issues similar to [https://stackoverflow.com/questions/25432810/error-when-trying-to-use-org-codehaus-mojocobertura-maven-plugin2-6]. LOGS: Execution default-cli of goal org.codehaus.mojo:cobertura-maven-plugin:2.6:instrument…
harry123
  • 760
  • 1
  • 7
  • 22
0
votes
3 answers

Android - Jacoco does not generate xml report properly

We've integrated JaCoCo plugin to our Android project for measuring the code coverage via SonarQube. However, it could not be measured. Because SonarQube expects coverage report as an XML format. We add a custom jacocoTestReport task to…
tugceaktepe
  • 195
  • 1
  • 2
  • 17
0
votes
1 answer

Create Jacoco report for external repository

I have a Spring-Boot maven repository. I can't alter pom.xml to add jacoco-maven-plugin. But I need a test coverage report for this repository. So my idea was to execute the following command: mvn clean verify…
htshame
  • 6,599
  • 5
  • 36
  • 56
0
votes
1 answer

JaCoCo does not work for Mockito test cases

I have mocked by spring boot service class for testing the catch block statements. My sample test case is like: @SpyBean private EmployeeService employeeService; @Test public void employeedetails() throws CustomException { Employee employee=…
Debugger
  • 690
  • 1
  • 18
  • 41