Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(sonar with gallio and) opencover, code coverage: 0%

I'm working with sonar having Gallio using OpenCover, it gives me a code coverage of 0% although there are test classes and my machine takes about 15 seconds to try to run the tests (at least it seems like that), after which they're summed up with the line 0 run, 0 passed, 0 failed, 0 inconclusive, 0 skipped. So, I took a look around the internet / stackoverflow and found out that this could have to do with the code being compiled on another machine. As that's the case here as well, I opened the solution in Visual Studio, built it and I can see that my PDB files are recreated. After which I tried sonar with opencover again. It didn't help

I took the line of code with which OpenCover is called out of the admin console, went to the OpenCover directory and executed the same line, without a filter as my coverage-report.xml told me that the test modules were skippedDueTo="Filter". After which they were not skipped anymore. Still, 0% test coverage

I registered OpenCover profiler library with regsvr32 OpenCover.Profiler.dll in the same Admin console (and tried it twice, as I'm on windows 7 but am using a 32 bit sonar). Didn't help

I tried the same line with adding the -oldStyle argument Didn't help either

Now I feel like I'm out of options ...

The latest call I tried in the admin console:

C:\Program Files\OpenCover>OpenCover.Console.exe -register:user -target:"C:\Program Files\Gallio\bin\Gallio.Echo.exe" -targetdir:D:\projecten\udbdrm\source\CDP\CDPBackoffice\Develop\CDPBackoffice.root\CDPBackoffice\.sonar "-targetargs:\"/r:IsolatedAppDomain\" \"/report-directory:D:\projecten\udbdrm\source\CDP\CDPBackoffice\Develop\CDPBackoffice.root\CDPBackoffice\.sonar\" \"/report-name-format:gallio-report\" \"/report-type:Xml\" \"D:\projecten\udbdrm\source\CDP\CDPBackoffice\Develop\CDPBackoffice.root\CDPBackoffice\CDPBackoffice.BusinessLogic.Tests\bin\Debug\CDPBackoffice.BusinessLogic.Tests.dll\" \"D:\projecten\udbdrm\source\CDP\CDPBackoffice\Develop\CDPBackoffice.root\CDPBackoffice\CDPBackoffice.Utility.Tests\bin\Debug\CDPBackoffice.Utility.Tests.dll\" \"D:\projecten\udbdrm\source\CDP\CDPBackoffice\Develop\CDPBackoffice.root\CDPBackoffice\CDPBackoffice.DataAccessLayer.Tests\bin\Debug\CDPBackoffice.DataAccessLayer.Tests.dll\"" -mergebyhash -output:D:\projecten\udbdrm\source\CDP\CDPBackoffice\Develop\CDPBackoffice.root\CDPBackoffice\.sonar\coverage-report.xml -oldStyle

The solution does have several test classes, which run when executing them in Visual Studio and they do call source classes. Some of them fail some of them succeed.

Anyone who still has a clue on how to get test results? Preferrably in sonar, but hey, as executing OpenCover with the call above puts the results in the coverage-report.xml and sonar uses that as input I'm fine with a working call ...

like image 747
user1829860 Avatar asked Mar 06 '26 21:03

user1829860


1 Answers

Apparently all I needed to add to the sonar-project.properties was this line: sonar.gallio.runner=IsolatedProcess

like image 88
user1829860 Avatar answered Mar 08 '26 19:03

user1829860