Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Benchmarks/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'<ProjectReference Include="../../../Source/{SOURCES[flavor]}/{SOURCES[flavor]}.csproj" />'
package_xml = {p: f'<PackageReference Include="{p}" />' for p in packages}
if flavor.startswith("nunit"):
Expand All @@ -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 <UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>" if flavor == "xunit-v3-mtp" else ""
return f'''<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks></TargetFrameworks>
Expand All @@ -90,7 +95,7 @@ def project(flavor, raw):
<IsTestProject>{str(flavor not in ('tunit', 'xunit-v3-mtp')).lower()}</IsTestProject>
<OutputType>{'Exe' if flavor in ('xunit-v3', 'xunit-v3-mtp', 'tunit') else 'Library'}</OutputType>
<LangVersion>latest</LangVersion>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<GenerateDocumentationFile>false</GenerateDocumentationFile>{mtp}
</PropertyGroup>
<ItemGroup>
{references}
Expand Down
3 changes: 3 additions & 0 deletions Benchmarks/test_harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>", mtp)
self.assertNotIn("UseMicrosoftTestingPlatformRunner", project("xunit-v3", False))
self.assertNotIn("Microsoft.NET.Test.Sdk", mtp)
self.assertIn("<OutputType>Exe</OutputType>", mtp)
for raw in (False, True):
Expand Down
Loading