Provide support for "per unit test coverage" reports in sonarqube

Sonarqube has a feature that allows it to report on coverage per test case and coverage of lines of code by test cases as described here -

For TestNG, this is easily done as follows;

dependencies {
        test.options {
            listeners << ''

For JUnit, this seems to be impossible as there is no way to register an additional ‘RunListener’ that I can see.

The ideal situation would be for the sonar-runner plugin to spot that the jacoco plugin is there and automatically add this feature in (if the sonar plugin is configured to provide per unit test reports).

Is this feature on the radar?

Alternatively, is there a way to register this manually for junit right now that I am missing?

I like that idea, at the moment I can’t see a simple way to achieve that as there is no way to add a custom junit RunListener to a task of type Test. I’ve raised GRADLE-2895 for this.

cheers, René

I submitted a pull request how I think this could work: