19

JMockit with Maven, Sonar, JaCoCo and Jenkins/Hudson

 4 years ago
source link: https://marco.dev/2012/10/09/jmockit-with-maven-sonar-jacoco-and-jenkinshudson/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

java-version.com: What's new in Java 16? 15? Keep up to date!

JMockit with Maven, Sonar, JaCoCo and Jenkins/Hudson

We deployed our fresh new tests based on JMockit in our Jenkins/Sonar environment and surprise … no unit test works anymore. Even the tests that don’t use JMockit (simple JUnit) stopped to work. It was strange that during the build phase with test there was no problem but in the Sonar test phase the first JUnit test looped permanently.

It took a while to figure out the problem.

There is an incompatibility between JaCoCo and JMockit.

To solve the issue we added the jmockit javaagent to the maven-surefire-plugin:

<argLine>-javaagent:"${settings.localRepository}"/com/googlecode/jmockit/jmockit/0.999.15/jmockit-0.999.15.jar</argLine>

Here how it looks like the plugin:

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-surefire-plugin</artifactId>
 <version>2.12</version>
 <configuration>
<argLine>-javaagent:"${settings.localRepository}"/com/googlecode/jmockit/jmockit/0.999.15/jmockit-0.999.15.jar</argLine>
 </configuration>
</plugin>

After this change the test are executed correctly and the incompatibility between JaCoCo and JMockit solved!


Recommend

  • 29

    Hudson Jameson has been anEthereum believer since it was proposed in late 2013 by co-founder Vitalik Buterin—and has been following Bitcoin since 2011. All this time, he’s held one belief; building great technology is the...

  • 14

    EmpowerApps.Show – Upgrading Your Skills in 2020 with Paul HudsonIn this episode, Leo is joined by Paul Hudson of hackingwithswift.com about how to upgrade your skills and your team’s skills in 2020.

  • 13

    Reporting Code Coverage using Maven and JaCoCo plugin1. INTRODUCTION Code coverage is a metric indicating which percentage of lines of code are executed when running automated tests.

  • 4
    • blog.knoldus.com 4 years ago
    • Cache

    Difference between Mockito and JMockit

    Difference between Mockito and JMockit Reading Time: 2 minutesA Brief analysis on Mockito And Jmockit Mock...

  • 17

    Scan PHP|JavaScript|C#|HTML using Sonar Scanner and JenkinsIn this brief guide we are going to take advantage of SonarQube to scan PHP or JavaScript or other programming language apart from Java via the sonar scanner client. How this works is...

  • 10
    • segmentfault.com 3 years ago
    • Cache

    Jenkins如何跳过sonar执行CI

    我们公司采用jenkins+sonar 持续集成检测代码质量,最近架构组新增了很多代码扫描规则,导致很多后端服务或者前后端未分离项目CI不通过,要将所有sonar检测出来的问题修改完会花一些时间,影响到测试进度,为了临时处理...

  • 11

    单元测试是保证代码质量的重要一环,而如何衡量单元测试写得好不好呢?覆盖率(Coverage)是一个重要指标。而JaCoCo则是专门为Java提供的用于检测测试覆盖率的工具,英文全称为Java Code Coverage。

  • 7

    Separating Integration and Unit Tests with Maven, Sonar, Failsafe, and JaCoCo February 5, 2012 Goal: Execute the slow i...

  • 11
    • tangxusc.github.io 3 years ago
    • Cache

    Jenkins Sonar Github 代码质量管理

    Jenkins Sonar Github 代码质量管理 March 20, 2019 in sonarqube

  • 6

    2023-11-22 | 阅读(56) Java 项目需要产生单元测试及代码覆盖率的话一直都是走的 JUnit 单元测试,JaCoCo 基于测试产生测试覆盖率,然后送到 SonarQube 去展示这条路子。当然 SonarQube 还可以帮我们进行代码的静态分析。但对其中的具体使用及过程知...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK