Generic test execution report doesn't find files in multi-module gradle

Hi,
I’ve a multi module gradle project and, after creating the code coverage for a submodule (and the Generic test execution report ) I get this “error” when running gradle sonar --debug':

2024-04-13T17:49:50.368+0100 [INFO] [org.sonarqube.gradle.SonarTask] Parsing C:\Users\dfmic\Desktop\Projects\gradle-frontend\frontend\coverage\sonar-report.xml
2024-04-13T17:49:50.397+0100 [INFO] [org.sonarqube.gradle.SonarTask] Imported test execution data for 0 files
2024-04-13T17:49:50.397+0100 [INFO] [org.sonarqube.gradle.SonarTask] Test execution data ignored for 1 unknown files, including:
./frontend\tests\main.test.tsx

As a consequence, I can’t see the unit test count in sonarqube.
I also tried to add the absolute path in the tests of sonar-report.xml but nothing has changed.

Repo to replicate the issue: Github gradle-frontend Repo

Similar Issue: Multi-module generic test execution report not picked up by scanner

What am I doing wrong?

Thank you for your help

1 Like

Hey there.

As noted in the template post – what version of SonarQube are you using? You can find this info in the footer of your SonarQube instance.

1 Like

Hey Colin,
Thank you for your answer, the version is

  • Community Edition
  • Version 10.3 (build 82913)

Thanks for the info, and thanks for the reproducer.

I’m not getting any further than you are (and I’ve tried lots of different file paths in the test repot), so I’ve flagged this for some expert attention.

1 Like

Hello,

Could you please execute the sonar task with the option --dumpToFile=out.properties and share the content of the generated properties file with us?

Best,
Margarita

1 Like

Hello, thank you for your answer,
I retrieved the info from Sonarqube as of this Sonarqube documentation

The equivalent output is available in […]

Plugins:
Bundled analyzers:
  - Python Code Quality and Security 4.10.0.13725 (python)
  - Clean as You Code 2.2.2.656 (cayc)
  - Go Code Quality and Security 1.15.0.4655 (go)
  - JaCoCo 1.3.0.1538 (jacoco)
  - Kotlin Code Quality and Security 2.18.0.2938 (kotlin)
  - IaC Code Quality and Security 1.22.0.7057 (iac)
  - JavaScript/TypeScript/CSS Code Quality and Security 10.9.0.24449 (javascript)
  - Ruby Code Quality and Security 1.15.0.4655 (ruby)
  - Scala Code Quality and Security 1.15.0.4655 (sonarscala)
  - C# Code Quality and Security 9.13.0.79967 (csharp)
  - Java Code Quality and Security 7.27.1.33504 (java)
  - HTML Code Quality and Security 3.11.0.4708 (web)
  - Flex Code Quality and Security 2.12.0.4568 (flex)
  - XML Code Quality and Security 2.10.0.4108 (xml)
  - PHP Code Quality and Security 3.33.0.11274 (php)
  - Text Code Quality and Security 2.7.1.1388 (text)
  - VB.NET Code Quality and Security 9.13.0.79967 (vbnet)
  - Configuration detection for Code Quality and Security 1.3.0.654 (config)
Global server settings:
  - sonar.core.id=1AD9A096-AYiNhcZ0TXUZ34oGh1P1
  - sonar.core.startTime=2024-04-08T22:16:33+0000
  - sonar.forceAuthentication=true
  - sonar.lf.enableGravatar=false
  - sonar.qualityProfiles.allowDisableInheritedRules=false
Project server settings:
Project scanner properties:
  - sonar.host.url=HIDDEN
  - sonar.java.enablePreview=false
  - sonar.java.jdkHome=C:\Users\dfmic\.jdks\jdk-21.0.2
  - sonar.java.source=21
  - sonar.java.target=21
  - sonar.kotlin.gradleProjectRoot=C:\Users\dfmic\Desktop\Projects\gradle-frontend
  - sonar.modules=:frontend
  - sonar.projectBaseDir=C:\Users\dfmic\Desktop\Projects\gradle-frontend
  - sonar.projectKey=gradle-frontend
  - sonar.projectName=gradle-Frontend
  - sonar.projectVersion=1.0-SNAPSHOT
  - sonar.qualitygate.wait=false
  - sonar.scanner.app=ScannerGradle
  - sonar.scanner.appVersion=5.0.0.4638/Gradle 8.7-20240205001347+0000
  - sonar.sourceEncoding=UTF-8
  - sonar.sources=
  - sonar.testExecutionReportPaths=frontend/coverage/sonar-report.xml
  - sonar.token=******
  - sonar.verbose=true
  - sonar.working.directory=C:\Users\dfmic\Desktop\Projects\gradle-frontend\build\sonar
Scanner properties of module: gradle-frontend:frontend
  - sonar.javascript.lcov.reportPaths=coverage/lcov.info
  - sonar.moduleKey=gradle-frontend:frontend
  - sonar.projectBaseDir=C:\Users\dfmic\Desktop\Projects\gradle-frontend\frontend
  - sonar.projectKey=gradle-frontend:frontend
  - sonar.projectName=frontend
  - sonar.projectVersion=unspecified
  - sonar.sources=src
  - sonar.test.inclusions=**/*.test.{ts,tsx}
  - sonar.tests=tests

Hello @DFMichelangelo,
Thanks for your reply. It seems to me that the problem is that your report is defined as a property for the root project and not of the submodule, but the sources are in the frontend submodule.

Could you please add the test reports property to the sonar configuration of the submodule and send me the properties list again?

Best,
Margarita

1 Like

Hello @Margarita_Nedzelska,
Thank you for your help,
I’ve added the property to the submodule frontend, Github link of the change

Plugins:
Bundled analyzers:
  - Python Code Quality and Security 4.10.0.13725 (python)
  - Clean as You Code 2.2.2.656 (cayc)
  - Go Code Quality and Security 1.15.0.4655 (go)
  - JaCoCo 1.3.0.1538 (jacoco)
  - Kotlin Code Quality and Security 2.18.0.2938 (kotlin)
  - IaC Code Quality and Security 1.22.0.7057 (iac)
  - JavaScript/TypeScript/CSS Code Quality and Security 10.9.0.24449 (javascript)
  - Ruby Code Quality and Security 1.15.0.4655 (ruby)
  - Scala Code Quality and Security 1.15.0.4655 (sonarscala)
  - C# Code Quality and Security 9.13.0.79967 (csharp)
  - Java Code Quality and Security 7.27.1.33504 (java)
  - HTML Code Quality and Security 3.11.0.4708 (web)
  - Flex Code Quality and Security 2.12.0.4568 (flex)
  - XML Code Quality and Security 2.10.0.4108 (xml)
  - PHP Code Quality and Security 3.33.0.11274 (php)
  - Text Code Quality and Security 2.7.1.1388 (text)
  - VB.NET Code Quality and Security 9.13.0.79967 (vbnet)
  - Configuration detection for Code Quality and Security 1.3.0.654 (config)
Global server settings:
  - sonar.core.id=1AD9A096-AYiNhcZ0TXUZ34oGh1P1
  - sonar.core.startTime=2024-04-20T22:51:40+0000
  - sonar.forceAuthentication=true
  - sonar.lf.enableGravatar=false
  - sonar.qualityProfiles.allowDisableInheritedRules=false
Project server settings:
Project scanner properties:
  - sonar.host.url=HIDDEN
  - sonar.java.enablePreview=false
  - sonar.java.jdkHome=C:\Users\dfmic\.jdks\jdk-21.0.2
  - sonar.java.source=21
  - sonar.java.target=21
  - sonar.kotlin.gradleProjectRoot=C:\Users\dfmic\Desktop\Projects\gradle-frontend
  - sonar.modules=:frontend
  - sonar.projectBaseDir=C:\Users\dfmic\Desktop\Projects\gradle-frontend
  - sonar.projectKey=gradle-frontend
  - sonar.projectName=gradle-Frontend
  - sonar.projectVersion=1.0-SNAPSHOT
  - sonar.qualitygate.wait=false
  - sonar.scanner.app=ScannerGradle
  - sonar.scanner.appVersion=5.0.0.4638/Gradle 8.7-20240205001347+0000
  - sonar.sourceEncoding=UTF-8
  - sonar.sources=
  - sonar.token=******
  - sonar.working.directory=C:\Users\dfmic\Desktop\Projects\gradle-frontend\build\sonar
Scanner properties of module: gradle-frontend:frontend
  - sonar.javascript.lcov.reportPaths=coverage/lcov.info
  - sonar.moduleKey=gradle-frontend:frontend
  - sonar.projectBaseDir=C:\Users\dfmic\Desktop\Projects\gradle-frontend\frontend
  - sonar.projectKey=gradle-frontend:frontend
  - sonar.projectName=frontend
  - sonar.projectVersion=unspecified
  - sonar.sources=src
  - sonar.test.inclusions=**/*.test.{ts,tsx}
  - sonar.testExecutionReportPaths=/coverage/sonar-report.xml
  - sonar.tests=tests

Worth to mention this sonar community discussion that lead me to add the test report property in the general properties of sonar

Thank you again for your time,
Best Regards,
Michelangelo

1 Like