diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props index 9eada2d1c90..c19c888abca 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/DefaultVersions.props @@ -35,7 +35,6 @@ true - true true @@ -46,6 +45,13 @@ false false + + + true + + + + + + + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/NUnit/NUnit.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/NUnit/NUnit.targets new file mode 100644 index 00000000000..5ec441e9a0a --- /dev/null +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/NUnit/NUnit.targets @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.props index fc7c90d7e05..c0cee0b52c7 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.props +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.props @@ -36,13 +36,7 @@ false - - XUnit - true - - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets index 9883c916350..477f45fcd95 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/Tests.targets @@ -1,6 +1,6 @@ - + true @@ -12,8 +12,18 @@ Core Mono Full + + XUnit + + + $(MSBuildThisFileDirectory)$(TestRunnerName)\$(TestRunnerName).targets + + + + $(PlatformTarget) x64 @@ -28,8 +38,7 @@ @@ -43,6 +52,7 @@ $(TargetFramework) $(TargetFrameworkIdentifier) + $(TargetFrameworkVersion) $(TestRuntime) $(TestTimeout) $(_TestArchitecture) diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/VSTest.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/VSTest.targets new file mode 100644 index 00000000000..541f9b8f66e --- /dev/null +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/VSTest.targets @@ -0,0 +1,78 @@ + + + + <_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 + + <_TargetDir>$([System.IO.Path]::GetDirectoryName('$(_TestAssembly)'))\ + + <_TestResultDirectory>$([System.IO.Path]::GetDirectoryName('%(TestToRun.ResultsXmlPath)')) + <_TestResultFileName>$([System.IO.Path]::GetFileName('%(TestToRun.ResultsXmlPath)')) + + <_TestRunnerCommand>$(DotNetTool) test $(_TestAssembly) --logger:"console%3Bverbosity=normal" --logger:"trx%3BLogFileName=$(_TestResultFileName)" "--ResultsDirectory:$(_TestResultDirectory)" "--Framework:%(TestToRun.TargetFrameworkIdentifier),Version=%(TestToRun.TargetFrameworkVersion)" + <_TestRunnerCommand Condition="'$(VSTestRunSettingsFile)' != ''">$(_TestRunnerCommand) "--settings:$(VSTestRunSettingsFile)" + <_TestRunnerCommand Condition="'$(_TestRunnerAdditionalArguments)' != ''">$(_TestRunnerCommand) $(_TestRunnerAdditionalArguments) + + + <_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/XUnit/XUnit.Runner.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.Runner.targets new file mode 100644 index 00000000000..44e909abf57 --- /dev/null +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.Runner.targets @@ -0,0 +1,118 @@ + + + $(MSBuildThisFileDirectory)xunit.runner.json + + + + + + + + + + + + + <_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/XUnit/XUnit.props b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.props deleted file mode 100644 index 77cdedf0084..00000000000 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.props +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - $(MSBuildThisFileDirectory)xunit.runner.json - - diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.targets index bc925052971..570952daa66 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.targets @@ -1,133 +1,20 @@ + + false + + - - - - - - - - - - - - - <_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) - - - - - - - - - - + +