Based on documentation : https://docs.sonarqube.org/latest/analysis/generic-test/
I want to create a report with my Javascript unit test files.
I’ve added propery in Jenkins file:
‘/d:sonar.testExecutionReportPaths=“Backoffice\unit-tests.xml”’
This generate a file with the results of my unit tests with the following format:
<testExecutions version="1"> <file path="testx/ClassOneTest.js"> <testCase name="test1" duration="5"/> <testCase name="test2" duration="500"> <skipped message="short message">other</skipped> </testCase> </file> </testExecutions>
Then I run this script to create my xml file.
"mocha --reporter node_modules/mocha-sonarqube-reporter content/scripts/test --reporter-options output=unit-tests.xml
In the deployment output file I confirm the xml is read but I get this error:
INFO: Sensor Generic Test Executions Report
INFO: Parsing C:\Jenkins\workspace\Connect_Pipeline\Backoffice\unit-tests.xml
INFO: Imported test execution data for 0 files
INFO: Test execution data ignored for 5 unknown files, including:
Ignoring my unit test JavaScript files.
I’ve tried different paths and still got the same error.