Skip to content

[tests] Use MSTestPackageVersion in DotNetNewAndroidTest#11209

Merged
simonrozsival merged 2 commits intomainfrom
dev/peppers/darc-mstest
Apr 25, 2026
Merged

[tests] Use MSTestPackageVersion in DotNetNewAndroidTest#11209
simonrozsival merged 2 commits intomainfrom
dev/peppers/darc-mstest

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

After dotnet new androidtest creates the template project, override the stable MSTest version with the preview version from eng/Versions.props. This let's us validate nightly/weekly microsoft/testfx changes, while the template keeps the stable version for customers.

The version is embedded as assembly metadata in MSBuildDeviceIntegration.csproj and read at runtime to update the generated .csproj before building.

After this is merged, I'll setup a Maestro/darc subscription on a weekly cadence.

After `dotnet new androidtest` creates the template project, override the
stable MSTest version with the preview version from eng/Versions.props. This
ensures the test validates against the same MSTest version used by the rest
of the build, while the template keeps the stable version for customers.

The version is embedded as assembly metadata in MSBuildDeviceIntegration.csproj
and read at runtime to update the generated .csproj before building.

[tests] Enable CoreCLR in DotNetNewAndroidTest

Remove the Assert.Ignore for CoreCLR runtime, enabling the test for both
MonoVM and CoreCLR configurations.

Fixes #11174

Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers force-pushed the dev/peppers/darc-mstest branch from bbd0e11 to 1968080 Compare April 24, 2026 16:00
Pass RestoreAdditionalProjectSources to include the test-tools feed so the
preview MSTest package version can be restored during the build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers marked this pull request as ready for review April 24, 2026 19:09
Copilot AI review requested due to automatic review settings April 24, 2026 19:09
@jonathanpeppers
Copy link
Copy Markdown
Member Author

The test is passing all cases using latest microsoft/testfx:

image

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the dotnet new androidtest device integration test flow to build generated template projects using the repo’s pinned (preview) MSTest package version, enabling validation of incoming microsoft/testfx changes while keeping customer templates on stable MSTest.

Changes:

  • Embed MSTestPackageVersion into the MSBuildDeviceIntegration test assembly via AssemblyMetadataAttribute.
  • Read that assembly metadata at runtime and rewrite the generated androidtest project’s MSTest PackageReference version before building.
  • Add the required additional NuGet feed for restoring preview MSTest packages, and track the dependency in eng/Version.Details.xml.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs Rewrites generated template .csproj to use the assembly-embedded MSTest version; adds preview feed for restore.
tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj Embeds MSTestPackageVersion as assembly metadata for runtime retrieval.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/BaseTest.cs Adds helper to read AssemblyMetadataAttribute values from the executing test assembly.
eng/Versions.props Introduces MSTestPackageVersion property for repo-wide pinning.
eng/Version.Details.xml Adds MSTest dependency entry for dependency tracking/subscriptions.

@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Apr 24, 2026
@simonrozsival
Copy link
Copy Markdown
Member

CI failures are unrelated

@simonrozsival simonrozsival merged commit e36ba2b into main Apr 25, 2026
6 of 7 checks passed
@simonrozsival simonrozsival deleted the dev/peppers/darc-mstest branch April 25, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants