This package provides Microsoft.Testing.Platform support for xunit 2 test projects.
The general recommendation is to migrate from xunit 2 to xunit.v3 which already supports MTP. However, if you are stuck with xunit 2 (e.g, too hard to migrate to xunit.v3), and you want to migrate from VSTest to Microsoft.Testing.Platform, this package is for you.
- The VSTest
--filter.- The VSTest
--filtersyntax is actually not supported by xunit.v3 under MTP. However, it's supported by this package for xunit 2 users. This is done to ease migration.
- The VSTest
- The VSTest
--settingsoption to specify a runsettings file is partially supported.- The VSTest
--settingsoption is actually not supported by xunit.v3 under MTP. However, it's supported by this package for xunit 2 users. This is done to ease migration. - Note that not the full RunSettings options are supported. Only the xunit-specific configurations are supported.
- The VSTest
- Reporting test results (passed, failed, skipped).
- Discovering tests, along with traits.
TestMethodIdentifierPropertyis supported.xunit.runner.jsonis supported.- Reporting TRX files via Microsoft.Testing.Extensions.TrxReport (using
--report-trx) is supported. - Source information are reported, except when IDE explicitly requests to not calculate it (for perf reasons).
- MTP's
--treenode-filteris supported. - MTP's
--maximum-failed-testsis supported.
There are known limitations on the current support of MTP for xunit 2 which is provided by this package. If impacted by these, consider reacting with thumbs up to the issue. If you found other limitations and/or bugs, consider opening a new issue for it.
- testconfig.json isn't supported. It can be supported in the future similar to https://github.com/xunit/xunit/commit/4c1c66f09e19299b3496fe962a2cb005ba57bc9d.
- Tracking issue: #1
To add Microsoft.Testing.Platform support to your xunit 2 test projects, all you need is to add a PackageReference to YTest.MTP.XUnit2, and you have MTP support!
There are additional concerns that are general for any VSTest to MTP migration.
- If using .NET 10 SDK or later (recommended), update
global.jsonto specify Microsoft.Testing.Platform as the test runner. - Update any CI YML files or scripts to use the right command-line options for MTP.
- If you don't need VSTest support anymore, you can also remove the package references of
xunit.runner.visualstudioandMicrosoft.NET.Test.Sdk - Enjoy running xunit 2 on Microsoft.Testing.Platform!