Sonar uses the junit xml format uses to understand which tests were executed. It ties this together with a jacoco listener to provide data on which LOC are covered by a test and vice versa. This works by matching the test name against the sessionId in the jacoco exec file as per https://github.com/SonarSource/sonar-java/blob/master/sonar-jacoco-listeners/src/main/java/org/sonar/java/jacoco/TestNGListener.java
private static String getName(ITestResult result) {
return result.getTestClass().getName() + " " + result.getMethod().getMethodName();
}
Gradle 1.7 changed the format of the junit xml to include the params passed to a test by a testng dataprovider and so this feature is now broken. There are 2 options to fix;
- change the jacoco listener to understand the name above 2. make the testng report generator to be tweaked to not include the params
The former seems preferable but it’s not obvious on a quick scan through the grade code what the correct implemention would be. Can someone advise pls?