Skip to content

Refactor device template tests to separate DeviceTemplateTests project #30210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 25, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

This PR refactors the device-specific template tests from the Microsoft.Maui.IntegrationTests project into a new separate project called Microsoft.Maui.DeviceTemplateTests to improve test isolation and reliability.

Changes Made

New Project Structure

  • Created Microsoft.Maui.DeviceTemplateTests project with XUnit test framework
  • Moved the following test classes from IntegrationTests:
    • AppleTemplateTests - iOS/macOS template deployment tests
    • AndroidTemplateTests - Android template deployment tests
    • AOTTemplateTest - AOT compilation tests for iOS/macOS

Framework Migration

  • Converted all tests from NUnit to XUnit framework:
    • [Test][Fact] / [Theory]
    • [TestCase(...)][InlineData(...)]
    • [SetUp] / [TearDown] → Constructor / IDisposable pattern
    • Assert.IsTrue()Assert.True()
    • Assert.AreEqual()Assert.Equal()

Dependencies and Utilities

  • Copied all required base classes (BaseBuildTest, BaseTemplateTests)
  • Copied platform-specific utilities (Android/, Apple/ folders)
  • Copied XHarness utilities and other required utility classes
  • Copied test resources and embedded files
  • Updated all namespace references to use the new project namespace

Solution Integration

  • Updated all relevant solution files to include the new project:
    • Microsoft.Maui.sln
    • Microsoft.Maui-dev.sln
    • Microsoft.Maui-vscode.sln
    • Microsoft.Maui-mac.slnf
    • Microsoft.Maui-windows.slnf
    • Microsoft.Maui.LegacyControlGallery.sln

Benefits

  • Improved Isolation: Device template tests can now run independently from other integration tests
  • Better Reliability: Separate project reduces failures affecting unrelated test suites
  • Enhanced CI/CD: Better suited for Helix and adhoc test runs that were previously unreliable
  • Modern Framework: XUnit provides better tooling and CI integration compared to NUnit
  • Cleaner Architecture: Clear separation between general integration tests and device-specific tests

Testing

  • ✅ New DeviceTemplateTests project builds successfully
  • ✅ Original IntegrationTests project still builds without moved classes
  • ✅ XUnit test discovery and execution working properly
  • ✅ All solution files updated and building correctly

The device-specific tests themselves are expected to fail in environments without iOS/Android development tools, but the test framework and project structure are verified to work correctly.

Fixes #30209.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits June 25, 2025 15:18
…rationTests

Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>
…verify functionality

Co-authored-by: rmarinho <1235097+rmarinho@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Refactor RunIOS and RunAndroid to there own project Refactor device template tests to separate DeviceTemplateTests project Jun 25, 2025
@Copilot Copilot AI requested a review from rmarinho June 25, 2025 15:26
Copilot finished work on behalf of rmarinho June 25, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor RunIOS and RunAndroid to there own project
2 participants