Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrate Spock's test with Sonar

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

like image 894
harry Avatar asked Jan 27 '17 04:01

harry


1 Answers

  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

like image 156
kazanaki Avatar answered Nov 05 '22 14:11

kazanaki