Skip to content

Commit

Permalink
Enable MS Testing Platform
Browse files Browse the repository at this point in the history
This gets all tests running again. It also changes how test logs are collected to match changes from enabling the testing platform.

However, discovery fails for some tests due to the need to execute code to load MSBuild from the SDK first, and the new xunit v3 discovery system apparently reflects before instantiating test classes, leading to these failures.
  • Loading branch information
AArnott committed Jan 1, 2025
1 parent 26a9056 commit 8b132b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ NPM packages too.

## Testing

The Visual Studio 2019 Test Explorer will list and execute all tests.
`dotnet test` will run all tests.

The Visual Studio 2022 Test Explorer will list and execute all tests.
Visual Studio needs a preview feature called "Use testing platform server mode" enabled.

A few tests will fail without a certain VC++ toolset installed.

## Releases

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<SignAssembly>false</SignAssembly>
<IsTestProject>true</IsTestProject>
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFrameworks>net9.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(TargetFrameworks);net472</TargetFrameworks>
<OutputType>Exe</OutputType>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<DebugType>full</DebugType>
Expand Down
10 changes: 6 additions & 4 deletions tools/dotnet-test-cloud.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ if ($x86) {
}
}

$testBinLog = Join-Path $ArtifactStagingFolder (Join-Path build_logs test.binlog)
$testDiagLog = Join-Path $ArtifactStagingFolder (Join-Path test_logs diag.log)
$testBinLog = Join-Path $ArtifactStagingFolder build_logs test.binlog
$testResultsDirectory = Join-Path $ArtifactStagingFolder test_logs

& $dotnet test $RepoRoot `
--no-build `
Expand All @@ -56,8 +56,10 @@ $testDiagLog = Join-Path $ArtifactStagingFolder (Join-Path test_logs diag.log)
--blame-hang-timeout 60s `
--blame-crash `
-bl:"$testBinLog" `
--diag "$testDiagLog;TraceLevel=info" `
--logger trx `
-- `
--results-directory $testResultsDirectory `
--report-xunit-trx `
--long-running 60 `

$unknownCounter = 0
Get-ChildItem -Recurse -Path $RepoRoot\test\*.trx |% {
Expand Down

0 comments on commit 8b132b5

Please sign in to comment.