{"id":1716,"date":"2025-02-10T18:12:56","date_gmt":"2025-02-10T18:12:56","guid":{"rendered":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2025\/02\/10\/microsoft-testing-platform-now-supported-by-all-major-net-test-frameworks\/"},"modified":"2025-02-10T18:12:56","modified_gmt":"2025-02-10T18:12:56","slug":"microsoft-testing-platform-now-supported-by-all-major-net-test-frameworks","status":"publish","type":"post","link":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2025\/02\/10\/microsoft-testing-platform-now-supported-by-all-major-net-test-frameworks\/","title":{"rendered":"Microsoft.Testing.Platform: Now Supported by All Major .NET Test Frameworks"},"content":{"rendered":"<p>A year ago, we launched Microsoft.Testing.Platform 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+ 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 Microsoft.Testing.Platform, 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\u2019s no other app dependencies, such as vstest.console or dotnet test needed to run your tests.<\/p>\n<p>Microsoft.Testing.Platform is open source. To submit an issue or contribute to the project, you can find Microsoft.Testing.Platform 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>Microsoft.Testing.Platform 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.<br \/>\nMicrosoft.Testing.Platform 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<p><a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/testing\/unit-testing-platform-intro?tabs=dotnetcli\">Overview<\/a><br \/>\n<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/testing\/unit-testing-platform-vs-vstest\">Comparison with VSTest<\/a><br \/>\n<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/testing\/unit-testing-platform-integration-dotnet-test#dotnet-test---microsofttestingplatform-mode\">dotnet test support<\/a><br \/>\n<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/testing\/unit-testing-platform-extensions\">Available extensions<\/a><br \/>\n<a href=\"https:\/\/github.com\/microsoft\/testfx\">GitHub repository<\/a><br \/>\n<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/testing\/unit-testing-platform-architecture\">Microsoft.Testing.Platform for extension authors<\/a><\/p>\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<p>&lt;Project Sdk=&#8221;Microsoft.NET.Sdk&#8221;&gt;<\/p>\n<p>  &lt;PropertyGroup&gt;<br \/>\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;<br \/>\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;<br \/>\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt;<br \/>\n  &lt;\/PropertyGroup&gt;<\/p>\n<p>&lt;\/Project&gt;<\/p>\n<p>Calculator.cs:<\/p>\n<p>public class Calculator<br \/>\n{<br \/>\n    public int Add(int a, int b)<br \/>\n    {<br \/>\n        return a + b;<br \/>\n    }<br \/>\n}<\/p>\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, YoloDev.Expecto.TestSdk now supports running test through the new testing platform. To opt-in, simply edit your project\u2019s project file to set &lt;EnableExpectoTestingPlatformIntegration&gt;true&lt;\/EnableExpectoTestingPlatformIntegration&gt; and &lt;OutputType&gt;Exe&lt;\/OutputType&gt;.<\/p>\n<h4>Expecto Sample Application<\/h4>\n<p>Contoso.Tests.fsproj:<\/p>\n<p>&lt;Project Sdk=&#8221;Microsoft.NET.Sdk&#8221;&gt;<\/p>\n<p>  &lt;PropertyGroup&gt;<br \/>\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;<\/p>\n<p>    &lt;EnableExpectoTestingPlatformIntegration&gt;true&lt;\/EnableExpectoTestingPlatformIntegration&gt;<br \/>\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;<br \/>\n    &lt;TestingPlatformDotnetTestSupport&gt;true&lt;\/TestingPlatformDotnetTestSupport&gt;<br \/>\n  &lt;\/PropertyGroup&gt;<\/p>\n<p>  &lt;ItemGroup&gt;<br \/>\n    &lt;PackageReference Include=&#8221;YoloDev.Expecto.TestSdk&#8221; Version=&#8221;0.15.0&#8243; \/&gt;<br \/>\n  &lt;\/ItemGroup&gt;<\/p>\n<p>  &lt;ItemGroup&gt;<br \/>\n    &lt;Compile Include=&#8221;Test.fs&#8221; \/&gt;<br \/>\n  &lt;\/ItemGroup&gt;<\/p>\n<p>&lt;\/Project&gt;<\/p>\n<p>Test.fs:<\/p>\n<p>open Expecto<\/p>\n<p>let tests =<br \/>\n    testList &#8220;Calculator Tests&#8221; [<br \/>\n        test &#8220;Add function returns sum&#8221; {<br \/>\n            let calculator = Calculator()<br \/>\n            let result = calculator.Add(1, 2)<br \/>\n            Expect.equal result 3 &#8220;Expected sum to be 3&#8221;<br \/>\n        }<br \/>\n    ]<\/p>\n<p>[&lt;EntryPoint&gt;]<br \/>\nlet main argv =<br \/>\n    runTestsWithArgs defaultConfig argv tests<\/p>\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, MSTest.TestAdapter supports running tests through the new testing platform. To opt-in, simply edit your project\u2019s project file to set &lt;EnableMSTestRunner&gt;true&lt;\/EnableMSTestRunner&gt; and &lt;OutputType&gt;Exe&lt;\/OutputType&gt;.<\/p>\n<h4>MSTest Sample Application<\/h4>\n<p>Contoso.Tests.csproj:<\/p>\n<p>&lt;Project Sdk=&#8221;Microsoft.NET.Sdk&#8221;&gt;<\/p>\n<p>  &lt;PropertyGroup&gt;<br \/>\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;<br \/>\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;<br \/>\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt;        <\/p>\n<p>    &lt;EnableMSTestRunner&gt;true&lt;\/EnableMSTestRunner&gt;<br \/>\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;<br \/>\n    &lt;TestingPlatformDotnetTestSupport&gt;true&lt;\/TestingPlatformDotnetTestSupport&gt;<br \/>\n  &lt;\/PropertyGroup&gt;<\/p>\n<p>  &lt;ItemGroup&gt;<br \/>\n    &lt;PackageReference Include=&#8221;MSTest&#8221; Version=&#8221;3.7.3&#8243; \/&gt;<br \/>\n  &lt;\/ItemGroup&gt;<\/p>\n<p>&lt;\/Project&gt;<\/p>\n<p>Test.cs:<\/p>\n<p>[TestClass]<br \/>\npublic class CalculatorTests<br \/>\n{<br \/>\n    [TestMethod]<br \/>\n    public void Add_WhenCalled_ReturnsSum()<br \/>\n    {<br \/>\n        var calculator = new Calculator();<br \/>\n        var result = calculator.Add(1, 2);<\/p>\n<p>        Assert.AreEqual(3, result);<br \/>\n    }<br \/>\n}<\/p>\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, NUnit3TestAdapter now supports running test through the new testing platform. To opt-in, simply edit your project\u2019s project file to set &lt;EnableNUnitRunner&gt;true&lt;\/EnableNUnitRunner&gt; and &lt;OutputType&gt;Exe&lt;\/OutputType&gt;.<\/p>\n<h2>NUnit Sample Application<\/h2>\n<p>Contoso.Tests.csproj:<\/p>\n<p>&lt;Project Sdk=&#8221;Microsoft.NET.Sdk&#8221;&gt;<\/p>\n<p>  &lt;PropertyGroup&gt;<br \/>\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;<br \/>\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;<br \/>\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt;        <\/p>\n<p>    &lt;EnableNUnitRunner&gt;true&lt;\/EnableNUnitRunner&gt;<br \/>\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;<br \/>\n    &lt;TestingPlatformDotnetTestSupport&gt;true&lt;\/TestingPlatformDotnetTestSupport&gt;<br \/>\n  &lt;\/PropertyGroup&gt;<\/p>\n<p>  &lt;ItemGroup&gt;<br \/>\n    &lt;PackageReference Include=&#8221;Microsoft.NET.Test.Sdk&#8221; Version=&#8221;17.12.0&#8243; \/&gt;<br \/>\n    &lt;PackageReference Include=&#8221;NUnit&#8221; Version=&#8221;4.3.2&#8243; \/&gt;<br \/>\n    &lt;PackageReference Include=&#8221;NUnit.Analyzers&#8221; Version=&#8221;4.6.0&#8243;\/&gt;<br \/>\n    &lt;PackageReference Include=&#8221;NUnit3TestAdapter&#8221; Version=&#8221;5.0.0&#8243; \/&gt;<br \/>\n  &lt;\/ItemGroup&gt;<\/p>\n<p>&lt;\/Project&gt;<\/p>\n<p>Test.cs:<\/p>\n<p>public class CalculatorTests<br \/>\n{<br \/>\n    [Test]<br \/>\n    public void Add_WhenCalled_ReturnsSum()<br \/>\n    {<br \/>\n        var calculator = new Calculator();<br \/>\n        var result = calculator.Add(1, 2);<\/p>\n<p>        Assert.That(result,Is.EqualTo(3));<br \/>\n    }<br \/>\n}<\/p>\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 Microsoft.Testing.Platform.<\/p>\n<h4>TUnit Sample Application<\/h4>\n<p>Contoso.Tests.csproj:<\/p>\n<p>&lt;Project Sdk=&#8221;Microsoft.NET.Sdk&#8221;&gt;<\/p>\n<p>  &lt;PropertyGroup&gt;<br \/>\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;<br \/>\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;<br \/>\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt;<\/p>\n<p>    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;<br \/>\n  &lt;\/PropertyGroup&gt;<\/p>\n<p>  &lt;ItemGroup&gt;<br \/>\n    &lt;PackageReference Include=&#8221;TUnit&#8221; Version=&#8221;0.8.4&#8243; \/&gt;<br \/>\n  &lt;\/ItemGroup&gt;<\/p>\n<p>&lt;\/Project&gt;<\/p>\n<p>Test1.cs:<\/p>\n<p>public class CalculatorTests<br \/>\n{<br \/>\n    [Test]<br \/>\n    public async Task Add_WhenCalled_ReturnsSum()<br \/>\n    {<br \/>\n        var calculator = new Calculator();<br \/>\n        var result = calculator.Add(1, 2);<\/p>\n<p>        await Assert.That(result).IsEqualTo(3);<br \/>\n    }<br \/>\n}<\/p>\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 xunit.v3, xUnit.net now supports running test through the new testing platform. To opt-in, simply edit your project\u2019s project file to set &lt;UseMicrosoftTestingPlatformRunner&gt;true&lt;\/UseMicrosoftTestingPlatformRunner&gt;.<\/p>\n<h4>xUnit.net Sample Application<\/h4>\n<p>Contoso.Tests.csproj:<\/p>\n<p>&lt;Project Sdk=&#8221;Microsoft.NET.Sdk&#8221;&gt;<\/p>\n<p>  &lt;PropertyGroup&gt;<br \/>\n    &lt;TargetFramework&gt;net9.0&lt;\/TargetFramework&gt;<br \/>\n    &lt;ImplicitUsings&gt;enable&lt;\/ImplicitUsings&gt;<br \/>\n    &lt;Nullable&gt;enable&lt;\/Nullable&gt; <\/p>\n<p>    &lt;UseMicrosoftTestingPlatformRunner&gt;true&lt;\/UseMicrosoftTestingPlatformRunner&gt;<br \/>\n    &lt;OutputType&gt;Exe&lt;\/OutputType&gt;<br \/>\n    &lt;TestingPlatformDotnetTestSupport&gt;true&lt;\/TestingPlatformDotnetTestSupport&gt;<br \/>\n  &lt;\/PropertyGroup&gt;<\/p>\n<p>  &lt;ItemGroup&gt;<br \/>\n    &lt;PackageReference Include=&#8221;xunit.v3&#8243; Version=&#8221;1.0.1&#8243; \/&gt;<br \/>\n    &lt;PackageReference Include=&#8221;xunit.runner.visualstudio&#8221; Version=&#8221;3.0.1&#8243; \/&gt;<br \/>\n    &lt;PackageReference Include=&#8221;Microsoft.NET.Test.Sdk&#8221; Version=&#8221;17.12.0&#8243; \/&gt;<br \/>\n  &lt;\/ItemGroup&gt;<\/p>\n<p>&lt;\/Project&gt;<\/p>\n<p>Test.cs:<\/p>\n<p>public class CalculatorTests<br \/>\n{<br \/>\n    [Fact]<br \/>\n    public void Add_WhenCalled_ReturnsSum()<br \/>\n    {<br \/>\n        var calculator = new Calculator();<br \/>\n        var result = calculator.Add(1, 2);<\/p>\n<p>        Assert.Equal(3, result);<br \/>\n    }<br \/>\n}<\/p>\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.<\/p>\n<p>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\u2019t 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\u2019s continue to build an outstanding .NET testing ecosystem!<\/p>\n<p>The post <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/mtp-adoption-frameworks\/\">Microsoft.Testing.Platform: Now Supported by All Major .NET Test Frameworks<\/a> appeared first on <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\">.NET Blog<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>A year ago, we launched Microsoft.Testing.Platform as part of the MSTest Runner announcement. Our goal was to create a reliable [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[],"class_list":["post-1716","post","type-post","status-publish","format-standard","hentry","category-dotnet"],"_links":{"self":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/1716","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/comments?post=1716"}],"version-history":[{"count":0,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/1716\/revisions"}],"wp:attachment":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media?parent=1716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/categories?post=1716"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/tags?post=1716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}