Integrate Spock Test with Sonar

I use spock to write a test case and jenkins to run and publish my test cases. I managed to get code coverage information, but the sonar shows me only Java Unit test cases; test examples of groovy completely absent

The following pom.xml is used as a link https://github.com/kkapelon/java-testing-with-spock/blob/master/chapter7/spring-standalone-swing/pom.xml

Would someone please find out what I am missing?

Sonar Dashboard Image

+7
source share
2 answers
  • Install the Groovy plugin in Sonar. Log in as admin / admin and go to the admin / system / update tab
  • Add the following property to the pom file

    <sonar.tests> SRC / test / groovy, SRC / test / Java </sonar.tests>

If you do, both Spock and JUnit tests will show correctly! See attached screenshot Spock and JUnit test in sonar

+12
source

I no longer see this plugin available - I am using 7.7. For which version of sonarqube was this solution?

I see that coverage numbers (from jacoco) are reporting correctly, however this only shows the number of my 3 java tests (junit)

0
source

Source: https://habr.com/ru/post/1263416/


All Articles