Questions tagged [jacoco]

JaCoCo a coverage analysis tool. It runs as a JVM Agent and therefore does not require offline instrumentation.

Filter by
Sorted by
Tagged with
0 votes
0 answers
32 views

Jacoco report is not generate with jmockit argline of surefire plugin

I created a simple spring-boot application to demonstrate the issue after I faced a similar issue in my product code and explained the problem using the Dummy project. I used testNg for writing unit ...
Manoj Madushanka's user avatar
-4 votes
0 answers
39 views

How to write unit test to cover lines inside a method of a Java class? [closed]

In my project we use mockito to write unit tests and sonar and jacoco for code analysis and coverage. I am new to mockito, but if I have a method like below: public void foo(String id, Date d) { ...
J.E.Y's user avatar
  • 1,165
0 votes
0 answers
20 views

java tests using jacoco

I have a folder with tests for the project (src/test/java/com.example.carsharing). There are currently 5 test classes. And one of them just throws an error (AuthServiceTest). All other of them work ...
Andi's user avatar
  • 1
-1 votes
1 answer
17 views

Jacoco report missing branches but tests are existing for those

I have Spring Boot maven multimodule project with java version 21 and for code coverage using Jacoco version 0.8.11. Unit test are written using groovy. I have class like this: package ****************...
Michael's user avatar
  • 166
-1 votes
0 answers
16 views

How to Configure JaCoCo Line Coverage for a JAR File using JaCoCo agent in Dockerfile to generate jacoco.exec in container

I'm currently working on a Java project where we package our application as a JAR file. I'd like to integrate JaCoCo to measure line coverage during our CI/CD process (we're open to using Jenkins or ...
Manju Manohar's user avatar
0 votes
0 answers
28 views

Facing issue in getting code coverage for android app using gradle 7.5 when appium test are executed

I have an android project which was recently updated from gradle 6.7 to gradle 7.5, and it broke the code coverage workflow. Scenario: I have an android project named Android-Example-Project and it ...
Rahul Sharma's user avatar
0 votes
0 answers
20 views

Generate html report from jacoco agent inside a docker container

I have a Dockerfile and run a spring boto application with jacoco agent inside a container COPY jacocoagent.jar ./jacocoagent.jar ENTRYPOINT ["java", "-javaagent:jacocoagent.jar=port=...
Nha Phan's user avatar
0 votes
0 answers
14 views

How to Configure Jacoco code coverage report into Java Play framwork project?

Can someone please give example of how I can set up jacoco report into play project? MY Plugin.sbt looks like below resolvers += Resolver.sonatypeRepo("public") // (not entirely sure this ...
khushbu's user avatar
1 vote
0 answers
34 views

Jacoco code coverage report is showing zero in AOSP junit testing

I am working in AOSP for automotive and in Junit test I can get coverage report using Jacoco but it is zero everytime even after tests successfully run. Please help me on this. I am doing this with ...
Arti Gupta's user avatar
1 vote
0 answers
148 views

Jacoco 0.8.8 with maven having zero code coverage with JDK17 and Sonarqube 9.9.2.77730

I am upgrading my spring boot microservice from Java11 to Java17, service build and run successfully with use of maven. I have added jacoco-maven-plugin plugin for unit test cases coverage but when I ...
Piyush Chaudhari's user avatar
0 votes
1 answer
41 views

SonarQube Reading Becomes 0 after upgrading from Java 8 to 11

I recently upgraded my project from Java 8 to 11. For the dependency of Jacoco, i upgraded jacoco-maven-plugin from version 0.7.6.201602180812 to 0.8.7 After that, my Sonar code coverage becomes 0. ...
Oragon's user avatar
  • 9
0 votes
0 answers
13 views

Exclude package but include one class in JaCoCo report

I have a lot of autogenerated and a few handwritten classes in same package. I want to exclude all of the autogenerated classes without adding each of the exclusions. Is there a way to exclude the ...
jJavier52's user avatar
0 votes
0 answers
34 views

Issues with Jacoco Agent in Android Project After Migrating to Kotlin 1.8.20, Java 17, and Gradle 8.0

I'm currently working on generating a Jacoco report for my Android project. The project is using Kotlin 1.8.20, Java version 17, and Gradle version 8.0. In my build.gradle file, I've added the Jacoco ...
Suresh P's user avatar
0 votes
0 answers
50 views

jacoco-aggregate give an empty report

I am trying to do a jacoco-aggregate to send it to sonarqube according to this post: https://community.sonarsource.com/t/coverage-test-data-importing-jacoco-coverage-report-in-xml-format/12151 ...
HelloWorld888's user avatar
0 votes
0 answers
8 views

jacoco: Set coverage metric

I have the following result Of the coverage totals that appear in the image (20% and 2%) I want to establish a minimum I have been trying the following code but without the expected results <...
cekodis681 cekodis681's user avatar
0 votes
1 answer
64 views

How to print Jacoco code coverage with Azure Devops for a Android Project?

We use Azure DevOps to build our Android App and distribute it. The code is written in Kotlin. We are using the Gradle@2 script as defined in the following document. https://learn.microsoft.com/en-us/...
user866821's user avatar
0 votes
1 answer
87 views

Code coverage report for testcases written in robot framework for Java application

I have a scenario where I am trying to get the coverage report of the functional testcases we have written using robot framework. Application backend is written in java and UI code is written Vue.js ...
Utkarsh Singh's user avatar
0 votes
1 answer
46 views

How to exclude files from JaCoCo report with Gradle

I am trying to exclude some files in a multi-module Spring Boot project. I tried using the excludes extension from JaCoCo in test as well as adding an afterEvaluate block in jacocoTestReport. Neither ...
Neha P's user avatar
  • 23
0 votes
0 answers
130 views

Sonar cloud not submitting jacoco xml coverage file

I have an app with a separate module. I am looking to combine code coverage in a single xml report and submit to sonar cloud. I have managed to combine the coverage thanks to the help of this blog ...
DJ-DOO's user avatar
  • 4,575
0 votes
1 answer
31 views

Is there a tool or an approach that will give us the code coverage of a Java app by running the UI functional tests written using selenium with python

We have a an application built using Java. The JUnit tests are run and configured with JaCoCo to get the code coverage of the unit tests. We have our testframework built using Python with Selenium for ...
Kavya Padmanabha's user avatar
0 votes
1 answer
43 views

How to test javascript and Groovy in one Gradle Project

I have a situation where I am trying to test Groovy and Javascript in same project. Following are my folder structure All the source script available in below folder src/main/javascript src/main/...
Gajendra Kumar Sahu's user avatar
1 vote
4 answers
264 views

Jacoco Not Showing Coverage for Robolectric Tests in Android Studio

I'm facing an issue where the Jacoco code coverage results aren't showing up for unit tests that use Robolectric. The tests execute and pass successfully, but the Jacoco coverage seems to ignore files ...
Michael's user avatar
  • 13.2k
1 vote
0 answers
33 views

Jacoco code coverage for Karate tests which are executing on mock server

We have springboot project with gradle. We have Karate API tests which are executed using mock server and mock APIs. We want to check code coverage for these tests using Jacoco plugin. After execution,...
swapna's user avatar
  • 203
0 votes
1 answer
16 views

Android JacocoReport task not executed

I'm trying to get code coverage to work, but for some reason my registered jacoco task doesn't get executed. I added this code to my modules build.gradle tasks.register<JacocoReport>("...
SMGhost's user avatar
  • 3,927
0 votes
0 answers
112 views

In jacoco test coverage report how to exclude whole packages?? or some specific files?

So here i want to exclude all files of cc.mekanism.chatconcept.databinding in my project and here is my file filter: def fileFilter = [ // data binding 'android/databinding/**/*.class',...
Jay Patel's user avatar
0 votes
1 answer
76 views

How can we get new code coverage or per Pull Request with bitbucket

I need code coverage of every pull request and the pull request has been generated by bitbucket. so basically I achieved a multibranch that every time a new pull request is generated or modified it ...
Shubham's user avatar
0 votes
1 answer
96 views

How to change Jacoco output directory on Android?

On my Android project, Jacoco coverage report file is generated in below directory. "/app/build/reports/jacoco/~" I wanna know how to change Jacoco output directory => such as "/...
Denis Jung's user avatar
0 votes
0 answers
19 views

SonarQube showing 0% coverage on UI, after retried same changes showing coverage , it was working fine before not sure what is issue

onarQube showing 0% coverage on UI, after retried same changes showing coverage , it was working fine before not sure what is issue , no changes has been done , i want to know which are things i can ...
abhishek's user avatar
2 votes
0 answers
648 views

Getting Error: Unknown Kotlin JVM target: 20 in jacoco plugin

So i am adding jacoco plugin for code coverage and i am getting this : there is no mention of jvm targer 20 in my whole project , everything is set to jvm target 10 , don't know that's happening. ./...
Jay Patel's user avatar
0 votes
1 answer
214 views

Jacoco can not find classes directory in multi-module maven project and generates empty html report

In my multi-module project I have a code and tests in separate modules. When I run maven command 'mvn clean install -DskipTests=false', jacoco.exec file is generated in test module but Jacoco ...
mrKaczorrro's user avatar
0 votes
0 answers
18 views

Not able to use maven jacoco offline mode to calculate UT coverage with mockito @Spy annotation

does jacoco offline mode support the mockito @Spy annotation? I've tested several rounds and jacoco report is not able to get the coverage(always 0.0%) when I use the mockito @Spy: @RunWith(...
Kay's user avatar
  • 23
0 votes
0 answers
19 views

How to get JaCoCo coverage while running JQF+Zest maven plugin

I'm trying to customize the interaction between JaCoCo and JQF+Zest to more accurately see what code lines the fuzzer is working with. What I've tried: This command (0% coverage): MAVEN_OPTS="-...
rendoteru's user avatar
0 votes
0 answers
64 views

Exclude default constructor from Jacoco check

My Jacoco code coverage check is failing for this reason: [WARNING] Rule violated for method ie.aviva.digital.salesgenerator.service.SalesService.SalesService(): lines total count is 93, but expected ...
runnerpaul's user avatar
  • 6,136
1 vote
0 answers
148 views

Jacoco coverage report XML file not generated on Android

I am trying to generate Android UnitTest coverage report XML file by using Jacoco, to display it on SonarQube webpage. Here is what I did. (1) Added Jacoco dependency in project build.gradle. ...
Denis Jung's user avatar
0 votes
0 answers
41 views

Exclude class file from being instrumented by Jacoco in Gradle

For Jacoco in Android Gradle build, how to exclude certain class files or library from being instrumented? This is different from excluding class from coverage report generation. This is due to an ...
c.critter's user avatar
0 votes
1 answer
39 views

JaCoCo causes exceptions when running with Spring MockMvc

I am adding the JaCoCo code coverage plugin to an application with an end goal of seeing the report on Sonar. Without JaCoCo all of my tests pass, but adding it creates all sorts of problems. The ...
willsportsfan1's user avatar
1 vote
1 answer
292 views

Jacoco report aggregation plugin is not generating the XML file

I' working on a multi-module project that employs a standalone sub-project to aggregate coverage reports. The project is build using Gradle so it uses Jacoco report aggregation plugin for Gradle. ...
MiguelSlv's user avatar
  • 14.4k
0 votes
1 answer
65 views

Jacoco branch coverage unable to cover else if statement

I have written a rest API in quarkus to convert miles to kilometer. @GET @Path("/miles-to-kilometers") public Response milesToKilometers(@QueryParam("value") double miles) { ...
Mugi Coder's user avatar
0 votes
1 answer
163 views

How to solve Surefire "tests are skipped" and jacoco "Skipping JaCoCo execution due to missing execution data file"?

I wan to generate jacoco report but unfortunately maven is not running the tests and the report is not generated. when running mvn test the console shows the following - --- jacoco-maven-plugin:0.8.8:...
Jeet's user avatar
  • 365
0 votes
0 answers
77 views

How to solve "Skipping JaCoCo execution due to missing execution data file"?

I have the following in my pom.xml - <plugins> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <...
Jeet's user avatar
  • 365
0 votes
0 answers
24 views

Sonar test is failing with -org.jacoco.agent.rt.internal_035b120.asm.MethodTooLargeException: Method too large: ****$.<init> ()V

org.jacoco.agent.rt.internal_035b120.asm.MethodTooLargeException: Method too large: ****. ()V I want to exclude that class or test case on sonar test run <sonar.test.exclusions>src/test/**.java&...
siddhesh satardekar's user avatar
0 votes
1 answer
69 views

Mockito: WebClient reactive method call

I am facing difficulties in writing a unit test for my collect method. Specifically, the Jacoco test coverage for the methods that occur after I call getBearerToken() within the collectEndpointCount ...
DonutQuan's user avatar
0 votes
0 answers
46 views

Code coverage dropped after updating libraries and jacoco exclude not working

I have upgradedmy project lib versions (gradle 7.2/spring boot 2.7.13/junit 4.13) and after that cove coverage dropped from 84% to 49%(without any functional change and new classes addition) and when ...
KVL's user avatar
  • 95
2 votes
0 answers
78 views

gradle, composite builds, jacoco and sonarqube

So my team has a monorepo. it has multiple included builds, either applications or libraries. We are aiming to start using sonarqube/jacoco for test coverage, yet... well, there's no documentation ...
caeus's user avatar
  • 3,222
1 vote
1 answer
89 views

Can jacoco report aggregate be created using mvn surefire:test command?

This is my pom: <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.8.10</version> <executions> &...
user22334625's user avatar
8 votes
1 answer
521 views

Setting up jacoco for multi-module Android codebase with Gadle kotlin

I am currently setting up Jacoco in an Android codebase that my team built. I don't have much experience in Android but I have set up Jacoco before in a Spring Boot codebase so that I can track the ...
Petra Barus's user avatar
  • 3,835
0 votes
0 answers
22 views

Ideal way to define configuration in pom.xml which is not related to any plugin

Our Java application has one Integration Test module which only has integration tests which runs in a GCP vm. While running these tests in gcp vm, we use Jacoco(in GCP vm in server mode) to calculate ...
Mehul Parmar's user avatar
1 vote
0 answers
736 views

Android Jacoco 0.8.10 shows 0% code coverage when upgraded to Java 17 from Java 8

I recently updated my Android project to use Java 17 instead of Java 8. On running jacocoTestReport Gradle command, I get code coverage for library modules, but not the application module (app). If I ...
Saurabh Somani's user avatar
0 votes
0 answers
12 views

Get context of test project in Android junit test , not InstrumentedTest

I need to use Jacoco, but I need to get context. When I use this command I got this error: No instrumentation registered! Must run under a registering instrumentation. Is there a way to use jacoco ...
Tom Alves's user avatar
0 votes
2 answers
145 views

Jacoco agent faild to start on tomcat9: java.lang.LinkageError: loader 'bootstrap' attempted duplicate class definition for java.lang.$JaCoCo

When I try to start my tomcat 9 server on linux I have this error: NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=...
Mathieu's user avatar

1
2 3 4 5
38