Integrate Spock's test with Sonar
Asked Answered
B

1

10

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 ?

Sonar Dashboard image

Banner answered 27/1, 2017 at 4:16 Comment(1)
Related #41453351Mewl
M
17
  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 and JUnit tests in Sonar

Mewl answered 27/1, 2017 at 8:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.