Google test results integration with SonarQube

  • versions used
  1. SonarQube Enterprise 7.9.4 (build 35981),
  2. Scanner,
  3. Plugin SonarCFamily (cpp)
  • what am I trying to achieve :
    I want to integrate Unit test result from Google Test with sonarqube.

  • what have I tried so far to achieve this
    I some how managed to get results in junit xml format.
    I am able to integrate code coverage from gcov in sonarqube format.
    But not able to import xml reports from gtest
    I am trying property sonar.junit.reportPaths, but this property is ignored during sonar-scanner execution.
    Please find below ::::


Hey there.

You have two options for importing test results with C/C++/Objective-C code. Junit is not one of them.

Language Property Remarks
All sonar.testExecutionReportPaths Comma-delimited list of paths to execution reports in the Generic Execution Data format.
C / C++ / Objective-C sonar.cfamily.cppunit.reportsPath Path to the directory holding the CPPUnit reports. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.
1 Like

Hi Colin,

I get the Google test report in Junit format which I could integrate in CI pipeline but not in SonarQube.

How do we get these xml files converted to SonarQube compatible format? Do we already have any compability with Google Test result?


The Generic Format is documented here, you may be able to search around to see if somebody has already scripted a converter from unit to the generic format, or build it yourself!

Thanks for Reply Colin, but this would surely need to build as I did not find any soluntion as of now. That is the reason this ticket was created.

But I really hope we have some solution from Google Test or SonarQube in future.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.