MSTest Framework Support in .NET/ASP.NET 1.0 Core RC 2

To smoothen the testing process for .NET Core 1.0 and ASP.NET Core 1.0 deployments, the Visual Studio team has released a preview of its MSTest Framework that supports the RC versions.

Microsoft's Visual Studio team has released a version of the MSTest Framework that now supports the RC2 versions of .NET Core and ASP.NET Core that were released recently. It's in preview at this point, so treat it accordingly (that is, don't assume it's ready for production use quite yet until you've done your own testing on your systems).

The MSTest Framework is Microsoft's framework developed for unit testing, and competes with third-party testing tools like the popular NUnit and xUnit. Some developers prefer MSTest because of its direct integration with Visual Studio and .NET Framework. MSTest is available on NuGet here.

A blog posted by Microsoft's Pratap Lakshman describes the process for using it, which involves installing the SDK, creating a class library project, adding references to MSTest in the runner and project.json file, and then writing and running tests. He writes that MSTest can also be used to test desktop .NET, which requires a slight change to the project.json file to reference it.

A few developers noted that tests didn't show up in the test runner when running MStest. The capitalization is key. As commenter Kris notes, "the value provided for 'testRunner' is 'MSTest', which apparently gets concatenated into dotnet-test-MSTest. However, if you look in your C:\Users\{username}\.nuget\packages\dotnet-test-mstest\1.0.0-preview\lib\net451 — you'll see the executable is dotnet-test-mstest." Lakshman verifies that to be the case (no pun intended).

Lakshman, in response to another commenter, notes that MStest also can be used with UWP. He replies that it essentially is a matter of replacing "Microsoft.VisualStudio.TestPlatform.UnitTestFramework;" with "Microsoft.VisualStudio.TestTools.UnitTesting;" in a unit test app template. Laksham said that he'll be following up with a more comprehensive post describing the process at a later time.

About the Author

Michael Domingo is a long-time software publishing veteran, having started up and managed several developer publications for the Clipper compiler, Microsoft Access, and Visual Basic. He's also managed IT pubs for 1105 Media, including Microsoft Certified Professional Magazine and Virtualization Review before landing his current gig as Visual Studio Magazine Editor in Chief. Besides his publishing life, he's a professional photographer, whose work can be found by Googling domingophoto.

comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.