本文介绍了VS 2015无法打开CodeCoverage.exe生成的.coveragexml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


你可以看到相同的帖子; 


此致,


奥斯卡


You can see same post at; VS 2015 cannot open .coveragexml generated by CodeCoverage.exe

Since I could not get any answer from there, I am posting here as well.

Please advice.

I am following Code Coverage Results Import (C#, VB.NET) documentation for SonarQube.

For my project, I am able to generate test coverage binary file as "SonarQubeTests.csproj.coverage"

Visual Studio can open this file with no problem. I can see all the details.

Then when I try to generate ".coveragexml" file with following command;

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" "analyze /output:C:\SonarQubeTests.csproj.coveragexml C:\SonarQubeTests.csproj.coverage"

It does generate ".coveragexml" file, but when I try to open Visual Studio it gives me following error:

I can pen this file with text editor and content seems all fine. But neither Visual Studio 2015 nor sonarqube does not read this file.

What I am missing here?

P.S I have also runner settings for Ms Test runner as below. Not sure if this will effect something;

    <?xml version="1.0" encoding="utf-8"?>  
<RunSettings>  
  <!-- Configurations that affect the Test Framework -->  
  <RunConfiguration>  
    <MaxCpuCount>1</MaxCpuCount>  
    <!-- Path relative to solution directory -->  
    <ResultsDirectory>C:\</ResultsDirectory>  

    <!-- [x86] | x64    
      - You can also change it from menu Test, Test Settings, Default Processor Architecture -->  
    <TargetPlatform>x86</TargetPlatform>  

    <!-- Framework35 | [Framework40] | Framework45 -->  
    <TargetFrameworkVersion>Framework45</TargetFrameworkVersion>  

    <!-- Path to Test Adapters -->  
    <TestAdaptersPaths>%SystemDrive%\Temp\foo;%SystemDrive%\Temp\bar</TestAdaptersPaths>  
  </RunConfiguration>  

  <!-- Configurations for data collectors -->  
  <DataCollectionRunSettings>  
    <DataCollectors>  
      <DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">  
        <Configuration>  
          <CodeCoverage>  
            <ModulePaths>  
              <Exclude>  
                <ModulePath>.*CPPUnitTestFramework.*</ModulePath>  
              </Exclude>  
            </ModulePaths>  

            <!-- We recommend you do not change the following values: -->  
            <UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>  
            <AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>  
            <CollectFromChildProcesses>True</CollectFromChildProcesses>  
            <CollectAspDotNet>False</CollectAspDotNet>  

          </CodeCoverage>  
        </Configuration>  
      </DataCollector>  

    </DataCollectors>  
  </DataCollectionRunSettings>  

  <!-- Parameters used by tests at runtime -->  
  <TestRunParameters>  
    <Parameter name="webAppUrl" value="http://localhost" />  
    <Parameter name="webAppUserName" value="Admin" />  
    <Parameter name="webAppPassword" value="Password" />  
  </TestRunParameters>  

  <!-- Adapter Specific sections -->  

  <!-- MSTest adapter -->  
  <MSTest>  
    <MapInconclusiveToFailed>True</MapInconclusiveToFailed>  
    <CaptureTraceOutput>false</CaptureTraceOutput>  
    <DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>  
    <DeploymentEnabled>False</DeploymentEnabled>  
    <AssemblyResolution>  
      <Directory Path="D:\myfolder\bin\" includeSubDirectories="false"/>  
    </AssemblyResolution>  
  </MSTest>  

</RunSettings>

解决方案


这篇关于VS 2015无法打开CodeCoverage.exe生成的.coveragexml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 06:56