From 87cfd96f1b5a20a6b863807172fe1b840851442b Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Wed, 26 Mar 2025 16:57:24 +0100 Subject: [PATCH 01/14] Support XUnitV3 as test runner --- Directory.Packages.props | 2 + .../tools/XUnitV3/XUnitV3.Runner.targets | 107 ++++++++++++++++++ .../tools/XUnitV3/XUnitV3.targets | 37 ++++++ .../tools/XUnitV3/xunit.runner.json | 4 + 4 files changed, 150 insertions(+) create mode 100644 src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets create mode 100644 src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets create mode 100644 src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/xunit.runner.json diff --git a/Directory.Packages.props b/Directory.Packages.props index 965f7d8f431..d195cfaf5b9 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -18,6 +18,8 @@ 1.16.0 $(XUnitVersion) 3.0.2 + 2.0.0 + $(XUnitV3Version) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets new file mode 100644 index 00000000000..1feb30b44fb --- /dev/null +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets @@ -0,0 +1,107 @@ + + + + + + + + + + + <_TestEnvironment>%(TestToRun.EnvironmentDisplay) + <_TestAssembly>%(TestToRun.Identity) + <_TestRuntime>%(TestToRun.TestRuntime) + <_TestTimeout>%(TestToRun.TestTimeout) + <_TestRunnerAdditionalArguments>%(TestToRun.TestRunnerAdditionalArguments) + + + <_TestRunnerTargetFramework>net472 + <_TestRunnerTargetFramework Condition="'$(_TestRuntime)' == 'Core'">netcoreapp2.0 + <_TestRunnerTargetFramework Condition="%(TestToRun.TargetFramework) == 'netcoreapp1.1' or %(TestToRun.TargetFramework) == 'netcoreapp1.0'">netcoreapp1.0 + + + + <_TargetFileNameNoExt>$([System.IO.Path]::GetFileNameWithoutExtension('$(_TestAssembly)')) + <_TargetDir>$([System.IO.Path]::GetDirectoryName('$(_TestAssembly)'))\ + <_CoreRuntimeConfigPath>$(_TargetDir)$(_TargetFileNameNoExt).runtimeconfig.json + <_CoreDepsPath>$(_TargetDir)$(_TargetFileNameNoExt).deps.json + + <_TestRunner Condition="'%(TestToRun.Architecture)'=='x86' And Exists('$(DotNetRoot)x86\dotnet.exe')">$(DotNetRoot)x86\dotnet.exe + <_TestRunner Condition="'$(_TestRunner)'==''">$(DotNetTool) + + <_TestRunnerArgs>exec --depsfile "$(_CoreDepsPath)" --runtimeconfig "$(_CoreRuntimeConfigPath)" $(TestRuntimeAdditionalArguments) "$(NuGetPackageRoot)xunit.runner.console/$(XUnitVersion)/tools/$(_TestRunnerTargetFramework)/xunit.console.dll" "$(_TestAssembly)" -noautoreporters -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" $(_TestRunnerAdditionalArguments) + + + + <_XUnitConsoleExe>xunit.console.exe + <_XUnitConsoleExe Condition="'%(TestToRun.Architecture)' == 'x86'">xunit.console.x86.exe + <_XUnitConsoleExePath>$(NuGetPackageRoot)xunit.runner.console\$(XUnitVersion)\tools\$(_TestRunnerTargetFramework)\$(_XUnitConsoleExe) + + <_TestRunnerArgs>"$(_TestAssembly)" -noshadow -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" $(_TestRunnerAdditionalArguments) + <_TestRunnerArgs Condition="'$(_TestRuntime)' == 'Mono'">$(TestRuntimeAdditionalArguments) "$(_XUnitConsoleExePath)" $(_TestRunnerArgs) + + <_TestRunner Condition="'$(_TestRuntime)' == 'Mono'">$(MonoTool) + <_TestRunner Condition="'$(_TestRuntime)' != 'Mono'">$(_XUnitConsoleExePath) + + + + <_TestRunnerCommand>"$(_TestRunner)" $(_TestRunnerArgs) + + + <_TestRunnerCommand Condition="'$(TestCaptureOutput)' != 'false'">$(_TestRunnerCommand) > "%(TestToRun.ResultsStdOutPath)" 2>&1 + + + + <_OutputFiles Include="%(TestToRun.ResultsXmlPath)" /> + <_OutputFiles Include="%(TestToRun.ResultsHtmlPath)" /> + <_OutputFiles Include="%(TestToRun.ResultsStdOutPath)" /> + + + + + + + + + + + + + + + + + + <_ResultsFileToDisplay>%(TestToRun.ResultsHtmlPath) + <_ResultsFileToDisplay Condition="!Exists('$(_ResultsFileToDisplay)')">%(TestToRun.ResultsStdOutPath) + + + + + + + + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets new file mode 100644 index 00000000000..a98ead21cda --- /dev/null +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets @@ -0,0 +1,37 @@ + + + + + false + + + + + + + + + + + $(MSBuildThisFileDirectory)xunit.runner.json + + + + + + + + + + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/xunit.runner.json b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/xunit.runner.json new file mode 100644 index 00000000000..8465a454364 --- /dev/null +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/xunit.runner.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json", + "shadowCopy": false +} From 0662ba617232e404922a10693342d07fabe96d15 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Thu, 27 Mar 2025 19:33:49 +0100 Subject: [PATCH 02/14] Progress --- open-vs.cmd | 2 ++ open-vs.ps1 | 19 ++++++++++++ .../tools/Tests.props | 5 +++- .../tools/Tests.targets | 2 ++ .../tools/XUnitV3/XUnitV3.Runner.targets | 30 ++++--------------- 5 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 open-vs.cmd create mode 100644 open-vs.ps1 diff --git a/open-vs.cmd b/open-vs.cmd new file mode 100644 index 00000000000..6314f81cc4f --- /dev/null +++ b/open-vs.cmd @@ -0,0 +1,2 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0open-vs.ps1""" -vs %*" \ No newline at end of file diff --git a/open-vs.ps1 b/open-vs.ps1 new file mode 100644 index 00000000000..515d42269cc --- /dev/null +++ b/open-vs.ps1 @@ -0,0 +1,19 @@ +. $PSScriptRoot\eng\common\tools.ps1 + +# This tells .NET Core to use the bootstrapped runtime +$env:DOTNET_ROOT=InitializeDotNetCli -install:$true -createSdkLocationFile:$true + +# This tells MSBuild to load the SDK from the directory of the bootstrapped SDK +$env:DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$env:DOTNET_ROOT + +# This tells .NET Core not to go looking for .NET Core in other places +$env:DOTNET_MULTILEVEL_LOOKUP=0; + +# Put our local dotnet.exe on PATH first so Visual Studio knows which one to use +$env:PATH=($env:DOTNET_ROOT + ";" + $env:PATH); + +# Disable .NET runtime signature validation errors which errors for local builds +$env:VSDebugger_ValidateDotnetDebugLibSignatures=0; + +# Launch Visual Studio with the locally defined environment variables +& "$PSScriptRoot\Arcade.sln" diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.props index f79111d3e57..25f911cb753 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.props +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.props @@ -29,7 +29,10 @@ - + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets index 168c3991a9d..416337a32ce 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets @@ -71,6 +71,8 @@ $(TestResultsLogDir)$(_ResultFileNameNoExt).log $(TestRunSettingsFile) $(TestRunnerAdditionalArguments) + $(RunArguments) + $(RunCommand) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets index 1feb30b44fb..93bf9db9d2d 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets @@ -16,34 +16,14 @@ <_TestTimeout>%(TestToRun.TestTimeout) <_TestRunnerAdditionalArguments>%(TestToRun.TestRunnerAdditionalArguments) - - <_TestRunnerTargetFramework>net472 - <_TestRunnerTargetFramework Condition="'$(_TestRuntime)' == 'Core'">netcoreapp2.0 - <_TestRunnerTargetFramework Condition="%(TestToRun.TargetFramework) == 'netcoreapp1.1' or %(TestToRun.TargetFramework) == 'netcoreapp1.0'">netcoreapp1.0 + <_TestRunner>%(TestToRun.RunCommand) + <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' != 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" + <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' == 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) --report-xunit --report-xunit-filename "%(TestToRun.ResultsXmlPath)" --report-xunit-html --report-xunit-html-filename "%(TestToRun.ResultsHtmlPath)" - <_TargetFileNameNoExt>$([System.IO.Path]::GetFileNameWithoutExtension('$(_TestAssembly)')) - <_TargetDir>$([System.IO.Path]::GetDirectoryName('$(_TestAssembly)'))\ - <_CoreRuntimeConfigPath>$(_TargetDir)$(_TargetFileNameNoExt).runtimeconfig.json - <_CoreDepsPath>$(_TargetDir)$(_TargetFileNameNoExt).deps.json - - <_TestRunner Condition="'%(TestToRun.Architecture)'=='x86' And Exists('$(DotNetRoot)x86\dotnet.exe')">$(DotNetRoot)x86\dotnet.exe - <_TestRunner Condition="'$(_TestRunner)'==''">$(DotNetTool) - - <_TestRunnerArgs>exec --depsfile "$(_CoreDepsPath)" --runtimeconfig "$(_CoreRuntimeConfigPath)" $(TestRuntimeAdditionalArguments) "$(NuGetPackageRoot)xunit.runner.console/$(XUnitVersion)/tools/$(_TestRunnerTargetFramework)/xunit.console.dll" "$(_TestAssembly)" -noautoreporters -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" $(_TestRunnerAdditionalArguments) - - - - <_XUnitConsoleExe>xunit.console.exe - <_XUnitConsoleExe Condition="'%(TestToRun.Architecture)' == 'x86'">xunit.console.x86.exe - <_XUnitConsoleExePath>$(NuGetPackageRoot)xunit.runner.console\$(XUnitVersion)\tools\$(_TestRunnerTargetFramework)\$(_XUnitConsoleExe) - - <_TestRunnerArgs>"$(_TestAssembly)" -noshadow -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" $(_TestRunnerAdditionalArguments) - <_TestRunnerArgs Condition="'$(_TestRuntime)' == 'Mono'">$(TestRuntimeAdditionalArguments) "$(_XUnitConsoleExePath)" $(_TestRunnerArgs) - - <_TestRunner Condition="'$(_TestRuntime)' == 'Mono'">$(MonoTool) - <_TestRunner Condition="'$(_TestRuntime)' != 'Mono'">$(_XUnitConsoleExePath) + <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' != 'true'">$(_TestRunnerArgs) -noAutoReporters + <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' == 'true'">$(_TestRunnerArgs) --auto-reporters off From 31a5f2f41e601d7457d446c2c7f9e27a91dbc8c0 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Thu, 27 Mar 2025 19:47:59 +0100 Subject: [PATCH 03/14] Remove xunit.v3.runner.console --- .../tools/XUnitV3/XUnitV3.Runner.targets | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets index 93bf9db9d2d..023644fc219 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets @@ -1,10 +1,6 @@ - - - - From 22cae6cd75a022845b1a417aed07bf9e6b71bcd0 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Thu, 27 Mar 2025 19:52:11 +0100 Subject: [PATCH 04/14] Default to MTP for xunit.v3 --- src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets index a98ead21cda..a499a41212a 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets @@ -3,6 +3,9 @@ false + + + true From 3a460bce2de4248070d920cf810c2173a639db9c Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Mon, 31 Mar 2025 08:41:43 +0200 Subject: [PATCH 05/14] Few fixes --- src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props | 2 ++ src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets | 4 ++++ .../tools/XUnitV3/XUnitV3.Runner.targets | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props index fc6e943a306..12762db0588 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props @@ -89,6 +89,8 @@ $(XUnitVersion) 3.0.2 + 2.0.0 + 3.8.3 $(MSTestVersion) $(MSTestVersion) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets index 416337a32ce..ce80cf20ee9 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets @@ -65,6 +65,10 @@ $(_TestArchitecture) $(TargetFramework)|$(_TestArchitecture) $(_ResultFileNameNoExt) + $(ArtifactsTestResultsDir.Replace("\\", "/")) + $(_ResultFileNameNoExt).xml + $(_ResultFileNameNoExt).trx + $(_ResultFileNameNoExt).html $(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).xml $(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).trx $(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).html diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets index 023644fc219..d6cf6ec38e2 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets @@ -14,7 +14,7 @@ <_TestRunner>%(TestToRun.RunCommand) <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' != 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" - <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' == 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) --report-xunit --report-xunit-filename "%(TestToRun.ResultsXmlPath)" --report-xunit-html --report-xunit-html-filename "%(TestToRun.ResultsHtmlPath)" + <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' == 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) --results-directory "%(TestToRun.ResultsDirectory)" --report-xunit --report-xunit-filename "%(TestToRun.ResultsXmlFileName)" --report-xunit-html --report-xunit-html-filename "%(TestToRun.ResultsHtmlFileName)" @@ -47,6 +47,7 @@ WorkingDirectory="$(_TargetDir)" IgnoreExitCode="true" Timeout="$(_TestTimeout)" + EnvironmentVariables="DOTNET_ROOT=$(DotNetRoot);DOTNET_ROOT_X86=$(DotNetRoot)x86" ContinueOnError="WarnAndContinue"> From 53e0b37098571cdd844941ce56eff3c5db37d639 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Mon, 31 Mar 2025 13:17:49 +0200 Subject: [PATCH 06/14] Remove v3 runner --- Directory.Packages.props | 2 -- open-vs.cmd | 2 -- open-vs.ps1 | 19 ------------------- 3 files changed, 23 deletions(-) delete mode 100644 open-vs.cmd delete mode 100644 open-vs.ps1 diff --git a/Directory.Packages.props b/Directory.Packages.props index d195cfaf5b9..965f7d8f431 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -18,8 +18,6 @@ 1.16.0 $(XUnitVersion) 3.0.2 - 2.0.0 - $(XUnitV3Version) diff --git a/open-vs.cmd b/open-vs.cmd deleted file mode 100644 index 6314f81cc4f..00000000000 --- a/open-vs.cmd +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0open-vs.ps1""" -vs %*" \ No newline at end of file diff --git a/open-vs.ps1 b/open-vs.ps1 deleted file mode 100644 index 515d42269cc..00000000000 --- a/open-vs.ps1 +++ /dev/null @@ -1,19 +0,0 @@ -. $PSScriptRoot\eng\common\tools.ps1 - -# This tells .NET Core to use the bootstrapped runtime -$env:DOTNET_ROOT=InitializeDotNetCli -install:$true -createSdkLocationFile:$true - -# This tells MSBuild to load the SDK from the directory of the bootstrapped SDK -$env:DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR=$env:DOTNET_ROOT - -# This tells .NET Core not to go looking for .NET Core in other places -$env:DOTNET_MULTILEVEL_LOOKUP=0; - -# Put our local dotnet.exe on PATH first so Visual Studio knows which one to use -$env:PATH=($env:DOTNET_ROOT + ";" + $env:PATH); - -# Disable .NET runtime signature validation errors which errors for local builds -$env:VSDebugger_ValidateDotnetDebugLibSignatures=0; - -# Launch Visual Studio with the locally defined environment variables -& "$PSScriptRoot\Arcade.sln" From 81cc9c37ecd68af6ef72e8ac2ef38d0416548aa0 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Mon, 31 Mar 2025 13:19:59 +0200 Subject: [PATCH 07/14] Error when mixing MTP and VSTest --- src/Microsoft.DotNet.Arcade.Sdk/tools/VSTest.targets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/VSTest.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/VSTest.targets index 35564525a5c..fcc64fff4e7 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/VSTest.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/VSTest.targets @@ -4,6 +4,9 @@ + + + <_TestEnvironment>%(TestToRun.EnvironmentDisplay) <_TestAssembly>%(TestToRun.Identity) From 6ba9ccbad7a3b89d512c69bf8c5952fe6d3d5112 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Tue, 1 Apr 2025 13:39:58 +0200 Subject: [PATCH 08/14] Add DependsOnTargets --- src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets index ce80cf20ee9..192b45791e8 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets @@ -44,6 +44,7 @@ From e865bc0c4c6cbf2383b7cdc9f1ec2d436878827c Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Wed, 2 Apr 2025 11:01:40 +0200 Subject: [PATCH 09/14] Adjust --- src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets | 4 ---- .../tools/XUnitV3/XUnitV3.Runner.targets | 10 +++++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets index 192b45791e8..b4579ce475a 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets @@ -66,10 +66,6 @@ $(_TestArchitecture) $(TargetFramework)|$(_TestArchitecture) $(_ResultFileNameNoExt) - $(ArtifactsTestResultsDir.Replace("\\", "/")) - $(_ResultFileNameNoExt).xml - $(_ResultFileNameNoExt).trx - $(_ResultFileNameNoExt).html $(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).xml $(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).trx $(ArtifactsTestResultsDir)$(_ResultFileNameNoExt).html diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets index d6cf6ec38e2..814b44e03b9 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets @@ -5,6 +5,14 @@ Outputs="%(TestToRun.ResultsStdOutPath)" Condition="'@(TestToRun)' != ''"> + + + <_TestResultDirectory>$([System.IO.Path]::GetDirectoryName('%(TestToRun.ResultsTrxPath)')) + <_TestResultTrxFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsTrxPath)')) + <_TestResultXmlFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsXmlFileName)')) + <_TestResultHtmlFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsHtmlFileName)')) + + <_TestEnvironment>%(TestToRun.EnvironmentDisplay) <_TestAssembly>%(TestToRun.Identity) @@ -14,7 +22,7 @@ <_TestRunner>%(TestToRun.RunCommand) <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' != 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" - <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' == 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) --results-directory "%(TestToRun.ResultsDirectory)" --report-xunit --report-xunit-filename "%(TestToRun.ResultsXmlFileName)" --report-xunit-html --report-xunit-html-filename "%(TestToRun.ResultsHtmlFileName)" + <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' == 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) --results-directory "$(_TestResultDirectory)" --report-xunit --report-xunit-filename "$(_TestResultXmlFileName)" --report-xunit-html --report-xunit-html-filename "$(_TestResultHtmlFileName)" From a7cb8b3346a0bc30c3f06ce3656615f0c5f16917 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Thu, 3 Apr 2025 16:10:53 +0200 Subject: [PATCH 10/14] Fix typos --- .../tools/XUnitV3/XUnitV3.Runner.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets index 814b44e03b9..12dda393ba8 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets @@ -9,8 +9,8 @@ <_TestResultDirectory>$([System.IO.Path]::GetDirectoryName('%(TestToRun.ResultsTrxPath)')) <_TestResultTrxFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsTrxPath)')) - <_TestResultXmlFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsXmlFileName)')) - <_TestResultHtmlFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsHtmlFileName)')) + <_TestResultXmlFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsXmlPath)')) + <_TestResultHtmlFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsHtmlPath)')) From e4376bfa0f201666a8e6b9f64e65abd494fffd6b Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Tue, 8 Apr 2025 18:06:43 +0200 Subject: [PATCH 11/14] Trx --- src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props | 1 + .../tools/XUnitV3/XUnitV3.Runner.targets | 4 ++-- .../tools/XUnitV3/XUnitV3.targets | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props index 12762db0588..5b5e052c0fb 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props @@ -90,6 +90,7 @@ 3.0.2 2.0.0 + 1.6.3 3.8.3 $(MSTestVersion) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets index 12dda393ba8..93ff0a08b21 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets @@ -21,8 +21,8 @@ <_TestRunnerAdditionalArguments>%(TestToRun.TestRunnerAdditionalArguments) <_TestRunner>%(TestToRun.RunCommand) - <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' != 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" - <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' == 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) --results-directory "$(_TestResultDirectory)" --report-xunit --report-xunit-filename "$(_TestResultXmlFileName)" --report-xunit-html --report-xunit-html-filename "$(_TestResultHtmlFileName)" + <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' != 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" -trx "%(TestToRun.ResultsTrxPath)" + <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' == 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) --results-directory "$(_TestResultDirectory)" --report-xunit --report-xunit-filename "$(_TestResultXmlFileName)" --report-xunit-html --report-xunit-html-filename "$(_TestResultHtmlFileName)" --report-trx --report-trx-filename "$(_TestResultTrxFileName)" diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets index a499a41212a..df690b64119 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets @@ -15,6 +15,12 @@ + + + + + + $(MSBuildThisFileDirectory)xunit.runner.json From 1958615de66bbac222e4819140f6b582389bc767 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Thu, 10 Apr 2025 12:59:21 +0200 Subject: [PATCH 12/14] Address review comment --- .../tools/XUnitV3/XUnitV3.Runner.targets | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets index 93ff0a08b21..1df25507fbe 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets @@ -23,6 +23,8 @@ <_TestRunner>%(TestToRun.RunCommand) <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' != 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) -xml "%(TestToRun.ResultsXmlPath)" -html "%(TestToRun.ResultsHtmlPath)" -trx "%(TestToRun.ResultsTrxPath)" <_TestRunnerArgs Condition="'$(UseMicrosoftTestingPlatformRunner)' == 'true'">%(TestToRun.RunArguments) $(_TestRunnerAdditionalArguments) --results-directory "$(_TestResultDirectory)" --report-xunit --report-xunit-filename "$(_TestResultXmlFileName)" --report-xunit-html --report-xunit-html-filename "$(_TestResultHtmlFileName)" --report-trx --report-trx-filename "$(_TestResultTrxFileName)" + + $(DotNetRoot) @@ -55,7 +57,7 @@ WorkingDirectory="$(_TargetDir)" IgnoreExitCode="true" Timeout="$(_TestTimeout)" - EnvironmentVariables="DOTNET_ROOT=$(DotNetRoot);DOTNET_ROOT_X86=$(DotNetRoot)x86" + EnvironmentVariables="DOTNET_ROOT=$(TestDotNetRoot);DOTNET_ROOT_X86=$(TestDotNetRoot)x86" ContinueOnError="WarnAndContinue"> From ff4f69507678344c2cb9eecd641b21e2e0a5d3b6 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Thu, 10 Apr 2025 13:04:52 +0200 Subject: [PATCH 13/14] Move to beginning --- .../tools/XUnitV3/XUnitV3.Runner.targets | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets index 1df25507fbe..f60168b4dfe 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.Runner.targets @@ -39,7 +39,7 @@ Redirect std output of the runner. Note that xUnit outputs failure info to both STDOUT (stack trace, message) and STDERR (failed test name) --> - <_TestRunnerCommand Condition="'$(TestCaptureOutput)' != 'false'">$(_TestRunnerCommand) > "%(TestToRun.ResultsStdOutPath)" 2>&1 + <_TestRunnerCommand Condition="'$(TestCaptureOutput)' != 'false'">$(_TestRunnerCommand) >> "%(TestToRun.ResultsStdOutPath)" 2>&1 @@ -52,6 +52,13 @@ + + + + - - - From 41b6bca4bdeffd3a6574e1fd379fa177cd89d5c4 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Thu, 10 Apr 2025 13:08:10 +0200 Subject: [PATCH 14/14] Set XUnitCoreSettingsFile as well --- src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets index df690b64119..e8e529cec4a 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnitV3/XUnitV3.targets @@ -23,6 +23,7 @@ $(MSBuildThisFileDirectory)xunit.runner.json + $(MSBuildThisFileDirectory)xunit.runner.json