Skip to content

VSTest is printing using Console.WriteLine instead of using the logger #2224

@krwq

Description

@krwq

Description

VSTest should be using logger instead of Console.WriteLine. I.e.:

Console.WriteLine(Resources.TestRunningSummary, this.TestFileFullPath, this.VSTestFramework);

Console.WriteLine(Resources.UpdateTestSdkForCollectingCodeCoverage);

This is causing that in some cases output gets lost.

Steps to reproduce

  <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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions