问题描述
我使用 spock 编写测试用例,使用 jenkins 运行和发布我的测试用例.我能够得到报告的代码覆盖率,但声纳向我显示仅 Java 单元测试用例;完全没有常规测试用例
以下 pom.xml 用作参考
- 在 Sonar 中安装 Groovy 插件.以管理员/管理员身份登录并转到管理/系统/更新中心选项卡
在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 的测试与声纳集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!