OSOE-1308: Default .NET test workflows to Microsoft Testing Platform - #673
Open
Piedone wants to merge 6 commits into
Open
OSOE-1308: Default .NET test workflows to Microsoft Testing Platform#673Piedone wants to merge 6 commits into
Piedone wants to merge 6 commits into
Conversation
This was referenced Sep 5, 2026
sarahelsaig
requested changes
Sep 8, 2026
|
|
||
| namespace TestDotnet; | ||
|
|
||
| public class ActionFixture(ITestOutputHelper output) |
Member
There was a problem hiding this comment.
Didn't we reject using class primary constructors (as opposed to record primary constructors) in the past? (see)
Comment on lines
+7
to
+12
| $savedEnvironment = @{} | ||
|
|
||
| foreach ($name in @('PATH', 'GITHUB_ACTIONS', 'GITHUB_OUTPUT', 'GITHUB_STEP_SUMMARY', 'GITHUB_WORKSPACE', 'LGHA_TEST_FAILURE')) | ||
| { | ||
| $savedEnvironment[$name] = [Environment]::GetEnvironmentVariable($name) | ||
| } |
Member
There was a problem hiding this comment.
This data is only used in a ``foreach` so it doesn't actually need to be a dictionary:
Suggested change
| $savedEnvironment = @{} | |
| foreach ($name in @('PATH', 'GITHUB_ACTIONS', 'GITHUB_OUTPUT', 'GITHUB_STEP_SUMMARY', 'GITHUB_WORKSPACE', 'LGHA_TEST_FAILURE')) | |
| { | |
| $savedEnvironment[$name] = [Environment]::GetEnvironmentVariable($name) | |
| } | |
| $environmentVariableNames = @('PATH', 'GITHUB_ACTIONS', 'GITHUB_OUTPUT', 'GITHUB_STEP_SUMMARY', 'GITHUB_WORKSPACE', 'LGHA_TEST_FAILURE') | |
| $savedEnvironment = Get-ChildItem Env: | Where-Object { $PSItem.Name -in $environmentVariableNames } |
| $logPath = Join-Path $artifactPath "$Name.log" | ||
|
|
||
| $arguments = @( | ||
| '-NoProfile', '-File', "$actionPath/Invoke-SolutionOrProjectTests.ps1" |
Member
There was a problem hiding this comment.
Two unrelated parameters packed on the same line.
Suggested change
| '-NoProfile', '-File', "$actionPath/Invoke-SolutionOrProjectTests.ps1" | |
| '-NoProfile', | |
| '-File', "$actionPath/Invoke-SolutionOrProjectTests.ps1" |
Comment on lines
+80
to
+83
| foreach ($entry in $savedEnvironment.GetEnumerator()) | ||
| { | ||
| [Environment]::SetEnvironmentVariable($entry.Key, $entry.Value) | ||
| } |
Member
There was a problem hiding this comment.
To me using Env: feels more appropriate for a PowerShell script.
Suggested change
| foreach ($entry in $savedEnvironment.GetEnumerator()) | |
| { | |
| [Environment]::SetEnvironmentVariable($entry.Key, $entry.Value) | |
| } | |
| $savedEnvironment | ForEach-Object { Set-Item ('Env:' + $PSItem.Key) -Value $PSItem.Value } |
or formatted
Suggested change
| foreach ($entry in $savedEnvironment.GetEnumerator()) | |
| { | |
| [Environment]::SetEnvironmentVariable($entry.Key, $entry.Value) | |
| } | |
| $savedEnvironment | ForEach-Object { | |
| Set-Item ('Env:' + $PSItem.Key) -Value $PSItem.Value | |
| } |
| working-directory: ${{ inputs.build-directory }} | ||
| run: | | ||
| $switches = @{ | ||
| TestPlatform = '${{ inputs.test-platform }}' |
Member
There was a problem hiding this comment.
Since MTP is for .NET 10+ only, do we want to do something like this to reduce the breakingness of the change?
$dotnetVersion = [Version](dotnet --version)
if ($dotnetVersion.Major -lt 10)
{
$switches['TestPlatform'] = 'VSTest'
Write-GitHub "The test platform is set to `"VSTest`" because you are using .NET version ($dotnetVersion) older than .NET 10. Please set the `"test-platform`" input to `"VSTest`" explicitly, to remove this warning."
}
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.
Default the modern .NET test workflows to Microsoft Testing Platform and generate GitHub Actions summaries with the native reporter. Use evaluated MSBuild properties to find test applications and process exit codes to determine success, preserving filtered solution runs, test output, TRX artifacts, diagnostics, and hang dump collection. Retain an explicit VSTest option for legacy consumers; msbuild-and-test continues to select it.
Part of Lombiq/Testing-Toolbox#92. Coordinated OSOCE integration: Lombiq/Open-Source-Orchard-Core-Extensions#1335.
This is a breaking change requiring .NET SDK 10+, the global.json MTP runner selection, and reporting extensions in each test project. Docs/MicrosoftTestingPlatform.md describes migration and the v6.0.0 release step. Internal action references use issue/OSOE-1308 during review and must return to dev before merge; publish v6.0.0 through the existing release-branch workflow after integration.
Validation: the local regression fixture passes filtering, theory discovery, passing-test output, native summaries, TRX reporting, diagnostics, empty selections, and failure exit-code checks. PowerShell analysis and YAML validation pass. Added Windows/Ubuntu CI regression coverage. The fixture explicitly clears the expected negative scenario's exit status before returning to the CI shell.
CI verification: the MTP regression suite passes on Ubuntu and Windows; spelling, YAML, branch-reference, and PR validation checks pass.