Visual Studio 2013 doesn't discover unit tests

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

    Make sure your test class is public so it can be found. And if you're referencing another class, make sure of the same.

    Also, sometimes if you have no Asserts or you're not decorating the test with a [TestMethod], a test might not be recognized.

    2 more things: 1) Async unit tests act funny at best, and none at all at worst. Have a look at this article by Stephen Cleary and keep from there if it interests you.

    2) If you use NUnit and you run into the same issues, keep in mind it's [TestCase] for Nunit, instead of [TestMethod]

    Having said the above, here's an article I've posted on the code project, with both MSTest & NUnit, in case you want to give it a spin and make sure you're not missing anything.

提交回复
热议问题