Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sonarqube gradle plugin excluding jacoco integration tests

I'm trying to integrate the sonarqube gradle plugin with the jacoco plugin:

classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.1'

apply plugin: 'org.sonarqube' apply plugin: 'jacoco'

My build/jacoco folder contains: integrationTest.exec test.exec

However, the sonarqube plugin only recognises the 'test.exec' file:

18:20:45.130 INFO - JaCoCoItSensor: JaCoCo IT report not found: C:\Users\abc3\Downloads\sme-letter\target\jacoco-it.exec : 18:05:55.609 INFO - Analysing C:\Users\abc3\Downloads\sme-letter\build\jacoco\test.exec

How do I get the sonarqube plugin to recognise 'integrationTest.exec'

Thanks

Mark

like image 822
Mark Thomas Avatar asked Oct 26 '16 07:10

Mark Thomas


People also ask

How do you integrate SonarQube with gradle project?

login property in your command line or you configure it as part of your gradle. properties file. Execute gradle sonarqube -Dsonar. login=yourAuthenticationToken and wait until the build has completed, then open the web page indicated at the bottom of the console output.

What is SonarQube coverage?

2.1. Code Coverage. Code coverage, also called test coverage, is a measure of how much of the application's code has been run in testing. Essentially, it's a metric that many teams use to check the quality of their tests because it represents the percentage of the production code that has been tested and run.


1 Answers

I'm not really sure, whether this will work for Gradle plugun, but you may try.

Sonar has a property to specify the name of the integration tests JaCoCo report. This property is called sonar.jacoco.itReportPath (sonar.jacoco.reportPath for unit tests report).

And as far as I know, gradle sonar plugin let you add custom properties to it. So you can change IT report name via properties as follows:

sonarqube {
    properties {
        property "sonar.jacoco.itReportPath", "build/jacoco/ integrationTest.exec"
    }
}
like image 166
Stanislav Avatar answered Oct 24 '22 02:10

Stanislav