jacoco

What is the difference between jacoco branch coverage and Sonar condition coverage?

痞子三分冷 提交于 2019-12-05 02:35:40
问题 I'm trying to analyze java code with the SonarQube Scanner (version 3.1.0.1141). SonarQube version : 5.6.6 Sonar Java plugin version : 4.12.0.11033 jacoco version : 0.8.0 I have filled the sonar-project.properties with those properties : # Sonar sources and metadata sonar.language=java sonar.sources=src/main sonar.java.source=1.8 sonar.sourceEncoding=UTF-8 sonar.java.binaries=target/classes sonar.java.libraries=target/lib sonar.tests=src/test sonar.java.coveragePlugin=jacoco sonar.junit

“No information about coverage per test.” from Sonar with Jacoco Ant build

北慕城南 提交于 2019-12-05 02:35:18
I'm using Ant, Jacoco and Sonar. When I run my build Sonar tells me that "No information about coverage per test." and the Sonar dashboard has my coverage results, but I cannot drill down into them to see the code. However, the HTML report generated by Jacoco does include drill down into the code. This is my coverage task: <jacoco:coverage destfile="${coverage.output.file}" > <junit printsummary="on" errorProperty="test.failed" failureProperty="test.failed" haltonfailure="yes" fork="true"> <formatter type="brief" usefile="false" /> <formatter type="xml" /> <classpath> <path refid="test.build

How can I integrate Jacoco reports with SonarQube without using maven?

China☆狼群 提交于 2019-12-05 02:10:35
I used Jacoco eclipse plugin to measure unit test coverage and I was able to export a report using it. I want to integrate that report with sonar so I gave the path to it in the project properties file. My properties file looks like this # Required metadata sonar.projectKey=key sonar.projectName=name sonar.projectVersion=1.0 sonar.jacoco.reportPath=jacoco.exec sonar.tests=junit sonar.dynamicAnalysis=reuseReports sonar.java.coveragePlugin=jacoco sonar.jacoco.reportMissing.force.zero=true # Comma-separated paths to directories with sources (required) sonar.sources=src # Comma-separated paths to

jacoco not excluding classes when using ant

喜你入骨 提交于 2019-12-04 20:13:27
问题 I'm having trouble getting a jacoco/junit ant target to exclude classes from coverage. I can get it to exclude packages though with something like this: <jacoco:coverage destfile="${coverage.reports.dir.xml}/output.jacoco" excludes="foo.*:bar.fiz.*:my.long.package.name.*"> This doesn't exclude my test classes though because the test classes are in the same package as the classes they test. I've tired this to exclude the test classes with a regex, but it doesn't work. <jacoco:coverage destfile

Jacoco: Find code coverage for external tests

百般思念 提交于 2019-12-04 19:01:53
问题 I recently used EclEmma plugin in eclipse to find code coverage of JUnits in my application and it worked great. In the next step, I want to be able to find code coverage for end-to-end tests / functional tests which are called on our application from outside(they reside on a separate server). Basically, we package our application as a jar (we use maven) and deploy it on a server. And we can trigger the functional tests at this location. Is there a way to find code coverage in this case? My

Jacoco code coverage show 0% coverage on Jenkins

老子叫甜甜 提交于 2019-12-04 18:43:26
I have read most of the answers available for similar questions but none of those fit to answer my question. My profile in pom file looks like this: <plugins> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.7.201606060606</version> <executions> <!-- Prepares the property pointing to the JaCoCo runtime agent which is passed as VM argument when Maven the Surefire plugin is executed. --> <execution> <id>pre-unit-test</id> <goals> <goal>prepare-agent</goal> </goals> <configuration> <!-- Sets the path to the file which contains the execution data. --

Jacoco and Sonar code coverage?

一个人想着一个人 提交于 2019-12-04 17:59:45
Using : JaCoCo 0.5.3, Maven2, Sonar 2.14, sonar-maven-plugin 1.8, SùartGWT 3.0 Currently trying to : Get code coverage on Sonar of my Selenium unit tests. Problem : Code coverage doesn't move from 0% although the sensor is launched properly, analyse the jacoco.exec which is correctly generated. Ressources : https://gist.github.com/2888912 The pom.xml It's been about 2 weeks I'm trying to get code coverage. I upgraded the Sonar from 2.10 to 2.14, changed every single sonar property, tried the plugin jacoco (for maven) and I still DON'T get any results. So if someone had the same problems and

packaging jacoco-agent.properties into an APK so it can be read?

半腔热情 提交于 2019-12-04 17:51:26
Here's my situation: Background I am investigating code-coverage for our Android app. The app is built with Gradle and Android Studio. I need code-coverage reports in two situations: during manual tests, and during automated tests built with our sizeable Appium suite. I need to get a proof-of-concept out fast (isn't that always the case?) so I haven't had the chance to do thorough R&D. So please forgive any ignorance I display :) I have access to the app source, but have little knowledge of the moving parts. I have investigated JaCoCo and Emma. This question pertains to JaCoCo. Given that we

利用JaCoCo统计接口测试中代码覆盖率

☆樱花仙子☆ 提交于 2019-12-04 17:42:44
​ 做接口测试,很多时候都会听到,你接口测试的覆盖率是多少? 很多人会回答80%,你怎么统计的,他说覆盖了80%的需求。 这个回答没有错误,但是片面,我们不能只考虑需求的覆盖率,还有业务的覆盖率,场景的覆盖率,接口的覆盖率,代码的覆盖率等,本文介绍接口测试的代码覆盖率。 那么我们来看看如何是实现的。 1、环境的搭建 1.1搭建 ant 环境 https://ant.apache.org/bindownload.cgi 我下载的是1.10.7版本,这个是因为 每个版本对应的java的版本 不一样,这个在ant的官网有介绍,下载的zip包 ,然后解压,然后去配置环境变量,我用的是mac配置的,打开: vi .bash_profile export ANT_HOME=/Users/lileilei/Downloads/apache-ant-1.10.7export PATH=$PATH:.:${ANT_HOME}/bin 配置完毕后source .bash_profile 立即生效 到这里,我们已经设置好了我们的ant的环境。 1.2 下载JaCoCo。 下载地址: https://www.jacoco.org/jacoco/ 下载完毕后,解压即可。 以上搭建了所需的环境。 2.ant的build文件配置 通过build.xml拉去覆盖率,具体配置文件如下:      <?xml

Missing jacoco.exec file when using jacoco offline instrumentation with Powermock

你说的曾经没有我的故事 提交于 2019-12-04 16:59:55
Despite apparently this post showed a solution to using powermock and jacoco, I haven't been able to make it work in a pretty simple project ( available on GitHub ). In my case, the test executes correctly but the jacoco.exec file is missing so jacoco doesn't check coverage. Test class: @RunWith(PowerMockRunner.class) @PrepareOnlyThisForTest(Util.class) @PowerMockIgnore("org.jacoco.agent.rt.*") public class UtilTest { @Test public void testSay() throws Exception { PowerMockito.mockStatic(Util.class); Mockito.when(Util.say(Mockito.anyString())).thenReturn("hello:mandy"); Assert.assertEquals(