{"id":55484,"date":"2025-02-10T10:05:00","date_gmt":"2025-02-10T18:05:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=55484"},"modified":"2025-02-27T09:36:33","modified_gmt":"2025-02-27T17:36:33","slug":"mtp-adoption-frameworks","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/mtp-adoption-frameworks\/","title":{"rendered":"Microsoft.Testing.Platform: Now Supported by All Major .NET Test Frameworks"},"content":{"rendered":"<p>A year ago, we launched <code>Microsoft.Testing.Platform<\/code> as part of the <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-ms-test-runner\">MSTest Runner announcement<\/a>. Our goal was to create a reliable testing platform for .NET projects, focused on extensibility and modularity.<\/p>\n<p>We are excited to announce that Microsoft.Testing.Platform has now reached 20 Million+ downloads. We are thrilled to see the adoption of the platform by all major .NET test frameworks. Whether you are using Expecto, MSTest, NUnit, TUnit, or xUnit.net, you can now leverage the new testing platform to run your tests.<\/p>\n<p>In this post, we\u2019ll highlight the test frameworks that have embraced <code>Microsoft.Testing.Platform<\/code>, share their unique characteristics, and provide resources for getting started.<\/p>\n<h2>What is Microsoft.Testing.Platform<\/h2>\n<p>Microsoft.Testing.Platform is a lightweight and portable alternative to <a href=\"https:\/\/github.com\/microsoft\/vstest\">VSTest<\/a> for running tests in all contexts, including continuous integration (CI) pipelines, CLI, Visual Studio Test Explorer, and VS Code Text Explorer. The Microsoft.Testing.Platform is embedded directly in your test projects, and there&#8217;s no other app dependencies, such as <code>vstest.console<\/code> or <code>dotnet test<\/code> needed to run your tests.<\/p>\n<p><code>Microsoft.Testing.Platform<\/code> is open source. To submit an issue or contribute to the project, you can find <code>Microsoft.Testing.Platform<\/code> code in <a href=\"https:\/\/github.com\/microsoft\/testfx\/tree\/main\/src\/Platform\/Microsoft.Testing.Platform\">microsoft\/testfx<\/a> GitHub repository.<\/p>\n<h3>Key features<\/h3>\n<p><code>Microsoft.Testing.Platform<\/code> is designed as a <strong>modular<\/strong> and <strong>extensible<\/strong> testing platform, allowing you to include only the components you need and to extend any part of the test execution.<\/p>\n<p>The core platform is designed to be <strong>portable<\/strong> and <strong>dependency-free<\/strong> allowing you to produce test applications that can run anywhere .NET is supported.\n<code>Microsoft.Testing.Platform<\/code> is also <strong>integrated<\/strong> with <strong>Visual Studio Test Explorer<\/strong>, <strong>VS Code Test Explorer<\/strong> in C# Dev Kit, <strong>Azure DevOps<\/strong> and <strong>.NET SDK<\/strong> providing a seamless experience for developers.<\/p>\n<h3>Additional resources<\/h3>\n<ul>\n<li><a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/testing\/unit-testing-platform-intro?tabs=dotnetcli\">Overview<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/testing\/unit-testing-platform-vs-vstest\">Comparison with VSTest<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/testing\/unit-testing-platform-integration-dotnet-test#dotnet-test---microsofttestingplatform-mode\">dotnet test support<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/testing\/unit-testing-platform-extensions\">Available extensions<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/microsoft\/testfx\">GitHub repository<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/testing\/unit-testing-platform-architecture\">Microsoft.Testing.Platform for extension authors<\/a><\/li>\n<\/ul>\n<h2>Enabling Microsoft.Testing.Platform in your favorite test framework<\/h2>\n<p>The test frameworks are ordered alphabetically.<\/p>\n<p>All examples below will assume the following production source code:<\/p>\n<p>Contoso.csproj:<\/p>\n<pre><code class=\"language-xml\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;\n\n  &lt;PropertyGroup&gt;\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt;\n  &lt;\/PropertyGroup&gt;\n\n&lt;\/Project&gt;<\/code><\/pre>\n<p>Calculator.cs:<\/p>\n<pre><code class=\"language-cs\">public class Calculator\n{\n    public int Add(int a, int b)\n    {\n        return a + b;\n    }\n}<\/code><\/pre>\n<h3>Expecto<\/h3>\n<p><a href=\"https:\/\/github.com\/haf\/expecto\"><strong>Expecto<\/strong><\/a> aims to make it easy to test CLR based software; be it with unit tests, stress tests, regression tests or property based tests. Expecto tests are parallel and async by default, so that you can use all your cores for testing your software. This also opens up a new way of catching threading and memory issues for free using stress testing.<\/p>\n<p>With the release of v0.15.0, <code>YoloDev.Expecto.TestSdk<\/code> now supports running test through the new testing platform. To opt-in, simply edit your project&#8217;s project file to set <code>&lt;EnableExpectoTestingPlatformIntegration&gt;true&lt;\/EnableExpectoTestingPlatformIntegration&gt;<\/code> and <code>&lt;OutputType&gt;Exe&lt;\/OutputType&gt;<\/code>.<\/p>\n<h4>Expecto Sample Application<\/h4>\n<p>Contoso.Tests.fsproj:<\/p>\n<pre><code class=\"language-xml\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;\n\n  &lt;PropertyGroup&gt;\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;\n\n    &lt;EnableExpectoTestingPlatformIntegration&gt;true&lt;\/EnableExpectoTestingPlatformIntegration&gt;\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;\n    &lt;TestingPlatformDotnetTestSupport&gt;true&lt;\/TestingPlatformDotnetTestSupport&gt;\n  &lt;\/PropertyGroup&gt;\n\n  &lt;ItemGroup&gt;\n    &lt;PackageReference Include=\"YoloDev.Expecto.TestSdk\" Version=\"0.15.1\" \/&gt;\n  &lt;\/ItemGroup&gt;\n\n  &lt;ItemGroup&gt;\n    &lt;ProjectReference Include=\"..\\Contoso\\Contoso.csproj\" \/&gt;\n  &lt;\/ItemGroup&gt;\n\n  &lt;ItemGroup&gt;\n    &lt;Compile Include=\"Test.fs\" \/&gt;\n  &lt;\/ItemGroup&gt;\n\n&lt;\/Project&gt;<\/code><\/pre>\n<p>Test.fs:<\/p>\n<pre><code class=\"language-fs\">module Contoso.Tests\n\nopen Expecto\n\n[&lt;Tests&gt;]\nlet tests =\n    testList \"Calculator Tests\" [\n        test \"Add function returns sum\" {\n            let calculator = Calculator()\n            let result = calculator.Add(1, 2)\n            Expect.equal result 3 \"Expected sum to be 3\"\n        }\n    ]<\/code><\/pre>\n<h3>MSTest<\/h3>\n<p><a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/testing\/unit-testing-mstest-intro\"><strong>MSTest<\/strong><\/a>, Microsoft Testing Framework, is a fully supported, open source, and cross-platform test framework with which to write tests targeting .NET Framework, .NET Core, .NET, UWP, and WinUI on Windows, Linux, and Mac.<\/p>\n<p>With v3.2.0 or later, <code>MSTest.TestAdapter<\/code> supports running tests through the new testing platform. To opt-in, simply edit your project&#8217;s project file to set <code>&lt;EnableMSTestRunner&gt;true&lt;\/EnableMSTestRunner&gt;<\/code> and <code>&lt;OutputType&gt;Exe&lt;\/OutputType&gt;<\/code>.<\/p>\n<h4>MSTest Sample Application<\/h4>\n<p>Contoso.Tests.csproj:<\/p>\n<pre><code class=\"language-xml\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;\n\n  &lt;PropertyGroup&gt;\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt;        \n\n    &lt;EnableMSTestRunner&gt;true&lt;\/EnableMSTestRunner&gt;\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;\n    &lt;TestingPlatformDotnetTestSupport&gt;true&lt;\/TestingPlatformDotnetTestSupport&gt;\n  &lt;\/PropertyGroup&gt;\n\n  &lt;ItemGroup&gt;\n    &lt;PackageReference Include=\"MSTest\" Version=\"3.7.3\" \/&gt;\n  &lt;\/ItemGroup&gt;\n\n  &lt;ItemGroup&gt;\n    &lt;ProjectReference Include=\"..\\Contoso\\Contoso.csproj\" \/&gt;\n  &lt;\/ItemGroup&gt;\n\n&lt;\/Project&gt;<\/code><\/pre>\n<p>Test.cs:<\/p>\n<pre><code class=\"language-cs\">[TestClass]\npublic class CalculatorTests\n{\n    [TestMethod]\n    public void Add_WhenCalled_ReturnsSum()\n    {\n        var calculator = new Calculator();\n        var result = calculator.Add(1, 2);\n\n        Assert.AreEqual(3, result);\n    }\n}<\/code><\/pre>\n<h3>NUnit<\/h3>\n<p><a href=\"https:\/\/nunit.org\/\"><strong>NUnit<\/strong><\/a> is a unit-testing framework for all .NET languages. Initially ported from <a href=\"https:\/\/www.junit.org\/\">JUnit<\/a>, the current production release has been completely rewritten with many new features and support for a wide range of .NET platforms.<\/p>\n<p>With the release of v5, <code>NUnit3TestAdapter<\/code> now supports running test through the new testing platform. To opt-in, simply edit your project&#8217;s project file to set <code>&lt;EnableNUnitRunner&gt;true&lt;\/EnableNUnitRunner&gt;<\/code> and <code>&lt;OutputType&gt;Exe&lt;\/OutputType&gt;<\/code>.<\/p>\n<h2>NUnit Sample Application<\/h2>\n<p>Contoso.Tests.csproj:<\/p>\n<pre><code class=\"language-xml\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;\n\n  &lt;PropertyGroup&gt;\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt;        \n\n    &lt;EnableNUnitRunner&gt;true&lt;\/EnableNUnitRunner&gt;\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;\n    &lt;TestingPlatformDotnetTestSupport&gt;true&lt;\/TestingPlatformDotnetTestSupport&gt;\n  &lt;\/PropertyGroup&gt;\n\n  &lt;ItemGroup&gt;\n    &lt;PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"17.12.0\" \/&gt;\n    &lt;PackageReference Include=\"NUnit\" Version=\"4.3.2\" \/&gt;\n    &lt;PackageReference Include=\"NUnit.Analyzers\" Version=\"4.6.0\"\/&gt;\n    &lt;PackageReference Include=\"NUnit3TestAdapter\" Version=\"5.0.0\" \/&gt;\n  &lt;\/ItemGroup&gt;\n\n  &lt;ItemGroup&gt;\n    &lt;ProjectReference Include=\"..\\Contoso\\Contoso.csproj\" \/&gt;\n  &lt;\/ItemGroup&gt;\n\n&lt;\/Project&gt;<\/code><\/pre>\n<p>Test.cs:<\/p>\n<pre><code class=\"language-cs\">public class CalculatorTests\n{\n    [Test]\n    public void Add_WhenCalled_ReturnsSum()\n    {\n        var calculator = new Calculator();\n        var result = calculator.Add(1, 2);\n\n        Assert.That(result,Is.EqualTo(3));\n    }\n}<\/code><\/pre>\n<h3>TUnit<\/h3>\n<p><a href=\"https:\/\/thomhurst.github.io\/TUnit\/\"><strong>TUnit<\/strong><\/a> is a modern, flexible and fast testing framework for C#, featuring with Native AOT and Trimmed Single File application support! This new test framework is built solely on top of <code>Microsoft.Testing.Platform<\/code>.<\/p>\n<h4>TUnit Sample Application<\/h4>\n<p>Contoso.Tests.csproj:<\/p>\n<pre><code class=\"language-xml\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;\n\n  &lt;PropertyGroup&gt;\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt;\n\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;\n  &lt;\/PropertyGroup&gt;\n\n  &lt;ItemGroup&gt;\n    &lt;PackageReference Include=\"TUnit\" Version=\"0.8.4\" \/&gt;\n  &lt;\/ItemGroup&gt;\n\n  &lt;ItemGroup&gt;\n    &lt;ProjectReference Include=\"..\\Contoso\\Contoso.csproj\" \/&gt;\n  &lt;\/ItemGroup&gt;\n\n&lt;\/Project&gt;<\/code><\/pre>\n<p>Test1.cs:<\/p>\n<pre><code class=\"language-cs\">public class CalculatorTests\n{\n    [Test]\n    public async Task Add_WhenCalled_ReturnsSum()\n    {\n        var calculator = new Calculator();\n        var result = calculator.Add(1, 2);\n\n        await Assert.That(result).IsEqualTo(3);\n    }\n}<\/code><\/pre>\n<h3>xUnit.net<\/h3>\n<p><a href=\"https:\/\/xunit.net\/\"><strong>xUnit.net<\/strong><\/a> is a free, open source, community-focused unit testing tool for the .NET Framework. Written by the original inventor of NUnit v2, xUnit.net is the latest technology for unit testing C#, F#, VB.NET and other .NET languages.<\/p>\n<p>With the release of <code>xunit.v3<\/code>, xUnit.net now supports running test through the new testing platform. To opt-in, simply edit your project&#8217;s project file to set <code>&lt;UseMicrosoftTestingPlatformRunner&gt;true&lt;\/UseMicrosoftTestingPlatformRunner&gt;<\/code>.<\/p>\n<h4>xUnit.net Sample Application<\/h4>\n<p>Contoso.Tests.csproj:<\/p>\n<pre><code class=\"language-xml\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;\n\n  &lt;PropertyGroup&gt;\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt; \n\n    &lt;UseMicrosoftTestingPlatformRunner&gt;true&lt;\/UseMicrosoftTestingPlatformRunner&gt;\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;\n    &lt;TestingPlatformDotnetTestSupport&gt;true&lt;\/TestingPlatformDotnetTestSupport&gt;\n  &lt;\/PropertyGroup&gt;\n\n  &lt;ItemGroup&gt;\n    &lt;PackageReference Include=\"xunit.v3\" Version=\"1.0.1\" \/&gt;\n    &lt;PackageReference Include=\"xunit.runner.visualstudio\" Version=\"3.0.1\" \/&gt;\n    &lt;PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"17.12.0\" \/&gt;\n  &lt;\/ItemGroup&gt;\n\n  &lt;ItemGroup&gt;\n    &lt;ProjectReference Include=\"..\\Contoso\\Contoso.csproj\" \/&gt;\n  &lt;\/ItemGroup&gt;\n\n&lt;\/Project&gt;<\/code><\/pre>\n<p>Test.cs:<\/p>\n<pre><code class=\"language-cs\">public class CalculatorTests\n{\n    [Fact]\n    public void Add_WhenCalled_ReturnsSum()\n    {\n        var calculator = new Calculator();\n        var result = calculator.Add(1, 2);\n\n        Assert.Equal(3, result);\n    }\n}<\/code><\/pre>\n<h2>Looking Ahead<\/h2>\n<p>We would like to extend our heartfelt appreciation to the framework authors we have collaborated with and continue to work closely with. We are thrilled to witness the ongoing evolution of this platform and its ability to empower developers. We eagerly anticipate numerous <a href=\"https:\/\/github.com\/microsoft\/testfx\/\">contributions<\/a> from the community and look forward to the innovative extensions that will be created.<\/p>\n<p>If you haven&#8217;t already, we encourage you to explore the platform, experiment with your preferred framework, and share your <a href=\"https:\/\/github.com\/microsoft\/testfx\/issues\">feedback<\/a>.<\/p>\n<p>Together, let&#8217;s continue to build an outstanding .NET testing ecosystem!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>All major .NET testing frameworks are now supporting Microsoft.Testing.Platform. Whether you are using Expecto, MSTest, NUnit, TUnit, or xUnit.net, you can now leverage the new testing platform to run your tests.<\/p>\n","protected":false},"author":140087,"featured_media":55720,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685,756,636,7199],"tags":[4,7265,46,73,136,145],"class_list":["post-55484","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-csharp","category-fsharp","category-visual-basic","tag-net","tag-announcements","tag-c","tag-f","tag-testing","tag-visual-basic"],"acf":[],"blog_post_summary":"<p>All major .NET testing frameworks are now supporting Microsoft.Testing.Platform. Whether you are using Expecto, MSTest, NUnit, TUnit, or xUnit.net, you can now leverage the new testing platform to run your tests.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/55484","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/140087"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=55484"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/55484\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/55720"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=55484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=55484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=55484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}