I am trying to get SonarQube while working with a simple network dot application. I had some success when it started, but the code didn't work.
It seems that many other people faced this problem when SonarQube stopped supporting many "go to" coverage tools, such as DotCover and OpenCover via Gallio
The following are examples:
I tried several VS command line tools to create a .coverage file
vstest.console.exe .\UnitTestProject1\bin\Debug\UnitTestProject1.dll /EnableCodeCoverage
and
CodeCoverage.exe collect /output:DynamicCodeCoverage.coverage .\UnitTestProject1\bin\Debug\UnitTestProject1.dll
And wrote some code to hide it in the .coveragexml file from here
To get the following XML:
<?xml version="1.0" standalone="yes"?> <CoverageDSPriv> <Module> <ModuleName>unittestproject1.dll</ModuleName> <ImageSize>32768</ImageSize> <ImageLinkTime>0</ImageLinkTime> <LinesCovered>12</LinesCovered> <LinesPartiallyCovered>0</LinesPartiallyCovered> <LinesNotCovered>0</LinesNotCovered> <BlocksCovered>9</BlocksCovered> <BlocksNotCovered>0</BlocksNotCovered> <NamespaceTable> <BlocksCovered>9</BlocksCovered> <BlocksNotCovered>0</BlocksNotCovered> <LinesCovered>12</LinesCovered> <LinesNotCovered>0</LinesNotCovered>
And even use the XSLT stylesheet in what the SonarQube runner can use
<?xml version="1.0" encoding="utf-8"?> <results> <modules> <module name="unittestproject1.dll" path="unittestproject1.dll" block_coverage="100" line_coverage="100" blocks_covered="9" blocks_not_covered="0" lines_covered="12" lines_partially_covered="0" lines_not_covered="0"> <functions> <function name="Setup" type_name="UnitTest1" block_coverage="100" line_coverage="100" blocks_covered="1" blocks_not_covered="0" lines_covered="2" lines_partially_covered="0" lines_not_covered="0"> <ranges> <range source_id="1" covered="yes" start_line="13" start_column="9" end_line="13" end_column="10" /> <range source_id="1" covered="yes" start_line="15" start_column="9" end_line="15" end_column="10" /> </ranges> </function>
when i start sonar
- MSBuild.SonarQube.Runner.exe Get Started
- Msbuild
- MSBuild.SonarQube.Runner.exe end
I am getting errors like Caused By: unknown XML Node , Pending Coverage , but got Results
This is because its not like the structure of my XML, but I'm not sure what it expects and how much work I have to do in the coverage file in order to convert it to a format that Sonar likes
Hope I went the wrong way, and there is an easy way to integrate VS Coverage or coveragexml files into Sonar without much difficulty.
Additional information about my Sonar plugins
- C # = 4.1
- Total coverage = 1.1
code-coverage mstest sonarqube vstest
user3210699
source share