Problem in parsing test execution report

versions used : ‘Sonar scanner Version2.8’

error observed : Error during parsing of generic test execution report ‘/opt/jenkins/workspace/workspace/Test/xunit.xml’. Look at the SonarQube documentation to know the expected XML format.

steps to reproduce :
Hi, I am currently working on nodejs project and I have installed a ‘mocha-sonarqube-reporter’ npm
to test the nodejs code and generate the xml report
The xml report is getting generated as shown below and is available in the path - ‘/opt/jenkins/workspace/workspace/Test/xunit.xml’

<testExecutions version="1">
<file path="./test/bus-user-IT.js">
<testCase name="TEST Integration test suite: Should onboard business and user" duration="2822"/>
<testCase name="TEST Integration test suite: Session should be in VALIDATION COMPLETE state , Bus and User entities in ACTIVE state" duration="58075"/>
<testCase name="TEST Integration test suite: should submit USER registration request successfully" duration="5011"/>
<testCase name="TEST Integration test suite: Users must be in REGISTERED state" duration="33268"/>

In Jenkins I have added a ‘Sonar scanner Version2.8’ plugin and there was no issue while adding this.
In the jenkins job configuration > ‘Execute Sonarqube Scanner’ > Analysis properties
I have specified the property as : sonar.testExecutionReportPaths=/opt/jenkins/workspace/workspace/$JOB_NAME/xunit.xml

When I do the Jenkins build job, I get the below error

Error during parsing of generic test execution report ‘/opt/jenkins/workspace/workspace/Test/xunit.xml’. Look at the SonarQube documentation to know the expected XML format.

I compared xunit.xml format against the format given in
and found the xml format is correct.

Can you plz help me with solution to this problem.

Jenkins build will be success if I remove the property : sonar.testExecutionReportPaths=/opt/jenkins/workspace/workspace/$JOB_NAME/xunit.xml


I copy/pasted your example into a file and tried to analyze with it. And got the same error. When I added the missing <testExecutions version="1"> element at the very beginning, it worked.


Hi Ann, thanks for the reply, but earlier I too tried with and it didn’t worked, the was not appearing earlier due to formatting issue. Also can you please let me know in which version of sonarqube you tested and what was the filename that you gave for the xml file, in my case I specified the filename as xunit.xml.


My filename was genericTestExecution.xml. Since copy/pasting your text into a basic text file worked for me after I added the missing open tag, then I wonder if you don’t have some bad invisible characters in your file, or perhaps incompatible encoding.


Hi Ann thanks for the reply, can you please send me the sonar properties that you specified in the Jenkins like ( sonar.testExecutionReportPaths=/opt/jenkins/workspace/workspace/$JOB_NAME/xunit.xml). I am asking this because looks like I have missed some properties so I guess the unit test report is not coming up in the browser and I want to compare my properties against yours.


I ran the analysis manually sonar-scanner, and just made sure to specify sonar.coverageReportPaths=genericTestExecution.xml.

But the unit test report isn’t going to “come up in the browser”. It’s read by the analyzer and its data fed into SonarQube.


Thanks for the reply Ann.

A post was split to a new topic: Problems with test reports