-
Notifications
You must be signed in to change notification settings - Fork 147
xUnit v3 upgrade #960
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
base: main
Are you sure you want to change the base?
xUnit v3 upgrade #960
Conversation
Co-authored-by: aaronpowell <[email protected]>
…ET 10 Co-authored-by: aaronpowell <[email protected]>
Co-authored-by: aaronpowell <[email protected]>
Co-authored-by: aaronpowell <[email protected]>
… but the MassTransit.ActiveMQ package isn't updated yet Tracked: MassTransit/MassTransit#6133
…ss ambiguous referencing
I feel dirty doing that...
.github/workflows/tests.yaml
Outdated
| - name: Run tests | ||
| run: >- | ||
| dotnet test ${{ github.workspace }}/${{ env.TEST_PROJECT_PATH }} | ||
| dotnet run ${{ github.workspace }}/${{ env.TEST_PROJECT_PATH }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to:
- Remove
--logger "console;verbosity=normal". - Replace
--logger trxwith--report-trx(and ensure Microsoft.Testing.Extensions.TrxReport is referenced) - Replace all the blame-related args with
--crashdump,--hangdump, and--hangdump-timeout 7m --results-directoryis changing the meaning a little bit with this PR. Previously it would be relative to current working directory${{ github.workspace }}while with this PR it will be relative to the test executable. So either pass the full path, or keep usingdotnet testwhich will handle the path transformation for you.--collect "XPlat Code Coverage"needs to be replaced with--coverage(and ensure Microsoft.Testing.Extensions.CodeCoverage is referenced)
.github/workflows/tests.yaml
Outdated
| --report-trx | ||
| --report-trx-filename "${{ matrix.name }}-${{ matrix.os }}.trx" | ||
| --ignore-exit-code 8 | ||
| -- RunConfiguration.CollectSourceInformation=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed.
Directory.Packages.props
Outdated
| <PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" /> | ||
| <PackageVersion Include="xunit.extensibility.execution" Version="2.9.3" /> | ||
| <PackageVersion Include="Microsoft.DotNet.XUnitExtensions" Version="9.0.0-beta.24568.1" /> | ||
| <PackageVersion Include="xunit.v3" Version="3.2.0" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: there is now xunit.v3.mtp-v2 package.
| <PackageVersion Include="xunit.v3" Version="3.2.0" /> | ||
| <PackageVersion Include="xunit.v3.assert" Version="3.2.0" /> | ||
| <PackageVersion Include="xunit.v3.extensibility.core" Version="3.2.0" /> | ||
| <PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no longer needed if you don't care about VSTest support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" /> |
tests/.runsettings
Outdated
| <RunConfiguration> | ||
| <!-- Filter out failing (wrong framework, platform, runtime or activeissue) tests --> | ||
| <TestCaseFilter>category!=unsupported-platform</TestCaseFilter> | ||
| <TestCaseFilter>category!=failing</TestCaseFilter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runsettings isn't supported with MTP.
tests/Directory.Build.props
Outdated
| https://learn.microsoft.com/dotnet/core/testing/microsoft-testing-platform-exit-codes --> | ||
| <TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) --ignore-exit-code 8</TestRunnerAdditionalArguments> | ||
|
|
||
| <!-- <UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uncomment?
Youssef1313
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to also update global.json to specify the test runner as MTP, and probably ensure it requires .NET 10.
It seems there are two different paths for resolving the reference expression that _should_ return the same, but in the tests they don't seem to, so we'll force eval
|
@aaronpowell please feel free ping @Youssef1313 or I so we can move forward here. |
…/Aspire into xunit-3-upgrade
| // outputs "the sum of 2 and 3 is 5" | ||
| var script2 = ps.AddScript("script2", """ | ||
| & ./scripts/script.ps1 @args | ||
| & ./Scripts/script.ps1 @args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that Powershell is case sensitive (cc @nohwnd)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is up to the file system not up to powershell. If this needs to run on linux and the filesystem is case sensitive then ./scripts and ./Scripts are two different paths. On windows we typically don't use case sensitive file systems.
|
|
||
| // Forcing linux only due to: https://github.com/modelcontextprotocol/inspector/issues/893 | ||
| [RequiresLinux] | ||
| [RequiresWindows] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How was this working before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea why I made that change, I'm going to revert it 🤣
Evangelink
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaronpowell the latest errors are weird, it's complaining about a file that doesn't exist when I pull this branch.
I have also noticed the following missing changes:
- In
global.json, add:
"test": {
"runner": "Microsoft.Testing.Platform"
}- In
Directory.Packages.propsandtests/Directory.Build.propsremove:
coverlet.collector-> not compatible with MTP, instead use MS coverageMicrosoft.NET.Test.Sdk-> VSTest testhost part, no longer needed as you are moving to MTPxunit.runner.visualstudio-> VSTest adapter for xUnit, also no longer needed.
- I'd suggest to be careful with the
--ignore-exit-code 8set on all test projects because you are allowing all projects not to run tests without failure. I don't know if you have some other guard in place but if you don't then you would potentially no longer run any test without noticing.
Upgrading the tests to use xUnit v3, which is what is used by aspire now too.
Close #961