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

Why coverage tool JaCoCo reports 100% coverage?

I added to my project JaCoCo by editing app level build.gradle: plugins{ ... id 'jacoco' } jacoco { toolVersion = "0.8.7" } buildTypes { debug { testCoverageEnabled = true } } android { //... } dependencies{ …
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
0
votes
1 answer

Dev Azure: No code coverage results were found to publish

I'm trying to see my code coverage in my pipeline summary project details: Java spring Error: ##[warning]No code coverage results were found to publish. Pipeline: - task: Maven@3 displayName: Maven SoftwareEngineeringBackend/pom.xml …
0
votes
1 answer

Code coverage 0% with sonarqube 8.9 upgrade - scala project

In console output, we are getting jacoco coverage report. but on sonar it shows 0% and project using build.sbt file. and in jenkins -Dsonar.coverage.jacoco.xmlReportPaths=".../jacoco.xml" instead of - Dsonar.jacoco.reportPath="../jacoco.exec" still…
hanu
  • 1
0
votes
2 answers

Sonar Jacoco not considering Kotlin androidTest (integration test case) in coverage

I have local and integrated test cases written for my android project. Using Kotlin(1.4.21) Robolectric(4.5.1), sonar(2.7.1), Jacoco(maven plugin 0.8.2) The problem is that the Sonar and Jacoco is not considering androidTest(integration test case)…
Astha Garg
  • 1,022
  • 7
  • 21
0
votes
1 answer

How to disable stacktrace trimming in JaCoCo Failsafe test execution?

The stactrace output by the unit test is truncated and not useful because of that. I don't have access to the surefire reports and the majority of the logs are suppressed because of the log level set in the command below. I also can't change the mvn…
ScrappyDev
  • 2,307
  • 8
  • 40
  • 60
0
votes
1 answer

Different jacoco coverage results in a github action environment

is there any reason for a jacoco coverage report to produce different results when running it in a CI environment? I have the following situation after migrating to Java 17. when I run ./gradlew clean build the report is generated and the…
0
votes
1 answer

SonarQube & JaCoCo (mvn) naming convention

I started using SonnaQube & JaCoCO (java mvn) and I noticed that some test when I name them like this ("myClassTest")doesn't count in the coverage statistic but when I name it like this ("myClassIT") it counts. What I figured out is that every time…
0
votes
1 answer

Robolectric + JaCoCo | Issue while running unit test and not generating code coverage

I have added Robolectric to get support of Shadow APIs for writing unit tests. Able to get coverage percentage through default Intellij code coverage tool in Android Studio. Now trying to add JaCoCo to get enhanced coverage report. I'm using file…
Prat
  • 143
  • 3
  • 17
0
votes
0 answers

What is the best way for using JaCoCo in Maven phases?

What is the best way for using JaCoCo in Maven phases? I mean what's phase I should choose to run JaCoCo in my ci pipeline? Test phase or verify? What is the difference between the two types of using? I have three execution sections in my POM file. …
Victor Levin
  • 238
  • 2
  • 7
0
votes
0 answers

Jacoco method missed count can't detect mockk tests

Jacoco keeps reporting my missed method counts being high while I've actually been having good coverage with mockk, any idea why Jacoco method counts can't pick up mockk coverages? And are there any other test coverage libraries that work well with…
thousight
  • 1,134
  • 1
  • 14
  • 39
0
votes
1 answer

How to get SonarQube code coverage for scala project

I am running the goal from Teamcity for Scala project as org.jacoco:jacoco-maven-plugin:prepare-agent -U sonar:sonar My pom.xml file looks like: 2.0
Priya
  • 173
  • 6
  • 18
0
votes
1 answer

Trying to set jacoco-check code coverage on submodule

I have some submodules in my application. Some I wish to have code coverage rules and some I wish to exempt completely. My project's root POM inherits from a parent POM which has JaCoCo configured as so: org.jacoco
Nanor
  • 2,400
  • 6
  • 35
  • 66
0
votes
1 answer

Include multiple sourcesets in the Jacoco's jacocoTestReport.xml file

I have a custom sourceSet defined in a Gradle based project, like this: sourceSets { componentTest { java { compileClasspath += main.output + test.output runtimeClasspath += main.output + test.output …
Lukasz G.
  • 119
  • 1
  • 10
0
votes
1 answer

Android CodeCov/Jacoco for Library Module

I am trying to implement CodeCov/Jacoco as described here: https://about.codecov.io/blog/code-coverage-for-android-development-using-kotlin-jacoco-github-actions-and-codecov/ This guide works really well for the main app module, specified with…
0
votes
0 answers

Test coverage for private function is 0% using jacoco offline instumentation

I am using jacoco offline instumentation but dont see code coverage in the report for private function- getName(). When i run the jacoco reports, the coverage for getName() is 0%. Is there something wrong with the Junit or the configurations? Below…
NKZ
  • 9
  • 4