I am trying to process my .coveragexml file (after converting the .coverage file) that I get after using MSTest from the command line, but Sonar Runner continues to fail, trying to parse the file. Errors consist in analyzing errors, such as unexpected "?" and also cannot find the tag in the file.
I tried several ways to get the .coveragexml file: using the "vsinstr -coverage ..." and "start vsperfmon -coverage ..." (then run MSTest) commands from the command line, changing the .testrunconfig file and indicating for which dlls I want get coverage, and tried to use "CodeCoverage.exe collect ...". The first two gave me success in getting code coverage data, but I had trouble getting "CodeCoverage.exe collect ..." to collect the results. Despite the fact that I can get the results of code coverage obtained from the first two, the .coveragexml file that is produced does not seem to be in the correct format that SonarQube accepts, even if they indicate on their VB.NET plugin web page that they support MSTest and VSTest XML code files. I tried using VSTest and can get the .coveragexml files that Sonarqube will accept without any errors. The problem is that the company I work with uses MSTest to run all of their unit tests, so I need to get .coveragexml data using MSTest.
Another thing I noticed was that when I try to export the .coverage file as a .coveragexml in Visual Studio (for MSTest or VSTest), it creates a .coveragexml format that Sonarqube does not accept (these are just errors due to for the errors mentioned above). When I use the "CodeCoverage.exe analysis ..." command to convert the .coverage file from VSTest, it creates a .coveragexml that Sonarqube accepts because I am not getting any errors and can see the results of my code coverage in the control panel. Now when I try to use the "CodeCoverage.exe analysis ..." command to convert the .coverage file from MSTest, nothing happens. The .coveragexml file is not created, and no errors or any feedback is provided. I also tried writing a C # method to convert a .coverage file to a .coveragexml file using Microsoft.VisualStudio.Coverage.Analysis. But it creates the same .coveragexml format as if I were exporting it from Visual Studio.
Other things that may be helpful in understanding:
- I am running VB.NET code analysis.
- I am using version 2.2 of the VB.NET plugin from Sonarqube.
- I am using version 4.3.2 of Sonarqube and version 2.4 of Runner SonarQube.
- I am using Visual Studio 2013 Premium.
(SonarQube errors) .coveragexml file format after exporting it from Visual Studio is as follows:
<CoverageDSPriv> <xs:schema ...> ... </xs:schema> <Module> <ModuleName>...</ModuleName> <ImageSize>...</ImageSize> ... <NameSpaceTable> <BlocksCovered>...</BlocksCovered> ...
(agrees SonarQube) .coveragexml file format after using "CodeCoverage.exe analysis ..." (works only with VSTest.coverage file)
<?xml version="1.0" encoding="UTF-8" ?> <results> <modules> <module name="..." path="..." id="..." block_coverage="..." line_coverage="..." blocks_covered="..." ... > <functions> <function id="..." token="..." name="..." type_name="..." block_coverage="..." > ...
It seems that there are two completely different schemes for this data, and SonarQube accepts only one of them, is that so? Is there any other way to convert .coverage data to one that accepts SonarQube?
Lopes08
source share