Kostis Kapelonis (53) [Avatar] Offline
#1
It has come to my attention via this stackoveflow question that in the recent versions of SonarQube, if a project has both JUnit and Spock tests, only the JUnit ones are shown.

http://stackoverflow.com/questions/41886878/integrate-spocks-test-with-sonar

Code coverage is calculated correctly (for both types of tests) and shown accordingly so nothing is broken regarding this aspect. It would be good however to be able to inspect Spock tests as well via the SonarQube interface.

The solution to the problem involves the following two steps:

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>


After the next SonarQube run (mvn sonar:sonar) both types of tests will appear correctly.
(See attached image)

.