Skip to content

Latest commit

 

History

History

README.md

Scenario Description

Collect and view code coverage in Microsoft Visual Studio Enterprise.

Collect code coverage

  1. Clone repository

    git clone https://github.com/microsoft/codecoverage.git
  2. Open solution in Visual Studio Enterprise

    cd codecoverage/samples/VisualStudio
    start VisualStudio.sln
  3. Collect code coverage using Analyze Code Coverage for All Tests in the Test menu.

    alt text

  4. Specify cobertura.runsettings file to generate cobertura report instead of default coverage report.

    <?xml version="1.0" encoding="utf-8"?>
    <RunSettings>
      <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>
              <Format>cobertura</Format>
              <CodeCoverage>
                <UseVerifiableInstrumentation>False</UseVerifiableInstrumentation>
                <EnableStaticNativeInstrumentation>False</EnableStaticNativeInstrumentation>
                <EnableDynamicNativeInstrumentation>False</EnableDynamicNativeInstrumentation>
              </CodeCoverage>
            </Configuration>
          </DataCollector>
        </DataCollectors>
      </DataCollectionRunSettings>
    </RunSettings>

    runsettings-file

Enable code coverage coloring

  1. Enable overall code coverage coloring using enable code coverage coloring Show Code Coverage Coloring button in the Code Coverage Results window toolbar.

    Enable Code Coverage Coloring in Visual Studio

  2. Enable Line Coloring to view coverage status in the code editor.

    Show Code Coverage Coloring in the code editor

  3. Enable Margin Glyphs to view coverage status in the margin editor.

    Show Code Coverage Coloring in the margin editor

Update code coverage result window layout

  1. Update columns using add remove columns Add/Remove Columns... from the context menu.

    Add remove columns context menu

  2. Add/remove or re-order columns in the Add / Remove Columns dialog.

    Columns selector window