Taking the MSTest Framework forward with “MSTest V2”

Pratap Lakshman

Recently, we announced MSTest Framework support for .NET Core RC2 / ASP.NET Core RC2this is “MSTest V2” as we fondly call it, and the release sets the direction for how we intend to evolve the MSTest framework.

First, some context … In Visual Studio we have an open and extensible test platform with tests being written using various test frameworks and executed using a variety of adapters. As a test platform we take a pluralistic approach, leaving the choice of test framework to the customer. And there now exists an ecosystem of test frameworks and adapters.

The MSTest framework occupies a distinct position in this ecosystem, and is used by many to write pure unit tests as well as to write UI/functional/load tests. However, over the years, we ended up creating multiple flavours of MSTest as we introduced support for new app-platforms – to the point where there are subtle differences in the feature set supported for desktop apps, Store apps, and for UWP apps. They even differ in the namespace used: for desktop the namespace Microsoft.VisualStudio.TestTools.UnitTesting is used, whereas in the case of UWP the namespace Microsoft.VisualStudio.TestPlatform.UnitTestFramework is used.

“MSTest V2” We are putting all of this behind us with “MSTest V2”. This is the next iteration of MSTest and it comes with the following: (1) Uniform app-platform support – this is a converged implementation that offers uniform app-platform support across desktop, Store, and UWP, ASP.NET Core 1.0, and .NET Core 1.0. (2) Uniform DataRow support, for all MSTest based test projects. (3) Ability to place the TestCategory attribute at the level of a class or assembly. (4) Uniform, single end-user extensibility mechanism. (5) Delivered as a NuGet package.

The linked announcement post above called out how to use it for applications targeting .NET Core. Additionally, for applications targeting desktop, or UWP, you can start using it right away (with Visual Studio 2015 itself) with these steps:

Install the “MSTest V2” TestFramework as before i.e. look for, and install the framework package as shown below: img2

Next, install the corresponding adapter package as shown below (notice that this is different from the adapter package used when targeting .NET Core): img6

Next, insert the using directive in your code file as shown below (this is the namespace for the converged implementation and matches the one used earlier for desktop):

using Microsoft.VisualStudio.TestTools.UnitTesting;

And that is it. You are all set. You can start authoring your tests. The tests will be discovered, and can be executed, as usual.

Our Next Steps Here are our next steps: (1) By the time Visual Studio “15” releases, we will update the appropriate test project templates and the test generation wizards (Create Unit Tests, and Create IntelliTest) to start emitting references to “MSTest V2”. (2) All bug fixes and enhancements will be made only to “MSTest V2”. (3) We will continue to ship the earlier MSTest binaries in the box in the Visual Studio “15” release, but that will purely be for compatibility reasons. (4) We will document the extensibility model. (5) We will incorporate feedback we receive from the community.

Call to Action We need your feedback to make that a robust rollout. (1) If you have tests projects already using MSTest, go ahead and manually update to this release as described above, and start using it. (2) If you have written MSTest extensions, try out your extensions with this release. (3) If you are writing up new tests, do so using this release.

Feedback Please report your feedback using the “Send Feedback” feature in Visual Studio, using connect, or even as comments on this post. We shall continue to monitor user voice in this area and assess community interest in open sourcing. We look forward to your feedback and suggestions.

Summary As a Test Platform, we still want you to make the final choice about what test framework to use. This release is intended to ensure that MSTest remains a viable choice for you to make.

0 comments

Discussion is closed.

Feedback usabilla icon