vstest
vstest copied to clipboard
VSTest is printing using Console.WriteLine instead of using the logger
Description
VSTest should be using logger instead of Console.WriteLine. I.e.: https://github.com/microsoft/vstest/blob/e6c198ca439603f0e81d723538894646032745f6/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask.cs#L132 https://github.com/microsoft/vstest/blob/e6c198ca439603f0e81d723538894646032745f6/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask.cs#L301
This is causing that in some cases output gets lost.
Steps to reproduce
- Clone https://github.com/dotnet/iot/
- Replace following ("Test") task https://github.com/dotnet/iot/blob/a5a53b5a3a287638df0176c483fcb1f3b2fef7f0/build.proj#L59 with
<Target Name="Test">
<ItemGroup>
<UnitTestProjects Include="$(MSBuildThisFileDirectory)src\devices\**\*.Tests.csproj" />
</ItemGroup>
<MSBuild Projects="@(UnitTestProjects)" Targets="VSTest"
ContinueOnError="ErrorAndContinue" />
<Error Condition="$(MSBuildLastTaskResult) != 'true'"
Text="Unit tests failed. Please check the detailed log to find out which ones failed." />
</Target>
Replacing will not be needed once linked PR is merged
- Run build.cmd/build.sh (in the root directory)
If any property is passed to MSBuild task then output gets printed (because of luck it gets run on master node where Console.WriteLine works correctly)
Expected behavior
Test output is displayed
Actual behavior
Build fails but no errors get printed
It also looks like this task creates a process but doesn't redirect output, so that will further be lost logging. https://github.com/microsoft/vstest/blob/e6c198ca439603f0e81d723538894646032745f6/src/Microsoft.TestPlatform.Build/Tasks/VSTestForwardingApp.cs#L30-L51
cc @nohwnd
@ViktorHofer did you see this issue happen somewher or why are you tagging me just now?:)
@akoeplinger a colleague of mine is hitting this issue in mono/linker. Thought you might be interested in this issue :)
Is it another manifestation of #680?
@mayankbansal018 @Evangelink do you have any ETA when this might be addressed? this is currently making vstests kinda useless in some scenarios for dotnet/iot because tests fail but we get not info what failed and issue is CI specific in our case.
FYI #2702 addresses the issue, but has been waiting for ages now. I'm rebasing from time to time...
addressed in the msbuild logger work