jacoco-maven-plugin

JaCoCo: exclude generated methods (using it with Lombok)

╄→尐↘猪︶ㄣ 提交于 2019-12-21 03:21:06
问题 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? 回答1: 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> 回答2: Also another way to exclude lombok

Arquillian integration test code coverage issue with Jacoco

对着背影说爱祢 提交于 2019-12-20 05:19:17
问题 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

Jacoco Maven plugin - include test sources

允我心安 提交于 2019-12-11 12:33:20
问题 I'm new in Jacoco maven plugin and trying to add coverage analysis for my test classes (I'm using TestNG with failsafe plugin). After checking the documentation and some tutorials I made it work on classes in Sources Root (src/main), but couldn't manage to include the classes in Tests Root (src/test). My project consists of only test classes, so the coverage report is required only for these. In IntelliJ, there is an option "Enable coverage in test folders" which does what I really want. So I

Find code coverage for multi module maven project

强颜欢笑 提交于 2019-12-11 04:47:40
问题 I have a multi module maven project in one git repository and my integration test cases on another git repository. The output of multi module maven project is three jars for three modules. Now is there a way via command line (so that we can run this through jenkins) to find code coverage for integration tests that are in another repository. The JAR when ran through java -jar <<jarname>> it starts a jetty server with the application. 回答1: You can execute your jar with JaCoCo agent to gather

jacoco only shows coverage for classes in the same module

自作多情 提交于 2019-12-11 03:10:41
问题 I have a somewhat large multi-module Maven project. I have the unit tests in each module being processed by Jacoco. I have a separate child module doing "merge" and "report-aggregate", and this appears to be generating data. I'm even using the generated data in SonarQube. Most of my tests are using PowerMock, and I'm using offline instrumentation. However, after looking closer at the coverage data, I see that it is leaving out coverage data for classes and methods that I know are being

How to fix unstable builds when thresholds are met?

余生长醉 提交于 2019-12-11 01:32:50
问题 My overall coverage is meeting the threshold, but still build is marked as Unstable. Does anyone know the reason for this? 16:53:04 [JaCoCo plugin] Thresholds: JacocoHealthReportThresholds [minClass=75, maxClass=99, minMethod=75, maxMethod=99, minLine=75, maxLine=99, minBranch=40, maxBranch=99, minInstruction=65, maxInstruction=99, minComplexity=0, maxComplexity=99] 16:53:04 [JaCoCo plugin] Publishing the results.. 16:53:04 [JaCoCo plugin] Loading packages.. 16:53:04 [JaCoCo plugin] Done. 16

How to check minimum code coverage for multi-module maven project with jacoco?

杀马特。学长 韩版系。学妹 提交于 2019-12-08 17:36:14
问题 I want to use jacoco maven plugin for checking minimum level of code coverage during build process using 'check' goal. For one-module project everything works fine. But for multi-module I want to check average level of code coverage from all modules, but check goal checks every module separately. For example, module1 has 70% of code coverage, module2 has 100% code coverage, in average for all lines from both modules code coverage is 85% . And I am trying to set code coverage for all project

Maven multi module project with separate tests module - Code Coverage?

给你一囗甜甜゛ 提交于 2019-12-07 05:49:46
问题 I have a maven multi module project. root: moduleA/ # no unit tests moduleB/ # no unit tests moduleC/ # no unit tests tests/ # All unit tests, since depends on modules A, B and C All tests are in single module called tests/ and all code is in separate modules. Is there a way I can get code coverage? 回答1: There is a way to accomplish this. The magic is to create a combined jacoco.exec file and to do it in two steps. My pom: <properties> ... <jacoco.overall.exec>${maven

Jacoco code coverage show 0% coverage on Jenkins

久未见 提交于 2019-12-06 13:50:15
问题 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

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

末鹿安然 提交于 2019-12-06 11:47:31
问题 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