Hello,
SonarScanner version: 4.5.0.2216
SonarQube version: 8.6.0.39681
We’re using the sonar scanner on a JavaScript project with coverage (sonar.javascript.lcov.reportPaths) and tests execution reports (sonar.testExecutionReportPaths as specified in the Sonar Scanner Documentation) analysis.
When the execution report is missing, because you’ve decided to skip the tests execution in your ci pipeline for instance, the sonar scanner is crashing with the following error:
# sonar-scanner -Dsonar.projectKey=Project -Dsonar.projectName=Project -Dsonar.projectVersion=1.0 -Dsonar.sourceEncoding=UTF-8 -Dsonar.forceAnalysis=true -Dsonar.projectBaseDir=. -Dsonar.sources=web/themes/custom/project/src/js,web/modules/custom/ -Dsonar.exclusions=**/*.spec.js,**/*Test.php,**/*.ndjson,**/*.png,**/*.csv -Dsonar.coverage.exclusions=web/modules/custom/**/*.js -Dsonar.tests=web/themes/custom/project/src/tests/,web/modules/custom/project_api/tests/,web/modules/custom/project_static/tests/,web/modules/custom/project_customization/tests/ -Dsonar.php.tests.reportPath=phpunit-report.xml -Dsonar.php.coverage.reportPaths=phpunit-coverage-clover.xml -Dsonar.javascript.lcov.reportPaths=lcov.info -Dsonar.testExecutionReportPaths=xunit-sonar.xml
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.5.0.2216
INFO: Java 11.0.6 AdoptOpenJDK (64-bit)
INFO: Linux 4.19.128-microsoft-standard amd64
...
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 7:43.376s
INFO: Final Memory: 22M/84M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: Error during parsing of generic test execution report '/src/xunit-sonar.xml'. Look at the SonarQube documentation to know the expected XML format.
ERROR: Caused by: xunit-sonar.xml (No such file or directory)
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
This project does also contains php code. When the php execution report is missing, the sonar scanner handle the scenario gracefully by just printing the following warning message:
WARN: PHPUnit xml test report not found: phpunit-report.xml
And the scan is not crashing… And it’s the same for a java project with the sonar.coverage.jacoco.xmlReportPaths
option.
Is it possible to have the same behavior for the sonar.testExecutionReportPaths
option than the language specific options ?
Regards