jacoco-maven-plugin

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. --

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(

jacoco : Cannot exclude classes

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 22:27:01
问题 I have a maven project and I want to use jacoco for code coverage. Here is the relevant section of my pom <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.5.201505241946</version> <executions> <execution> <id>pre-my-test</id> <phase>pre-integration-test</phase> <goals> <goal>prepare-agent</goal> </goals> <configuration> <append>true</append> <destFile>${project.build.directory}/jacoco-it.exec</destFile> <propertyName>failsafeArgLine<

How to have the Maven build wait for the Jetty server to start in forked mode before running the integration tests?

孤街醉人 提交于 2019-12-03 22:08:40
问题 I have a report for the code coverage by the integration test. I do have integration tests, and these are run successfully in the Maven build. When I click on the "Sessions" link in the top right corner of the HTML report I can see my test classes in the list, but I cannot see my main classes that are exercised by the tests now, and all coverage report percentages are at zero. As a side note, my unit test coverage works fine, with the percentages being displayed all right. My configuration

Integration Test Coverage in SonarQube from JaCoCo Maven plug-in showing 0%

旧巷老猫 提交于 2019-12-03 16:13:09
问题 We have a multi-module multi-language maven java project with coverage analysis with jacoco. The main part of the modules is backend (Java code) with a REST API and our webapp module contains the frontend (AngularJS) and the Integration-Tests in java. Our Jacoco-IT.exec file contains around 100Kb of data so we guess some Coverage data for the Integration tests could get collected. Nevertheless we cant see any coverage in SonarQube (using Version 5.0 and 4.5) We run build the Project and run

JaCoCo: exclude generated methods (using it with Lombok)

左心房为你撑大大i 提交于 2019-12-03 09:55:10
I am using JaCoCo and it is considering methods generated by Lombok (generated in the bytecode, not trace of them in the source code). How can I configure JaCoCo to ignore them? Use the excludes tag provide by jacoco. <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.4.201502262128</version> <configuration> <excludes> <exclude>**/config/**</exclude> <exclude>**/model/**</exclude> <exclude>**/item/**</exclude> </excludes> </configuration> ebonnet Also another way to exclude lombok generated classes since jacoco 0.8.0 and lombok 1.16.14 see: https://www.rainerhahnekamp.com/en/ignoring

Integration Test Coverage in SonarQube from JaCoCo Maven plug-in showing 0%

烂漫一生 提交于 2019-12-03 05:28:37
We have a multi-module multi-language maven java project with coverage analysis with jacoco. The main part of the modules is backend (Java code) with a REST API and our webapp module contains the frontend (AngularJS) and the Integration-Tests in java. Our Jacoco-IT.exec file contains around 100Kb of data so we guess some Coverage data for the Integration tests could get collected. Nevertheless we cant see any coverage in SonarQube (using Version 5.0 and 4.5) We run build the Project and run the integration tests with mvn clean install and analyse the data with mvn sonar:sonar The Project is

JaCoCo with Maven - missing execution data file

谁说我不能喝 提交于 2019-12-03 05:02:21
问题 We have a Maven multi module project consisting of a parent (HelloWorld) and different children (HelloWorldServices and HelloWorldPresentation) and use Jenkins to build. The error after running the successful test is [INFO] --- jacoco-maven-plugin:0.7.6.201602180812:report (default-cli) @ HelloWorldServices --- [INFO] Skipping JaCoCo execution due to missing execution data file:/var/lib/jenkins/workspace/HelloWorld/HelloWorldServices/target/jacoco.exec The lines before it says [INFO] ---

Arquillian integration test code coverage issue with Jacoco

浪尽此生 提交于 2019-12-02 04:16:25
I am doing integration testing using arquillian and tomee remote plugin. it is working good. But my code coverage is not working. I am using Jacoco plugin for code coverage. Getting Exception in my Java class java.lang.instrument.IllegalClassFormatException: Error while instrumenting com/demo/EmpService How to do code coverage in remote container using Jacoco ? Note: I have passed javaagent ( argLine ) to server catalina opts in integration phase. I am injecting my bean in test class and trying to cover test cases. Test case is passed. But no code coverage and getting exception EmpService:

jacoco : Cannot exclude classes

混江龙づ霸主 提交于 2019-12-01 00:58:59
I have a maven project and I want to use jacoco for code coverage. Here is the relevant section of my pom <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.5.201505241946</version> <executions> <execution> <id>pre-my-test</id> <phase>pre-integration-test</phase> <goals> <goal>prepare-agent</goal> </goals> <configuration> <append>true</append> <destFile>${project.build.directory}/jacoco-it.exec</destFile> <propertyName>failsafeArgLine</propertyName> </configuration> </execution> <execution> <id>post-my-test</id> <phase>post-my-test</phase> <goals>