[dotnet] Add test project templates for all Apple platforms#25195
[dotnet] Add test project templates for all Apple platforms#25195rolfbjarne merged 17 commits intonet11.0from
Conversation
|
I'm still testing this, I don't like the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Add iostest, maccatalysttest, tvostest, and macostest project templates that create MSTest-based test projects for each Apple platform. These are modeled after jonathanpeppers/iOSDotNetTest and the equivalent androidtest template in dotnet/android. Each template includes: - MSTest runner with custom entry point (Main.cs) - ResultConsumer for test result tracking and TRX reporting - Sample Test1.cs with pass/fail/skip examples - Platform-appropriate Info.plist and Entitlements.plist - global.json for Microsoft.Testing.Platform configuration - MtouchInterpreter=all workaround for AOT compilation issues Platform-specific details: - iOS/MacCatalyst: UIApplication.Main with SceneDelegate pattern - tvOS: UIApplication.Main with AppDelegate Window pattern - macOS: NSApplication with AppKit (NSWindow/NSTextField) Also updates TemplateTest.cs to include the 4 new templates in the test matrix so they are validated by CreateAndBuildProjectTemplate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the MtouchInterpreter workaround from individual test templates into Xamarin.Shared.props so any MSTest runner project automatically gets the interpreter enabled, not just our templates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
40706ed to
cac67af
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
There's a warning when building the tvOS test template:
There's also a number of warnings when building a maccatalyst template - but not the new one, so it feels unrelated, but on the other hand it's not a problem I've seen before, and it's too much of a coincidence that it happens in a PR that adds new templates... |
|
It seems like the ApplicationInsights is a dependency of MSTest and AppInsights has trimmer warnings. Copilot says MacCatalyst is doing SdkOnly mode, and the other platforms None -- I could make |
MSTest's transitive dependency on Microsoft.ApplicationInsights produces trimmer warnings on Mac Catalyst where linking defaults to SdkOnly. These warnings are not actionable for test projects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Remove UIWindow construction and UI setup — the existing tvOS template does not construct UIWindow. Also match the Window property style and remove unused StatusChanged event. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #a3dc29b] Build passed (Build packages) ✅Pipeline on Agent |
✅ [CI Build #a3dc29b] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #a3dc29b] Build passed (Build macOS tests) ✅Pipeline on Agent |
Summary
Add
dotnet newtest project templates for all Apple platforms, equivalent to what was done for Android in dotnet/android@885dd60.Modeled after jonathanpeppers/iOSDotNetTest.
New templates
iostestnet10.0-iosmaccatalysttestnet10.0-maccatalysttvostestnet10.0-tvosmacostestnet10.0-macosUsage:
Each template creates an MSTest-based test project that runs tests inside the proper UIKit/AppKit run loop, displaying results in a native UI. This is needed because Apple platform tests must run inside a real application process.
Key design decisions
MtouchInterpreter=allset globally: Instead of setting this workaround in each template, it is now set inXamarin.Shared.propswhenEnableMSTestRunner=true, so any MSTest runner project on Apple platforms automatically gets the interpreter enabled.GenerateTestingPlatformEntryPoint=false: Required because our templates provide a customMain()entry point and MSTest SDK would otherwise generate a conflicting one.TemplateTest.csto verify they build correctly.