Visual Studio 2013 doesn't discover unit tests

前端 未结 30 1964
余生分开走
余生分开走 2020-11-28 21:46

I have a simple solution in visual studio 2013 that is composed by one web project, one library project and one unit test project. When I open the solution and try to run th

相关标签:
30条回答
  • 2020-11-28 22:30

    After spending 2 days... none of the above worked for me. The only "solution" was: Go to project properties -> Build Tab. Then click Advanced button on the right bottom corner of the pane. Change "Debug Info:" to "full" and click OK.

    Here are the screen shots:

    0 讨论(0)
  • 2020-11-28 22:30

    For the Visual Studio 2013.5, clearing the \TestResults directory in the solution helped. Visual Studio corrupted the mdf file in which it stores the discovered tests, thus preventing the discovery of unit tests.

    0 讨论(0)
  • 2020-11-28 22:33

    I have found that unit test methods marked as async void aren't discovered by the VS Test Explorer. This seems to be because VS would not have any way to wait for a test to finish and decide if it succeeded or not. If you absolutely need to have a test method to run asynchronously then get it to return a Task instead like async Task. I found that this fixed the issue for me.

    0 讨论(0)
  • 2020-11-28 22:36

    I was facing the same problem and I've remembered, again (this situation happened before), that selecting "Mixed Platform" on the solutions platform menu works, as well as the other answers.

    0 讨论(0)
  • 2020-11-28 22:39

    While AndyG's solution works, a more lasting solution could be to set the PreferredToolArchitecture environment variable to "x64", either by:

    How to make Visual Studio use the native amd64 toolchain

    or by:

    • Control Panel | System and Security | System | Advanced System Settings|Environment Variables
    • PreferredToolArchitecture = x64
    • DefaultToolArchitecture = Native64Bit
    • PROCESSOR_ARCHITECTURE = x64
    • ProcessorArchitecture = x64
    0 讨论(0)
  • 2020-11-28 22:40

    Go to Nuget package manager and download Nunit Adapter as follow.

    0 讨论(0)
提交回复
热议问题