jacoco

SonarQube, JaCoCo: (11 of 22 conditions) when they are supposed to be 3 (or 4)

一世执手 提交于 2020-01-14 04:36:30
问题 I am lost on how SonarQube calculates conditions covered by tests. Versions of tools used: * JaCoCo 0.8.1 * SonarQube 7.4 This is my groovy code boolean condition1(boolean b1, boolean b2) { !b1 || !b2 } boolean condition2(boolean b1, boolean b2) { b1 || b2 } boolean condition3(boolean b1, boolean b2) { !b1 && !b2 } boolean condition4(boolean b1, boolean b2) { b1 && b2 } boolean condition5(boolean b1, boolean b2) { b1 && !b2 } boolean condition6(boolean b1, boolean b2, boolean b3) { b1 && b2 &

Android Coverage launch with JaCoCo

半世苍凉 提交于 2020-01-11 12:37:52
问题 We have an Android application that we are building with Gradle/Android Studio and are using JaCoCo to generate code coverage reports for our unit tests; this is working great. We are also interested in being able to generate coverage reports for manual tests as well; that is, show what code was covered in an arbitrary application launch. It appears that JaCoCo's predecessor EclEmma was capable of this, but I have not been able to find any confirmation one way or the other about JaCoCo

android jacoco coverage empty with gradle

喜欢而已 提交于 2020-01-11 05:17:06
问题 I'm trying to make jacoco create a code coverage report for my android test project. I have the following in build.gradle: apply plugin: 'com.android.application' apply plugin: 'jacoco' ... jacoco { toolVersion = "0.7.1.201405082137" } ... android { buildTypes { release { } debug { testCoverageEnabled true } } } when I run gradlew -i createDebugCoverageReport, I get a coverage report, but it's empty. the end of the gradle execution is as follows: :androidTest:connectedAndroidTest (Thread[main

JaCoCo - SonarQube - No information about coverage per test

风格不统一 提交于 2020-01-10 20:24:05
问题 I'm using JaCoCo for Code Coverage. The Unit Test reports are created with junit and they are imported correctly, so that the unit test information is shown properly. The problem is, that I get the error message: No information about coverage per test. and the code coverage is shows the value 0% for unit tests, integration tests and overall coverage. I checked all required information in the sonar-project.properties like binary, src, tests etc. I'm using: - SonarQube 4.5.1 - SonarRunner 2.4 -

Where does Sonarqube collects data from?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-07 03:07:20
问题 Last day I was configuring a jenkins job to run sonar on my java project. I had sonar and jacoco plugins configured in my job. Sonar was throwing some error for which my sysadmin asked me to remove the jacoco plugin configuration from job. I removed and now sonar is saying it cannot find cobertura.xml. So I am curious to know if sonar does analysis on already run jacoco or cobertura task or does it runs its own coverage analysis? 回答1: Short answer : In general, coverage is imported to

Jacoco exclude classes from report

和自甴很熟 提交于 2020-01-06 15:51:05
问题 I am using the example on http://www.eclemma.org/jacoco/trunk/doc/examples/java/ReportGenerator.java I would like to exclude some classes from the report generation. I assume it has to be set in the Analyzer but I could find an example. 回答1: Sounds like you may be wanting the Excludes: in Code Coverage Preferences ? 回答2: I'd say in analyzeStructure() you should not call analyzer.analyzeAll(classesDirectory); , but iterate over the file tree in classesDirectory yourself, excluding the classes

Code Coverage for Integration tests using Jacoco

帅比萌擦擦* 提交于 2020-01-06 06:19:26
问题 I am passing jacocoagent.jar of version 0.8.1 as a java agent to record the code coverage on the server to my server start-up script. But I see that Pre-main class attribute is missing in the jar, as a result, I get the following error: Error occurred during initialization of VM Failed to find Premain-Class manifest attribute in /u01/jetty_home/jacoco/jacocoagent.jar agent library failed to init: instrument. Does anyone have thoughts on how to fix this? 回答1: Make sure that you use proper JAR

Unable to upload jacoco report to TeamCity with Gradle 4.5

六眼飞鱼酱① 提交于 2020-01-06 03:22:10
问题 I have a Gradle task to upload jacoco coverage to TeamCity (following TeamCity documentation here: Importing JaCoCo coverage data to TeamCity): task uploadJacocoTestReport { doLast { println "##teamcity[jacocoReport dataPath='build/jacoco/jacocoTest.exec' " + "includes='com.mypackage.*' " + "classpath='build/classes/main']" } } If I use Gradle 3.5 , TeamCity build is able to display CodeCoverage report in the build log. But when I switch to Gradle 4.5 , the Code Coverage section no longer

Coverage report works in Jenkins using Jacoco but I cannot get coverage report in SonarQube

天涯浪子 提交于 2020-01-05 08:34:47
问题 I'm using Jenkins+Jacoco+Sonarqube to test my code. In Jenkins, my mvn command is: clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.skip=false -Dmaven.test.failure.ignore=true sonar:sonar And I add action 'record jacoco coverage report' after build. But the result is, jenkins works as below: It shows coverage report and other information. But I cannot get coverage percentage in sonarQube therefore the quality gate in Sonarqube cannot be passed. I guess that sonar cannot

Jacoco is reporting 0 coverage of Kotlin classes by unit tests, in an Android project

馋奶兔 提交于 2020-01-04 05:38:08
问题 I'm using Android Gradle Plugin 3.0.0. I'm migrating an Android app from java to kotlin. My app has classes in Java and Kotlin, and tests are in Java. I run ./gradlew clean jacocoTestReport . This runs both unit tests ( src/test ) and instrumentation tests ( src/androidTest ). The report produced by jacoco in app/build/reports/jacoco/jacocoTestReport/html/index.html doesn't show coverage for Kotlin classes which are indeed covered by unit tests. The report does show coverage correctly from