Does MSTest have an equivalent to NUnit’s TestCase?

Microsoft recently announced “MSTest V2” (see blog-article). This allows you to consistently (desktop, UWP, …) use the DataRow-attribute!

 [TestClass]  
 public class StringFormatUtilsTest  
 {  
     [DataTestMethod]  
     [DataRow("tttt", "")]  
     [DataRow("", "")]  
     [DataRow("t3a4b5", "345")]  
     [DataRow("3&5*", "35")]  
     [DataRow("123", "123")]  
     public void StripNonNumeric(string before, string expected)  
     {  
         string actual = FormatUtils.StripNonNumeric(before);  
         Assert.AreEqual(expected, actual);  
     }  
 } 

Again, Visual Studio Express’ Test Explorer unfortunately doesn’t recognize these tests. But at least the “full” VS versions now support that feature!

To use it, just install the NuGet packages MSTest.TestFramework and MSTest.TestAdapter (both pre-release as of now).

Older answer:

If don’t have to stick with MSTest and you’re just using it for being able to run the tests via Test Explorer because you only have a Visual Studio Express edition, then this might be a solution for you:

There’s the VsTestAdapter VSIX extension for being able to run NUnit tests via Test Explorer. Unfortunately, VS Express users can’t install extensions…
But fortunately the VsTestAdapter comes with a plain NuGet-Package, too!

So, if you’re a VS Express user, just install the VsTestAdapter NuGet-Package and enjoy running your NUnit tests/testcases via Test Explorer!


Unfortunately the aforementioned statement isn’t true. While it’s perfectly possible to install the package via an Express edition, it’s useless, since it can’t utilize the Test Explorer. There’s previously been a side note on an older version of the TestAdapter, which was removed from the 2.0.0’s description page:

Note that it doesn’t work with VS Express

Leave a Comment