GenericTestExecution does not work with maven multi-modules

Using Sonarqube 7.7 with latest sonar-maven-plugin

Having a Maven multi-module structure like:

a with property (<sonar.testExecutionReportPaths>${project.build.directory}/karma-reports/TEST-gui.Sonar.xml</sonar.testExecutionReportPaths>)

  • b (this module contains the generic test execution report)
  • c

Executing sonar:sonar on parent module a does not execute the sensor on module b to collect the generic test execution.
Executing sonar:sonar directly on module b works as expected.

Kind regards,
Michael

2 Likes

Sorry for the late reply, Michael.
Do you happen to have a simple reproducer? Or do you have logs with debug enabled of the execution of module a?

I tested this now with SonarQube 7.9 LTS and maven sonar:sonar goal

The problem is that the sensor for the generic test reports is only checked at the top maven project, not on its child projects.

This is very important for us to work, please consider allowing generic test reports for all maven child modules.

Hi Michael,

The request for either logs or a simple reproducer stands. Do you have either of those available?

 
:slight_smile:
Ann

There is not much outcome of the logs as the sensor only runs on the top level module as I described. I think it should be straight forward for you to change the execution policy of this sensor to be also executed on submodules.
If I made the wrong conclusion out of the logs please let me know, then I will prepare a reproducer.

Hi

I’ll let Duarte decide about the logs, but it makes sense to go ahead with a reproducer.

 
Thx,
Ann

I confirm that this problem happens with version 7.9.1. The sonar.testExecutionReportPaths property is ignored when specified in the pom of a submodule. The log miss the any reference to “Sensor Generic Test Executions Report”.

The property is taken in consideration when included in the main module’s pom, an the logs contains this part:

11:15:51  [INFO] ------------- Run sensors on module ***<main module name>***
11:15:51  [INFO] Sensor JaCoCo XML Report Importer [jacoco]
11:15:51  [INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
11:15:51  [INFO] Sensor HTML [web]
11:15:51  [INFO] Sensor HTML [web] (done) | time=0ms
11:15:51  [INFO] Sensor XML Sensor [xml]
11:15:51  [INFO] 1 source files to be analyzed
11:15:51  [INFO] Sensor XML Sensor [xml] (done) | time=13ms
11:15:51  [INFO] Sensor Generic Test Executions Report
11:15:51  [INFO] Parsing /opt/jenkins/workspace/***main module name****/***submodule name****/target/test/javascript/reports/karma/ut_report.xml
11:15:51  [INFO] 1/1 source files have been analyzed
11:15:51  [INFO] Imported test execution data for 0 files
11:15:51  [INFO] Test execution data ignored for 1 unknown files, including:
11:15:51  src/app/app.component.spec.ts
11:15:51  [INFO] Sensor Generic Test Executions Report (done) | time=6ms

As expected the content of the report is ignored because the main module doesn’t cotains the tested files.

Thanks for your confirmation. It’s really disappointing that this feature does not work at all.
Any estimation when this will be fixed?
Is there already an issue ticket created which can be linked here?

Looks like this is broken since 7.6
https://jira.sonarsource.com/browse/SONAR-11530

Hi,

Thanks @reitzmichnicht for the detailed analysis of the issue.
I have the exact same issue where I have a multi-module application made of React modules.
I can generate an individual Generic Test Data report per module using jest-sonar-reporter in each module.
But how can we make SonarQube 7.6+ take these into account ? Any hint here would be welcome.

Thanks,
Nico

@ganncamp any updates on this? Looks like this is a regression introduced in 7.6 which could be easily fixed.