In xUnit v2 ITraceOutputHelper was needed (and injected) to make the console output inside your production code visible inside a test - in v3 it is easier: CaptureConsoleAttribute
CaptureConsoleAttribute
All what I am writing here, can be found in the official documentation: https://xunit.net/docs/capturing-output
The gist here:
// Both standard output and standard error
[assembly: CaptureConsole]
// Only standard output
[assembly: CaptureConsole(CaptureError = false)]
// Only standard error
[assembly: CaptureConsole(CaptureOutput = false)]
As this is an assembly wide attribute, you only have to define this once. While easier to setup for your project, you lose the fine-grained control of v2. As of now (10th of November 2025), the attribute is defined as:
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
public sealed class CaptureConsoleAttribute : Attribute, IAssemblyFixtureAttribute
So you can't slap it on a class or method.