Use vstest xml logger for helix (#18491)
This commit is contained in:
parent
524bba8ff4
commit
9501874f3a
|
|
@ -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
|
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"
|
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.
|
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 (
|
if errorlevel 1 (
|
||||||
echo Failure in non-flaky test 1>&2
|
echo Failure in non-flaky test 1>&2
|
||||||
set exit_code=1
|
set exit_code=1
|
||||||
|
|
@ -59,5 +59,8 @@ if errorlevel 1 (
|
||||||
REM DO NOT EXIT and DO NOT SET EXIT_CODE to 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%
|
exit /b %exit_code%
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||||
# Used by SkipOnHelix attribute
|
# Used by SkipOnHelix attribute
|
||||||
export helix="$helix_queue_name"
|
export helix="$helix_queue_name"
|
||||||
|
|
||||||
|
|
||||||
RESET="\033[0m"
|
RESET="\033[0m"
|
||||||
RED="\033[0;31m"
|
RED="\033[0;31m"
|
||||||
YELLOW="\033[0;33m"
|
YELLOW="\033[0;33m"
|
||||||
|
|
@ -94,7 +93,7 @@ fi
|
||||||
# Filter syntax: https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md
|
# 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"
|
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."
|
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=$?
|
nonflaky_exitcode=$?
|
||||||
if [ $nonflaky_exitcode != 0 ]; then
|
if [ $nonflaky_exitcode != 0 ]; then
|
||||||
echo "Non-flaky tests failed!" 1>&2
|
echo "Non-flaky tests failed!" 1>&2
|
||||||
|
|
@ -109,6 +108,8 @@ if [ $? != 0 ]; then
|
||||||
# DO NOT EXIT
|
# DO NOT EXIT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Copying TestResults/TestResults to ."
|
||||||
|
cp TestResults/TestResults.xml testResults.xml
|
||||||
echo "Copying artifacts/logs to $HELIX_WORKITEM_UPLOAD_ROOT/../"
|
echo "Copying artifacts/logs to $HELIX_WORKITEM_UPLOAD_ROOT/../"
|
||||||
shopt -s globstar
|
shopt -s globstar
|
||||||
cp artifacts/log/**/*.log $HELIX_WORKITEM_UPLOAD_ROOT/../
|
cp artifacts/log/**/*.log $HELIX_WORKITEM_UPLOAD_ROOT/../
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
<Project>
|
<Project>
|
||||||
|
|
||||||
<!-- Item group has to be defined here becasue Helix.props is evaluated before xunit.runner.console.props -->
|
<!-- Item group has to be defined here becasue Helix.props is evaluated before xunit.runner.console.props -->
|
||||||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
|
<ItemGroup Condition="$(BuildHelixPayload)">
|
||||||
<HelixContent Condition="'$(XunitConsole472Path)' != ''" Include="$([System.IO.Path]::GetDirectoryName('$(XunitConsole472Path)'))/**/*" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="@(HelixContent)" />
|
<Content Include="@(HelixContent)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
This target is meant to be used when invoking helix tests on one project at a time.
|
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>
|
</MSBuild>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="XunitXml.TestLogger" Version="2.1.26" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="_SetCreateHelixPayload">
|
<Target Name="_SetCreateHelixPayload">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_SelectedPlatforms>@(HelixProjectPlatform)</_SelectedPlatforms>
|
<_SelectedPlatforms>@(HelixProjectPlatform)</_SelectedPlatforms>
|
||||||
|
|
@ -60,6 +60,11 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
|
||||||
|
|
||||||
<Target Name="_CreateHelixWorkItem" Condition="$(BuildHelixPayload)">
|
<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>
|
<PropertyGroup>
|
||||||
<!-- Extract the effective queue name from this format "(name)host@dockerimage". This is sometimes used in test code to skip tests. -->
|
<!-- Extract the effective queue name from this format "(name)host@dockerimage". This is sometimes used in test code to skip tests. -->
|
||||||
<_HelixFriendlyNameTargetQueue>$(HelixTargetQueue)</_HelixFriendlyNameTargetQueue>
|
<_HelixFriendlyNameTargetQueue>$(HelixTargetQueue)</_HelixFriendlyNameTargetQueue>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue