Search code examples
visual-studio-2015mstest

How do I run MSTest V2 tests in Visual Studio 2015?


I try to run from Visual Studio 2015 a few tests that use MSTest V2. The tests are not discovered correctly: the Test Explorer shows no tests, and invites me to build the solution, even when I've built it, or to click “Run All” even if I clicked it already.

I thought that there was a possible problem with the project, so I created a new, empty test project (its MSTest V1 test was then discovered automatically and shown correctly), removed the reference to the old MSTest assembly, and added the NuGet packages MSTest.TestFramework and MSTest.TestAdapter. The project (containing one empty public test, properly decorated with [TestMethod], within a public class with a [TestClass] attribute) compiles correctly, but still, no tests are shown in Test Explorer.

There are no errors in the output window:

------ Discover test started ------

========== Discover test finished: 0 found (0:00:01.7331301) ==========

Are there additional steps to take in order for the MSTest V2 tests to work in Visual Studio 2015?


Solution

  • For Visual Studio 2015 try using AxoCover instead. I'm seeing the same issue in Visual Studio 2015 where the test projects using MSTest V2 are not discovered by the Test Explorer. Looks like in AxoCover you can pick MSTest v1 or v2, but not both. I haven't seen a similar compatibility issue when using NUnit.