VSTest plugin + dotCover, no covered code detected with MS Fakes tests?

I am running the latest version of TC (9.0.4), the correct (newer) VSTest console runner plugin, the logger, and bundled dotCover on a set of C# solutions with tests.

Everything ran perfectly with dotCover getting the coverage for me on basic unit tests.  When I added a test project with MS Fakes, I got this:

    " No covered code was detected.

     The issue could be caused by one of the following:

     - Include / exclude patterns are incorrect

     - Assemblies are compiled without debugging information

     - .pdb files are not available

     - Visual Studio code coverage is enabled for MSTest

     - .testrunconfig is used for MSTest and Visual Studio code coverage is not disabled (CodeCoverage section with enable="true" is present)  "

All settings the same...  and there is no .runsettings file in my project.  Is it considering some of the Fakes tools as diagnostic data adapters?  Or is it a specific setting in the test project?  I looked and didn't see anything in the test .csproj that looked like it would trigger this type of message.

I made a command line build step to run VSTest and dotCover on the tests with the same result.

I need coverage on my MS Fakes tests...  What am I missing?  Any help or ideas would be appreciated.  :)

EDIT:  Just found this in the issue tracker:  DCVR-2341 Ability to cover tests which use Fakes/Moles mocking framework

They put this on hold four years ago and nobody is assigned to this issue.  Fakes is commonly used now.  I guess I'll have to switch to something else like a lot of the other commenters on that page.   :(

ANOTHER EDIT: This open source project just added full support for Fakes a couple of months ago:  https://github.com/OpenCover/opencover

Hopefully the DotCover team can figure it out from that....  ;)

Comment actions Permalink

I just wanted to add that this is still an issue in the 9.1 release. I'm having the same problem where the tests are run correctly, but no coverage is reported.

I'm using the VSTest engine with VSTest 2013, /UseVsixExtensions:true, and the bundled version of dotCover.

Comment actions Permalink

Thank you,  I have been corresponding with them since my last post.  They told me that the dotCover team was busy with something right now, and that Fakes will most likely be worked on after that.  

The link to the issue tracker for Fakes to work in dotCover:  https://youtrack.jetbrains.com/issue/DCVR-2341

Check it out and add your vote.

In the meantime, I'm just having VSTest do the coverage, convert Microsoft's resulting report into an xml file, then using ReportGenerator to clean it up.  Lots of work, kinda hacky, not as useful as dotCover will be when it works....  :)


Please sign in to leave a comment.