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

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

问题描述

我使用 spock 编写测试用例,使用 jenkins 运行和发布我的测试用例.我能够得到报告的代码覆盖率,但声纳向我显示仅 Java 单元测试用例;完全没有常规测试用例

以下 pom.xml 用作参考

解决方案

  1. 在 Sonar 中安装 Groovy 插件.以管理员/管理员身份登录并转到管理/系统/更新中心选项卡
  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 的测试与声纳集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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