diff --git a/eng/helix/content/runtests.cmd b/eng/helix/content/runtests.cmd index 935b23647d89d52b21c9412a87a26b3178a0b0b1..b0a910502c9ed7d75d1bb3370f84a245576180e2 100644 --- a/eng/helix/content/runtests.cmd +++ b/eng/helix/content/runtests.cmd @@ -44,7 +44,7 @@ REM only puts the explicit filter traits the user provided in REM Filter syntax: https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md set NONFLAKY_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:%HELIX%!=true" echo Running non-flaky tests. -%DOTNET_ROOT%\dotnet vstest %target% --logger:trx --TestCaseFilter:%NONFLAKY_FILTER% +%DOTNET_ROOT%\dotnet vstest %target% --logger:xunit --TestCaseFilter:%NONFLAKY_FILTER% if errorlevel 1 ( echo Failure in non-flaky test 1>&2 set exit_code=1 @@ -59,5 +59,8 @@ if errorlevel 1 ( REM DO NOT EXIT and DO NOT SET EXIT_CODE to 1 ) +echo "Copying TestResults\TestResults.xml to ." +copy TestResults\TestResults.xml testResults.xml + exit /b %exit_code% diff --git a/eng/helix/content/runtests.sh b/eng/helix/content/runtests.sh index 8c3cbd09c287520e3f9fb65d31fb6d2b714c9916..3934d5541c02dac53e73c3d9b989b65f7d8b6284 100644 --- a/eng/helix/content/runtests.sh +++ b/eng/helix/content/runtests.sh @@ -30,7 +30,6 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 # Used by SkipOnHelix attribute export helix="$helix_queue_name" - RESET="\033[0m" RED="\033[0;31m" YELLOW="\033[0;33m" @@ -94,7 +93,7 @@ fi # Filter syntax: https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md NONFLAKY_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:$helix_queue_name!=true" echo "Running non-flaky tests." -$DOTNET_ROOT/dotnet vstest $test_binary_path --logger:trx --TestCaseFilter:"$NONFLAKY_FILTER" +$DOTNET_ROOT/dotnet vstest $test_binary_path --logger:xunit --TestCaseFilter:"$NONFLAKY_FILTER" nonflaky_exitcode=$? if [ $nonflaky_exitcode != 0 ]; then echo "Non-flaky tests failed!" 1>&2 @@ -109,6 +108,8 @@ if [ $? != 0 ]; then # DO NOT EXIT fi +echo "Copying TestResults/TestResults to ." +cp TestResults/TestResults.xml testResults.xml echo "Copying artifacts/logs to $HELIX_WORKITEM_UPLOAD_ROOT/../" shopt -s globstar cp artifacts/log/**/*.log $HELIX_WORKITEM_UPLOAD_ROOT/../ diff --git a/eng/targets/Helix.targets b/eng/targets/Helix.targets index 16f5e9f5a2fc2dbf3202fa84737714a640aab83a..91e952efe3944f751711b6fdf8ba804a8c2d55bd 100644 --- a/eng/targets/Helix.targets +++ b/eng/targets/Helix.targets @@ -1,14 +1,10 @@ <Project> <!-- Item group has to be defined here becasue Helix.props is evaluated before xunit.runner.console.props --> - <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'"> - <HelixContent Condition="'$(XunitConsole472Path)' != ''" Include="$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))/**/*" /> - </ItemGroup> - - <ItemGroup> + <ItemGroup Condition="$(BuildHelixPayload)"> <Content Include="@(HelixContent)" /> </ItemGroup> - + <!-- This target is meant to be used when invoking helix tests on one project at a time. @@ -35,6 +31,10 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj </MSBuild> </Target> + <ItemGroup> + <PackageReference Include="XunitXml.TestLogger" Version="2.1.26" /> + </ItemGroup> + <Target Name="_SetCreateHelixPayload"> <PropertyGroup> <_SelectedPlatforms>@(HelixProjectPlatform)</_SelectedPlatforms> @@ -60,6 +60,11 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj <Target Name="_CreateHelixWorkItem" Condition="$(BuildHelixPayload)"> + <ItemGroup> + <HelixContent Include="$(OutputPath)/Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestAdapter.dll" /> + <HelixContent Include="$(OutputPath)/Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestLogger.dll" /> + </ItemGroup> + <PropertyGroup> <!-- Extract the effective queue name from this format "(name)host@dockerimage". This is sometimes used in test code to skip tests. --> <_HelixFriendlyNameTargetQueue>$(HelixTargetQueue)</_HelixFriendlyNameTargetQueue>