将Spock的测试与Sonar集成 [英] Integrate Spock's test with Sonar
问题描述
我使用spock编写测试用例和jenkins来运行和发布我的测试用例。
我能够获得报告的代码覆盖率,但声纳显示我仅Java 单元测试用例; groovy测试用例完全缺失
以下pom.xml用作参考
- 在Sonar中安装Groovy插件。以admin / admin身份登录并转到
管理/系统/更新中心选项卡 -
在
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 ?
- Install the Groovy plugin in Sonar. Login as admin/admin and go to the administration/system/update-center tab
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屋!