From 5d35215ee91365db9be02f3504fb68e521cca30b Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Mon, 4 May 2026 16:07:01 -0500 Subject: [PATCH 1/2] Add dotnet test integration tests for all Apple platforms Create DotNetTestTest that runs 'dotnet test' on projects created from the iostest, tvostest, maccatalysttest, and macostest templates. This verifies the MTP (Microsoft Testing Platform) pipeline works end-to-end, including the --server/--dotnet-test-pipe argument passthrough via RunArguments. Also add 'test' as a supported verb in DotNet.Execute. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/common/DotNet.cs | 1 + tests/dotnet/UnitTests/DotNetTestTest.cs | 39 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/dotnet/UnitTests/DotNetTestTest.cs diff --git a/tests/common/DotNet.cs b/tests/common/DotNet.cs index 0d0b0de77088..87f71d6c3eab 100644 --- a/tests/common/DotNet.cs +++ b/tests/common/DotNet.cs @@ -222,6 +222,7 @@ public static ExecutionResult Execute (string verb, string project, Dictionary (); args.Add (verb); args.Add (project); diff --git a/tests/dotnet/UnitTests/DotNetTestTest.cs b/tests/dotnet/UnitTests/DotNetTestTest.cs new file mode 100644 index 000000000000..6892e704b810 --- /dev/null +++ b/tests/dotnet/UnitTests/DotNetTestTest.cs @@ -0,0 +1,39 @@ +using Xamarin.Tests; + +#nullable enable + +namespace Xamarin.Tests { + [TestFixture] + public class DotNetTestTest : TestBaseClass { + [Test] + [TestCase (ApplePlatform.iOS, "iostest")] + [TestCase (ApplePlatform.TVOS, "tvostest")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalysttest")] + [TestCase (ApplePlatform.MacOSX, "macostest")] + public void DotNetTest (ApplePlatform platform, string template) + { + Configuration.IgnoreIfIgnoredPlatform (platform); + + var tmpDir = Cache.CreateTemporaryDirectory (); + var outputDir = Path.Combine (tmpDir, template); + DotNet.AssertNew (outputDir, template); + var proj = Path.Combine (outputDir, $"{template}.csproj"); + + // Replace generated tests with a single passing test + var testFile = Path.Combine (outputDir, "Test1.cs"); + File.WriteAllText (testFile, $@"namespace {template}; + +[TestClass] +public sealed class Test1 {{ + [TestMethod] + public void TestMethod1 () + {{ + }} +}} +"); + + var properties = GetDefaultProperties (); + DotNet.Execute ("test", proj, properties); + } + } +} From 57545a69b87cbd21f1c8fa8863131fc813c37dc4 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 5 May 2026 08:37:11 -0500 Subject: [PATCH 2/2] Comment out macOS/MacCatalyst tests and fix test verb workaround macOS and Mac Catalyst don't use mlaunch (they use 'open' via Desktop.targets), so MTP support requires a different approach. Comment out those test cases for now. Also skip the /v:diag and /consoleloggerparameters workaround args when the verb is 'test' to prevent them leaking through to the MTP test runner via RunArguments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/common/DotNet.cs | 14 +++++++++----- tests/dotnet/UnitTests/DotNetTestTest.cs | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/tests/common/DotNet.cs b/tests/common/DotNet.cs index 87f71d6c3eab..0775966f75ec 100644 --- a/tests/common/DotNet.cs +++ b/tests/common/DotNet.cs @@ -289,11 +289,15 @@ public static ExecutionResult Execute (string verb, string project, Dictionary