From 6e16c524d948b22760ea7d65cb05951a195b0312 Mon Sep 17 00:00:00 2001 From: woksin Date: Sun, 25 Oct 2026 08:55:04 +0100 Subject: [PATCH] Run the xUnit v3 benchmark flavor on Microsoft.Testing.Platform The xunit-v3-mtp project never switched on UseMicrosoftTestingPlatformRunner, so its executable used xUnit's console runner and rejected --report-trx. Turn the platform on and reference the TRX report extension. --- Benchmarks/generate.py | 7 ++++++- Benchmarks/test_harness.py | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Benchmarks/generate.py b/Benchmarks/generate.py index f02330f..7f18ba7 100755 --- a/Benchmarks/generate.py +++ b/Benchmarks/generate.py @@ -73,6 +73,9 @@ def project(flavor, raw): packages = [XUNIT_PACKAGES[flavor]] if flavor.startswith("xunit") else ["TUnit" if flavor == "tunit" else "nunit"] if flavor not in ("tunit", "xunit-v3-mtp"): packages += ["Microsoft.NET.Test.Sdk", "xunit.runner.visualstudio" if flavor.startswith("xunit") else "NUnit3TestAdapter"] + if flavor == "xunit-v3-mtp": + # The harness asks every Microsoft.Testing.Platform route for a TRX report; xUnit v3 needs the extension for it. + packages += ["Microsoft.Testing.Extensions.TrxReport"] references = "" if raw else f'' package_xml = {p: f'' for p in packages} if flavor.startswith("nunit"): @@ -81,6 +84,8 @@ def project(flavor, raw): source = ROOT.parent / f"Source/{SOURCES[flavor]}/{SOURCES[flavor]}.csproj" reference = next(p for p in ET.parse(source).findall(".//PackageReference") if p.attrib["Include"].lower() == "nunit") package_xml["nunit"] = ET.tostring(reference, encoding="unicode").strip() + # xUnit v3 executables use their own console runner unless Microsoft.Testing.Platform is switched on. + mtp = "\n true" if flavor == "xunit-v3-mtp" else "" return f''' @@ -90,7 +95,7 @@ def project(flavor, raw): {str(flavor not in ('tunit', 'xunit-v3-mtp')).lower()} {'Exe' if flavor in ('xunit-v3', 'xunit-v3-mtp', 'tunit') else 'Library'} latest - false + false{mtp} {references} diff --git a/Benchmarks/test_harness.py b/Benchmarks/test_harness.py index e58dbfb..88716e8 100644 --- a/Benchmarks/test_harness.py +++ b/Benchmarks/test_harness.py @@ -126,6 +126,9 @@ def test_xunit_mtp_is_distinct_from_the_native_mtp_off_runner(self): mtp = project("xunit-v3-mtp", False) self.assertIn('Include="xunit.v3"', mtp) self.assertNotIn("mtp-off", mtp) + self.assertIn('Include="Microsoft.Testing.Extensions.TrxReport"', mtp) + self.assertIn("true", mtp) + self.assertNotIn("UseMicrosoftTestingPlatformRunner", project("xunit-v3", False)) self.assertNotIn("Microsoft.NET.Test.Sdk", mtp) self.assertIn("Exe", mtp) for raw in (False, True):