Can I import OpenCover / result into SonarQube?

I'm changing things to our Sonar setup now, since Gallio is no longer supported by C # Ecosystem 3. I have already successfully imported the unit test coverage using OpenCover with the following command.

"C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -register -target:"c:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console-x86.exe" -targetargs:"d:\Sonar\MyTest.dll /noshadow /framework=net-4.0" -output:"d:\Deploy\Sonar\Coverage.xml" "-filter:+[*]* -[*]Test" 

With this command, I get only unit test Coverage, but I would also like to see the number of failed and successful tests. I think I can achieve this with the / result option, for example

 "C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -register -target:"c:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console-x86.exe" -targetargs:"d:\Deploy\Sonar\MyTest.dll /noshadow /framework=net-4.0 /result=tests.xml" 

This command returns an xml with information about the running tests, but is there a way to import this xml into a SonarQube? Or is it not supported?

I am currently importing a Coverage.xml file with the following command:

 sonar.cs.opencover.reportsPaths=D:/Deploy/Sonar/Coverage.xml 

Is there a similar property to import the tests.xml file with the test results?

+5
source share
3 answers

Thanks to the following site http://www.codewrecks.com/blog/index.php/2009/07/19/integrate-nunit-test-into-a-tfs-build/ I was able to convert the result of the OpenCover test results to the .trx format using XSLT transform. After the transform I just used the default import function

 sonar.cs.vstest.reportsPaths=MyTestRestultFile.trx 
+1
source

OpenCover is now officially supported by SonarQube, see SonarQube Documentation . You can pass the location of the OpenCover XML report generated with the command line parameter

 /d:sonar.cs.opencover.reportsPaths="%path%\%report_file%" 

where %path% is the folder where your report file is created, and %report_file% is the name of your OpenCover XML report file.

+2
source

From the documentation at http://docs.codehaus.org/display/SONAR/C%23+Plugin, it looks like you can import unit test execution reports only in the MSTest format.

+1
source

Source: https://habr.com/ru/post/1205392/


All Articles