Skip to content

Commit 9501874

Browse files
authored
Use vstest xml logger for helix (#18491)
1 parent 524bba8 commit 9501874

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

eng/helix/content/runtests.cmd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ REM only puts the explicit filter traits the user provided in
4444
REM Filter syntax: https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md
4545
set NONFLAKY_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:%HELIX%!=true"
4646
echo Running non-flaky tests.
47-
%DOTNET_ROOT%\dotnet vstest %target% --logger:trx --TestCaseFilter:%NONFLAKY_FILTER%
47+
%DOTNET_ROOT%\dotnet vstest %target% --logger:xunit --TestCaseFilter:%NONFLAKY_FILTER%
4848
if errorlevel 1 (
4949
echo Failure in non-flaky test 1>&2
5050
set exit_code=1
@@ -59,5 +59,8 @@ if errorlevel 1 (
5959
REM DO NOT EXIT and DO NOT SET EXIT_CODE to 1
6060
)
6161

62+
echo "Copying TestResults\TestResults.xml to ."
63+
copy TestResults\TestResults.xml testResults.xml
64+
6265
exit /b %exit_code%
6366

eng/helix/content/runtests.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
3030
# Used by SkipOnHelix attribute
3131
export helix="$helix_queue_name"
3232

33-
3433
RESET="\033[0m"
3534
RED="\033[0;31m"
3635
YELLOW="\033[0;33m"
@@ -94,7 +93,7 @@ fi
9493
# Filter syntax: https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md
9594
NONFLAKY_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:$helix_queue_name!=true"
9695
echo "Running non-flaky tests."
97-
$DOTNET_ROOT/dotnet vstest $test_binary_path --logger:trx --TestCaseFilter:"$NONFLAKY_FILTER"
96+
$DOTNET_ROOT/dotnet vstest $test_binary_path --logger:xunit --TestCaseFilter:"$NONFLAKY_FILTER"
9897
nonflaky_exitcode=$?
9998
if [ $nonflaky_exitcode != 0 ]; then
10099
echo "Non-flaky tests failed!" 1>&2
@@ -109,6 +108,8 @@ if [ $? != 0 ]; then
109108
# DO NOT EXIT
110109
fi
111110

111+
echo "Copying TestResults/TestResults to ."
112+
cp TestResults/TestResults.xml testResults.xml
112113
echo "Copying artifacts/logs to $HELIX_WORKITEM_UPLOAD_ROOT/../"
113114
shopt -s globstar
114115
cp artifacts/log/**/*.log $HELIX_WORKITEM_UPLOAD_ROOT/../

eng/targets/Helix.targets

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
<Project>
22

33
<!-- Item group has to be defined here becasue Helix.props is evaluated before xunit.runner.console.props -->
4-
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
5-
<HelixContent Condition="'$(XunitConsole472Path)' != ''" Include="$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))/**/*" />
6-
</ItemGroup>
7-
8-
<ItemGroup>
4+
<ItemGroup Condition="$(BuildHelixPayload)">
95
<Content Include="@(HelixContent)" />
106
</ItemGroup>
11-
7+
128
<!--
139
1410
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
3531
</MSBuild>
3632
</Target>
3733

34+
<ItemGroup>
35+
<PackageReference Include="XunitXml.TestLogger" Version="2.1.26" />
36+
</ItemGroup>
37+
3838
<Target Name="_SetCreateHelixPayload">
3939
<PropertyGroup>
4040
<_SelectedPlatforms>@(HelixProjectPlatform)</_SelectedPlatforms>
@@ -60,6 +60,11 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
6060

6161
<Target Name="_CreateHelixWorkItem" Condition="$(BuildHelixPayload)">
6262

63+
<ItemGroup>
64+
<HelixContent Include="$(OutputPath)/Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestAdapter.dll" />
65+
<HelixContent Include="$(OutputPath)/Microsoft.VisualStudio.TestPlatform.Extension.Xunit.Xml.TestLogger.dll" />
66+
</ItemGroup>
67+
6368
<PropertyGroup>
6469
<!-- Extract the effective queue name from this format "(name)host@dockerimage". This is sometimes used in test code to skip tests. -->
6570
<_HelixFriendlyNameTargetQueue>$(HelixTargetQueue)</_HelixFriendlyNameTargetQueue>

0 commit comments

Comments
 (0)