From 4a55b463e72a438b4bedc3afbc1afdcb225b593b Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 26 Mar 2020 14:36:40 +0100 Subject: [PATCH] Make VSTest runner work and enable html log (#33915) The VSTest runner is now supposed to work with the /p:TestRunner=vstest switch. Currently this is an opt-in but the desire is to get rid of xunit.console completely and just use VSTest. --- eng/Versions.props | 1 - eng/testing/xunit/vstest.props | 12 ++++-------- eng/testing/xunit/vstest.targets | 10 +++++++--- eng/testing/xunit/vstest.xunit.json | 5 +++++ .../xunit/{xunit.runner.json => xunit.console.json} | 0 eng/testing/xunit/xunit.console.props | 2 ++ eng/testing/xunit/xunit.console.targets | 5 ----- eng/testing/xunit/xunit.props | 2 -- eng/testing/xunit/xunit.targets | 7 +++++++ global.json | 2 +- 10 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 eng/testing/xunit/vstest.xunit.json rename eng/testing/xunit/{xunit.runner.json => xunit.console.json} (100%) diff --git a/eng/Versions.props b/eng/Versions.props index ec8600669fbe6..d3d880c574e64 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -118,7 +118,6 @@ 2.4.1 2.0.5 12.0.3 - 2.1.26 4.12.0 3.1.0-preview-20200129.1 diff --git a/eng/testing/xunit/vstest.props b/eng/testing/xunit/vstest.props index bcf5476a82717..0cc370f276171 100644 --- a/eng/testing/xunit/vstest.props +++ b/eng/testing/xunit/vstest.props @@ -2,19 +2,15 @@ en + testResults.trx + testResults.html + $(HtmlTestResultsName) + $(MSBuildThisFileDirectory)vstest.xunit.json - - - - - - diff --git a/eng/testing/xunit/vstest.targets b/eng/testing/xunit/vstest.targets index 9e1517a2bf648..326a7cda00bc1 100644 --- a/eng/testing/xunit/vstest.targets +++ b/eng/testing/xunit/vstest.targets @@ -1,10 +1,13 @@ - "$(RunScriptHost)" + "$(DotNetTool)" + dotnet test $(TargetFileName) - $(RunArguments) --logger "xunit;LogFilePath=$(TestResultsName)" + $(RunArguments) --nologo + $(RunArguments) --logger "trx;LogFileName=$(TrxTestResultsName)" + $(RunArguments) --logger "html;LogFileName=$(HtmlTestResultsName)" $(RunArguments) --framework $(TargetFramework) $(RunArguments) --platform $(ArchGroup) $(RunArguments) --parallel @@ -27,6 +30,7 @@ $(RunSettingsOptions) RunConfiguration.DisableParallelization=true $(RunSettingsOptions) RunConfiguration.DisableAppDomain=true - $(RunArguments) --(RunSettingsOptions) + $(RunSettingsOptions) RunConfiguration.DotNetHostPath="$(RunScriptHost)" + $(RunArguments) --$(RunSettingsOptions) \ No newline at end of file diff --git a/eng/testing/xunit/vstest.xunit.json b/eng/testing/xunit/vstest.xunit.json new file mode 100644 index 0000000000000..b81a78d00ad56 --- /dev/null +++ b/eng/testing/xunit/vstest.xunit.json @@ -0,0 +1,5 @@ +{ + "diagnosticMessages": false, + "longRunningTestSeconds": 120, + "shadowCopy": false +} \ No newline at end of file diff --git a/eng/testing/xunit/xunit.runner.json b/eng/testing/xunit/xunit.console.json similarity index 100% rename from eng/testing/xunit/xunit.runner.json rename to eng/testing/xunit/xunit.console.json diff --git a/eng/testing/xunit/xunit.console.props b/eng/testing/xunit/xunit.console.props index 2911134a18215..ad7ffdb52587f 100644 --- a/eng/testing/xunit/xunit.console.props +++ b/eng/testing/xunit/xunit.console.props @@ -1,6 +1,8 @@ true + testResults.xml + $(MSBuildThisFileDirectory)xunit.console.json diff --git a/eng/testing/xunit/xunit.console.targets b/eng/testing/xunit/xunit.console.targets index b474bbf6a2e1e..059eede7dcf42 100644 --- a/eng/testing/xunit/xunit.console.targets +++ b/eng/testing/xunit/xunit.console.targets @@ -52,11 +52,6 @@ - - - xunit.console - $(MSBuildThisFileDirectory)xunit.runner.json - testResults.xml diff --git a/eng/testing/xunit/xunit.targets b/eng/testing/xunit/xunit.targets index 81627d6bc14d3..4583d682cfb70 100644 --- a/eng/testing/xunit/xunit.targets +++ b/eng/testing/xunit/xunit.targets @@ -23,6 +23,13 @@ <_withoutCategories Condition="'$(TargetOSCategory)' != ''">$(_withoutCategories);$(TargetOSCategory) + + + +