testfx icon indicating copy to clipboard operation
testfx copied to clipboard

TestingPlatformCaptureOutput=false does not work with .NET 9.0 SDK

Open campersau opened this issue 1 year ago • 5 comments

Describe the bug

When running dotnet test -p:TestingPlatformCaptureOutput=false the output of the testing platform is not visible anymore with .NET 9.0 SDK.

Steps To Reproduce

  1. Create a new xUnit v3 project (e.g. https://xunit.net/docs/getting-started/v3/cmdline#create-the-unit-test-project)
  2. Uncomment <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport> in the csproj
  3. Run dotnet test -p:TestingPlatformCaptureOutput=false

Expected behavior

Output using .NET 8.0 SDK (8.0.404)

dotnet test -p:TestingPlatformCaptureOutput=false
  Run tests: 'MyFirstUnitTests\bin\Debug\net8.0\MyFirstUnitTests.dll' [net8.0|x64]
  xUnit.net v3 Microsoft.Testing.Platform Runner v1.0.0+5b41c61aa1 (64-bit .NET 8.0.11)

  Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 433ms

  Testlaufzusammenfassung: Bestanden! - MyFirstUnitTests\bin\Debug\net8.0\MyFirstUnitTests.dll (net8.0|x64)
    total: 1
    failed: 0
    succeeded: 1
    skipped: 0
    duration: 569ms
  Tests succeeded: 'MyFirstUnitTests\bin\Debug\net8.0\MyFirstUnitTests.dll' [net8.0|x64]

Actual behavior

Output using .NET 9.0 SDK (9.0.101)

dotnet test -p:TestingPlatformCaptureOutput=false
  MyFirstUnitTests Test Erfolgreich (1,6s)

Testzusammenfassung: insgesamt: 1; fehlgeschlagen: 0; erfolgreich: 1; übersprungen: 0; Dauer: 1,4 Sek.
Erstellen von Erfolgreich in 3,7s

Additional context

See also: https://github.com/xunit/xunit/issues/3092#issuecomment-2556234421

Documentation: https://learn.microsoft.com/dotnet/core/testing/unit-testing-platform-integration-dotnet-test#show-complete-platform-output

campersau avatar Dec 20 '24 08:12 campersau

Hi @campersau,

Thanks for raising this issue. I can confirm that terminal logger of .NET 9 is breaking MTP experience... I'll raise the point with SDK team. In the meantime, you can use /tl:false to disable the terminal logger experience.

Evangelink avatar Dec 20 '24 19:12 Evangelink

Another potential solution is dotnet test --verbosity detailed. We are also shipping new dotnet test experience for MTP in .NET 10 SDK.

Youssef1313 avatar Apr 09 '25 19:04 Youssef1313

@Youssef1313 @nohwnd do you want to fix the experience for before net10 or not?

Evangelink avatar Jun 18 '25 19:06 Evangelink

I think this is fundamental problem of terminal logger that we reported to msbuild and there was no consensus on how to handle it. (Cannot find the original issue but here is similar: https://github.com/dotnet/sdk/issues/43293 ) Not all info is shown, e.g. interesting information from dotnet publish, or additional info from dotnet build. So I would rather not make a one-off solution to fix it ourselves.

nohwnd avatar Jun 19 '25 08:06 nohwnd

@nohwnd Should we close as "External" (SDK) then?

Youssef1313 avatar Jun 19 '25 08:06 Youssef1313