Closed theodelrieu closed 3 days ago
Yep console writelines are automatically intercepted by the framework
Thanks. It's still not clear to me what the difference between xUnit and TUnit is on that aspect. Are there missing/added features?
EDIT: We currently have a lot of Asp services that take an ILogger
, so I'd like to get an ILogger in my tests like I'm able to do with xUnit, c.f. this article.
If you wanted an ILogger you'd have to create your own implementation, because TUnit doesn't have any dependencies on Microsoft.Extensions.Logging.
You can get a TUnitLogger by doing TestContext.Current!.GetDefaultLogger()
- so your custom ILogger could forward calls on to the TUnit logger
Thanks!
Hello,
I had to remove every instance of
ITestOutputHelper
when migrating from xUnit to TUnit, but I couldn't find anything in the doc about logging.Looking at the code, there are some logging-related classes in
TUnit.Engine.Logging
. Are they supposed to be used by client code? IsConsole.WriteLine
the way to go?