将Spock的测试与Sonar集成 [英] Integrate Spock's test with Sonar

查看:308
本文介绍了将Spock的测试与Sonar集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用spock编写测试用例和jenkins来运行和发布我的测试用例。
我能够获得报告的代码覆盖率,但声纳显示我仅Java 单元测试用例; groovy测试用例完全缺失



以下pom.xml用作参考

解决方案


  1. 在Sonar中安装Groovy插件。以admin / admin身份登录并转到
    管理/系统/更新中心选项卡


  2. pom文件中添加以下属性



    < sonar.tests> src / test / groovy,src / test / java< /sonar.tests>


如果这样做,Spock和JUnit测试都会正确显示!
请参阅附件截图


I use spock to write test case and jenkins to run and publish my test cases. I was able to get the code coverage reported but sonar shows me only Java Unit test cases; the groovy test cases are totally missing

The following pom.xml is used as reference https://github.com/kkapelon/java-testing-with-spock/blob/master/chapter7/spring-standalone-swing/pom.xml

would anyone please know what I am missing ?

解决方案

  1. Install the Groovy plugin in Sonar. Login as admin/admin and go to the administration/system/update-center tab
  2. Add the following property in the pom file

    <sonar.tests>src/test/groovy,src/test/java</sonar.tests>

If you do this both Spock and JUnit tests are shown correctly! See attached screenshot

这篇关于将Spock的测试与Sonar集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆