Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code Coverage Results periodically gives: Empty results generated

I've run into a recurring problem with a few different projects using MSTest in VS2012, where every now and then my code coverage stops working (seemingly at random) and instead gives me:

Empty results generated: No binaries were instrumented. Make sure the tests ran, required binaries were loaded, had matching symbol files, and were not excluded through custom settings. For more information see http://go.microsoft.com/fwlink/?LinkID=253731

I've checked the obvious (what it's suggested) but can't seem to figure out what is causing it.

Here is my runsettings file:

<?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>
          <CodeCoverage>
            <ModulePaths>
              <Include>
                <ModulePath>.*\.dll$</ModulePath>
              </Include>
              <Exclude>
                <ModulePath>.*\.tests.dll</ModulePath>
              </Exclude>
            </ModulePaths>
            <Attributes>
              <Exclude>
                <Attribute>.*ExcludeFromCodeCoverageAttribute$</Attribute>
                <Attribute>.*GeneratedCodeAttribute$</Attribute>
              </Exclude>
            </Attributes>

            <UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
            <AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
            <CollectFromChildProcesses>True</CollectFromChildProcesses>
            <CollectAspDotNet>False</CollectAspDotNet>
          </CodeCoverage>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>
like image 347
markt Avatar asked Sep 13 '13 10:09

markt


People also ask

What does the code coverage report provide?

Your code coverage tool will monitor the execution of your test suite and tell you how much of the statements, branches, functions and lines were run as part of your tests.

How do I get code coverage results?

Code coverage option is available under the Test menu when you run test methods using Test Explorer. The results table shows the percentage of the code executed in each assembly, class, and procedure. The source editor highlights the tested code.

What is the difference between code coverage and test coverage?

While code coverage helps you verify if each code in the software application is being executed by existing tests or not, test coverage indicates whether those tests are covering all the functional requirements of the application or not.


1 Answers

I just ran into this using Visual Studio 2019. The solution was to go to the "Test" menu item in VS and then update the Test -> Processor Architecture for AnyCPU Projects setting from X86 to X64.

like image 184
David Conlisk Avatar answered Sep 23 '22 03:09

David Conlisk