JaCoCo not generating jacoco.exec until after skipping JaCoCo execution

Just an addition to the answers already given. It could happen that in your maven-surefire-plugin configuration you already use the argLine configuration to override something like the memory used. If you do so the argline set by jacoco-maven-plugin will not be used failing to generate the jacoco report. In this case assign a property name … Read more

How to make Maven unit test code coverage work

Thanks user3732793 Personnaly, I only needed to add this to my pom.xml <project> … <dependencies> … </dependencies> <build> <plugins> … <!– Code Coverage report generation –> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.9</version> <executions> <execution> <goals> <goal>prepare-agent</goal> </goals> </execution> <execution> <id>generate-code-coverage-report</id> <phase>test</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project> Then I am running mvn test and … Read more

Minimum code coverage threshold in Jacoco Gradle

The feature is now available. You simply need to apply the Gradle JaCoCo plugin and define coverage verification like this: apply plugin: ‘jacoco’ jacocoTestCoverageVerification { violationRules { rule { limit { minimum = 0.7 } } } } // to run coverage verification during the build (and fail when appropriate) check.dependsOn jacocoTestCoverageVerification The last line … Read more

Sonarqube is not showing code coverage after running

I found the solution – The maven plugin I have included has configuration of Jacoco’s destfile and datafile as ${basedir}/target/coverage-reports/jacoco-unit.exec but by default sonar reads at ${basedir}/target/jacoco.exec. I changed the default at http://localhost:9000/settings?category=java Ref: Sonar Code Coverage Couldn’t find the working reference link. Here is aux link: Baeldung Sonar and jacoco

Android test code coverage with JaCoCo Gradle plugin

Here is how I’m using Jacoco: buildscript { repositories { mavenLocal() mavenCentral() } dependencies { classpath ‘com.android.tools.build:gradle:0.12.+’ classpath ‘org.robolectric:robolectric-gradle-plugin:0.11.+’ } } apply plugin: ‘com.android.application’ apply plugin: ‘robolectric’ apply plugin: ‘jacoco’ android { compileSdkVersion 20 buildToolsVersion “20.0.0” defaultConfig { applicationId “YOUR_PACKAGE_NAME” minSdkVersion 10 targetSdkVersion 20 testHandleProfiling true testFunctionalTest true } buildTypes { debug { testCoverageEnabled false … Read more

jacoco code coverage report generator showing error : “Classes in bundle ‘Code Coverage Report’ do no match with execution data”

You are getting the error related to classID. This is a concept described in detail at JaCoCo docs-site. http://www.eclemma.org/jacoco/trunk/doc/classids.html. This is a key step for supporting multiple versions of class (an appserver for example) in same JVM. Copying part some part of it here for visibility. What are class ids and how are they created? … Read more

JaCoCo returning 0% Coverage with Kotlin and Android 3.0

You can get line-by-line coverage for both Java and Kotlin code by defining the two different directories for generated .class files: def debugTree = fileTree(dir: “${buildDir}/intermediates/classes/debug”, excludes: fileFilter) def kotlinDebugTree = fileTree(dir: “${buildDir}/tmp/kotlin-classes/debug”, excludes: fileFilter) Then, simply include both fileTrees in your classDirectories: classDirectories.from = files([debugTree], [kotlinDebugTree])

Unable to get Jacoco to work with Powermockito using offline instrumentation

This pom worked for me: <build> <finalName>final-name</finalName> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <systemPropertyVariables> <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile> </systemPropertyVariables> </configuration> </plugin> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.2.201409121644</version> <executions> <execution> <id>default-instrument</id> <goals> <goal>instrument</goal> </goals> </execution> <execution> <id>default-restore-instrumented-classes</id> <goals> <goal>restore-instrumented-classes</goal> </goals> </execution> <execution> <id>default-report</id> <phase>prepare-package</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin> </plugins> </build> See this … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)