chore: Update test projects to use xunit v3 - #3065
Conversation
dab3375 to
a9fe929
Compare
c330021 to
faf409d
Compare
275a322 to
6501114
Compare
|
Azure Pipelines: 3 pipeline(s) were filtered out due to trigger conditions. |
6501114 to
fe13273
Compare
|
Azure Pipelines: 3 pipeline(s) were filtered out due to trigger conditions. |
fe13273 to
f5fda24
Compare
df4ba0e to
5572e0b
Compare
de376ca to
b43ae88
Compare
…:CaptureOutput] is enabled
a508c4f to
9978e5d
Compare
|
Extra memory allocation issue is occurred on another tests. (On |
|
On PR #3169, following setting is removed from IntegrationTests project. <!-- Disable EventSource to stabilize MemoryDiagnoserTests. https://github.com/dotnet/BenchmarkDotNet/pull/2562#issuecomment-2081317379 -->
<RuntimeHostConfigurationOption Include="System.Diagnostics.Tracing.EventSource.IsSupported" Value="false" />Extra memory allocation might be caused by event source subscription. |
Did you observe that to be an issue? It was added previously without verification that it was actually an issue. |
Currently, It occurred on CI and it's not occurred when running flakey tests multiple times with Memory allocation is captured by using |
|
Because there are potentially a lot of background workers that we may have little or no control over in testing frameworks, I think it's reasonable to remove InProcess tests that measure process-wide to avoid flaky results. That includes memory, threading, and exception diagnoser tests. |
Any reason not to use TUnit everywhere? |
Migration cost reason. |
I don't known why Windows OS only affected by xUnit.v3 migration. So for the time being, add temporary workaround for flakey test instead of completely exclude InProcessEmitToolchain from memory/threading/exception diagnoser tests. |
This PR migrate test projects to use Microsoft.Testing.Platform (xUnit.v3 and TUnit)
What's changed in this PR
1. Update test projects
xunit.v3v4.x)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.And add
<UseAppHost>false</UseAppHostsetting to wasm project template.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.16. Temporary dissable disassemble tests for macos
This changes are reverted after migrated to ClrMD 4.x (#3081)
17. Add
SkipTestWithoutData=truesetting to avoid no test data exception18. Modify test to use
dotnet runinstead ofdotnet testWhen running tests with
dotnet test. A lot of extra logs are outputted when using--output DetailedSo replace Cake.Fronsting setting to use
dotnet runinstead.19. Add
testconfig.jsonand disable telemetry.If telemetry is enabled.
AllocationQuantumIsNotAnIssueForNetCore21Plustest failed with extra memory allocation (792 bytes) on WindowsIt looks like some telemetry operation is running background.
So I've explicitly disabled MTP telemetry by setting environment variable.
On
windows(arm64)environment, it still failed with extra allocations.So I've add setting to skip test on this environment.
20. Add
--progress offsettingOn
windows(arm64)environment,TieredJitShouldNotInterfereAllocationResultstest failed with 1-2 bytes extra memory allocations.21. Add setting to skip
AwaitingTasksShouldNotInterfereAllocationResultsin-process test onWindows(arm64)+.NETFrameworkAdd skip setting as temporary workaround.
And create separated issue #3203
TODO:
Following tasks are expected to be handled on another PRs.