chore: Update test projects to use xunit v3#3065
Draft
filzrev wants to merge 21 commits intodotnet:masterfrom
Draft
chore: Update test projects to use xunit v3#3065filzrev wants to merge 21 commits intodotnet:masterfrom
filzrev wants to merge 21 commits intodotnet:masterfrom
Conversation
6104248 to
262ca3e
Compare
6bea07d to
47b304b
Compare
47b304b to
9af1831
Compare
dab3375 to
a9fe929
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR migrate test projects to use Microsoft.Testing.Platform (xUnit.v3 and TUnit)
What's changed in this PR
1. Update test projects
ExeMicrosoft.NET.Test.Sdkandxunit.runner.visualstudiopackages2. Modify namespaces
Remove
Xunit.Abstractionsnamespace and add additional using.3. Modify
FactEnvSpecificAttribute/TheoryEnvSpecificAttributeIt's required to resolve
xUnit3003analyzer errors4. Remove
Testsproject dependency fromIntegrationTests.Instead, add
<Compile>file references.5. Modify
TheoryDatarelated codes.Modify incompatible code between xUnit v2/v3.
6. Add
global.jsonat solution rootIt's required to run tests with Microsoft.Testing.Platform with
dotnet test7. Add
tests/.editorconfigIt's required to suppress following warnings.
8. Modify
InlineDataEnvSpecific.csand removeInlineDataEnvSpecificDiscoverer.csxUnit v3 don't support reflection based discover and needs migrate code.
https://xunit.net/docs/getting-started/v3/migration#removal-of-reflection-abstractions
9. Fix Wasm related tests
After migrated to xUnit.v3 some Wasm related tests failed by AppHost check.
So it need to add workaround code by adding
Directory.Build.targetsfile.10. Add settings to suppress warning MSB3277
11. Modify
BenchmarkDotNet.IntegrationTests.ManualRunning.MultipleFrameworks.csprojMigrate test framework to use TUnit.
It's required because xUnit v3 don't support .NET 4.6.2.
And It can't mix VsTest/MTP based projects
12. Update
BenchmarkDotNet.BuildprojectCake.FrostingpackagePathType = DotNetTestPathType.Autooption. Because when usingdotnet testwith MTP mode. It need explicitly specify--project.13. Disable
IsTestingPlatformApplicationproperty for auto-generated project templatesWhen
Microsoft.Testing.Platform.MSBuildpackage is referenced transitively.It auto-generate Main entry point by default and cause conflicts.
So it need to suppress auto-generated entry point.
14. Modify
run-tests-selectedworkflow to supportdotnet testwith MTP15. Add
<PreferNativeArm64>setting for .NET Framework tests onwindows-11-armWhen migrated tests to MTP and run tests with
dotnet test.It seems x64 emulation is used by default.
So it need enable
<PreferNativeArm64>setting to keep existing behaviors.TODO:
testconfig.jsongenerate-coverage-report.yamlfilters