Hi,
I am writing unit test using google test and generated xml file using mytest --gtest_output=xml:output.xml.
Now i want to load gtest generated xml report to sonarqube which is integrated with jenkins. I am facing issue in loading xml report and to display unit test results in dashboard.
I have used following sonar properties in groovy file
-Dsonar.tests=src/tests
-Dsonar.testExecutionReportPaths=/bin/**/tests/UnitTestCase.xml
i have tried even
-Dsonar.cxx.xunit.reportPath=/bin//tests/UnitTestCase.xml
and
-Dsonar.junit.reportPaths=/bin//tests/UnitTestCase.xml
But could not solve my issue.
Anyone please suggest me how can i proceed / how to convert gtest generated xml file to generic test execution format to make unit test display in sonarqube
INFO: Parsing /home/jenkins/workspace/T_THINCLIENT/Skipper/skipper/bin//tests/TEST-UnitTestCase.xml
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 3.906s
INFO: Final Memory: 21M/74M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Error during parsing of generic test execution report '/home/jenkins/workspace/T_THINCLIENT/Skipper/skipper/bin//tests/TEST-UnitTestCase.xml’. Look at the SonarQube documentation to know the expected XML format.
ERROR: Caused by: /home/jenkins/workspace/T_THINCLIENT/Skipper/skipper/bin/**/tests/TEST-UnitTestCase.xml (No such file or directory)
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
script returned exit code 2
Sonarqube is not able to pick the unit test xml which is generated from googletest framework.
Can u suggest me how to convert gtest xml to generic xml report format.
Hi @ganncamp, @Anitha ,
I am also facing the same issue . I am using Jest framework for unit testing.
How did u fix the issue? Please suggest me on this.TIA
below are logs and sonar.properties
[Test/Sonar] INFO: Parsing /reports/test-reporter.xml
[Test/Sonar] INFO: ------------------------------------------------------------------------
[Test/Sonar] INFO: EXECUTION FAILURE
[Test/Sonar] INFO: ------------------------------------------------------------------------
[Test/Sonar] INFO: Total time: 23.444s
[Test/Sonar] INFO: Final Memory: 31M/117M
[Test/Sonar] INFO: ------------------------------------------------------------------------
[Test/Sonar] ERROR: Error during SonarQube Scanner execution
[Test/Sonar] ERROR: Error during parsing of generic test execution report ‘/reports/test-reporter.xml’. Look at the SonarQube documentation to know the expected XML format.
[Test/Sonar] ERROR: Caused by: Line 3 of report refers to a file which is not configured as a test file: /src/test/Users.spec.js
[Test/Sonar] ERROR:
[Test/Sonar] ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
[Pipeline] [Test/Sonar] }
[Test/Sonar] WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeeded?
Hi @ganncamp,
I have included these file in sonar.properties file( sonar.test.inclusions=./src/test/*.spec.js )
and the test-reporter.xml format also correct…
Pls share your input on these errors. TIA