Visual Studio 2013 doesn't discover unit tests

前端 未结 30 2009
余生分开走
余生分开走 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:45

    Let's just say for argument's sake that you need to use X64 architecture on your test project in order for the dependencies to build properly (as in my case). You may need to modify your Default Processor Architecture under the Test--Test Settings menu. Setting this to X64 allowed my test explorer to find my tests using Microsoft.VisualStudio.TestTools.UnitTesting.

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

    You just need to install this package only:

    NUnit TestAdapter NUnit TestAdapter

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

    Just ran into this as well as I didn't see a similar case that was similar to mine.

    In the .csproj file of my test project, NUnit reference privacy was set to False:

    <Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
      <HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
      <Private>False</Private>
    </Reference>
    

    After I set <Private> to True it worked.

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

    I had the same problem until I realized I made a cut/paste error and left off [Test Method] before the test.

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

    I came across the same issue. And investigated and found that the dll's were not build, and put in the right folder. as soon as I changed my configuration they appeared. - the Projects build options, what folder should be used? - the build menu entry build configuration, they should be checked.

    that fixed it for me.

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

    I had the exact same problem.

    It was due to incompatible version of NUnit I'd added to my project (3.2.0) and the Test Adapter I had installed (2.0.0).

    To fix, use "Tools > Extensions and Updates" and search for NUnit3 Test Adapter, it discovered my tests after that.

    Cheers

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