{"id":17915,"date":"2016-06-17T17:55:00","date_gmt":"2016-06-18T00:55:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/?p=17915"},"modified":"2019-02-14T17:33:55","modified_gmt":"2019-02-15T01:33:55","slug":"taking-the-mstest-framework-forward-with-mstest-v2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/taking-the-mstest-framework-forward-with-mstest-v2\/","title":{"rendered":"Taking the MSTest Framework forward with &#8220;MSTest V2&#8221;"},"content":{"rendered":"<p>Recently, we <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2016\/05\/30\/announcing-mstest-framework-support-for-net-core-rc2-asp-net-core-rc2\/\">announced MSTest Framework support for .NET Core RC2 \/ ASP.NET Core RC2<\/a> &#8211; <strong>this is &#8220;MSTest V2&#8221;<\/strong> as we fondly call it, and the release sets the direction for how we intend to evolve the MSTest framework.<\/p>\n<p><strong>First, some context &#8230;<\/strong>\nIn 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.<\/p>\n<p>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 &#8211; 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 <code>Microsoft.VisualStudio.TestTools.UnitTesting<\/code> is used, whereas in the case of UWP the namespace <code>Microsoft.VisualStudio.TestPlatform.UnitTestFramework<\/code> is used.<\/p>\n<p><strong>&#8220;MSTest V2&#8221;<\/strong>\nWe are putting all of this behind us with &#8220;MSTest V2&#8221;. This is the next iteration of MSTest and it comes with the following:\n<strong>(1)<\/strong> Uniform app-platform support\u00a0&#8211; this is a converged implementation that offers uniform app-platform support across desktop, Store, and UWP, <a href=\"https:\/\/visualstudio.uservoice.com\/forums\/330519-team-services\/suggestions\/10863717-support-mstest-test-framework-on-net-core\">ASP.NET Core 1.0, and .NET Core 1.0<\/a>.\n<strong>(2)<\/strong> Uniform <a href=\"https:\/\/visualstudio.uservoice.com\/forums\/330519-team-services\/suggestions\/3865310-allow-use-of-datatestmethod-datarow-in-all-unit\">DataRow support<\/a>, for all MSTest based test projects.\n<strong>(3)<\/strong> Ability to place the <a href=\"https:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio-2015\/suggestions\/4210365-also-allow-testcategory-on-test-class\">TestCategory attribute at the level of a class or assembly<\/a>.\n<strong>(4)<\/strong> Uniform, single end-user extensibility mechanism.\n<strong>(5)<\/strong> Delivered as a <a href=\"https:\/\/visualstudio.uservoice.com\/forums\/330519-team-services\/suggestions\/4049672-provide-nuget-packages-for-mstests\">NuGet package<\/a>.<\/p>\n<p>The <strong>linked announcement<\/strong> post above called out how to use it for applications\u00a0targeting .NET Core. Additionally, for applications targeting\u00a0desktop, or UWP, you can start using it <em><strong>right away<\/strong><\/em> (with Visual Studio 2015 itself) with these steps:<\/p>\n<p>Install the &#8220;MSTest V2&#8221; TestFramework as before i.e. look for, and install the framework package as shown below:\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/img2.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-17925\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/06\/img2.jpg\" alt=\"img2\" width=\"665\" height=\"92\" \/><\/a><\/p>\n<p>Next, install the corresponding adapter package as shown below (notice that this is different from the adapter package used when targeting .NET Core):\n<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/img6.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-17926\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/06\/img6.jpg\" alt=\"img6\" width=\"680\" height=\"83\" \/><\/a><\/p>\n<p>Next, insert the using directive in your code file as shown below (this\u00a0is the namespace for the converged implementation and matches the one used earlier for desktop):<\/p>\n<pre><code><span style=\"color: #0000ff\">using <\/span>Microsoft.VisualStudio.TestTools.UnitTesting;\n<\/code><\/pre>\n<p>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.<\/p>\n<p><strong>Our Next Steps<\/strong>\nHere are our next steps:\n<strong>(1)<\/strong> By the time Visual Studio &#8220;15&#8221; 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 &#8220;MSTest V2&#8221;.\n<strong>(2)<\/strong> All bug fixes and enhancements will be made only to &#8220;MSTest V2&#8221;.\n<strong>(3)<\/strong> We will continue to ship the earlier MSTest binaries in the box in the Visual Studio &#8220;15&#8221; release, but that will purely be for compatibility reasons.\n<strong>(4)<\/strong> We will document the extensibility model.\n<strong>(5)<\/strong> We will incorporate feedback we receive from the community.<\/p>\n<p><strong>Call to Action<\/strong>\nWe need your feedback to make that a robust rollout.\n<strong>(1)<\/strong> If you have tests projects already using MSTest, go ahead and manually update to this release as described above, and start using it.\n<strong>(2)<\/strong> If you have written MSTest extensions, try out your extensions with this release.\n<strong>(3)<\/strong> If you are writing up new tests, do so using this release.<\/p>\n<p><strong>Feedback<\/strong>\nPlease report your feedback\u00a0using the &#8220;Send Feedback&#8221; feature in Visual Studio, using <a href=\"https:\/\/connect.microsoft.com\/\">connect<\/a>, or even as comments on this post.\nWe shall continue to monitor user voice in this area and assess community interest in <a href=\"https:\/\/visualstudio.uservoice.com\/forums\/121579-visual-studio-2015\/suggestions\/13399980-make-ms-test-opensouce\">open sourcing<\/a>. We look forward to your feedback and suggestions.<\/p>\n<p><strong>Summary<\/strong>\nAs 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, we announced MSTest Framework support for .NET Core RC2 \/ ASP.NET Core RC2 &#8211; this is &#8220;MSTest V2&#8221; as we fondly call it, and the release sets the direction for how we intend to evolve the MSTest framework. First, some context &#8230; In Visual Studio we have an open and extensible test platform with [&hellip;]<\/p>\n","protected":false},"author":765,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[226,1,252],"tags":[],"class_list":["post-17915","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ci","category-devops","category-testing"],"acf":[],"blog_post_summary":"<p>Recently, we announced MSTest Framework support for .NET Core RC2 \/ ASP.NET Core RC2 &#8211; this is &#8220;MSTest V2&#8221; as we fondly call it, and the release sets the direction for how we intend to evolve the MSTest framework. First, some context &#8230; In Visual Studio we have an open and extensible test platform with [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/17915","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/765"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=17915"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/17915\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=17915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=17915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=17915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}