Description
We are developing a ASP.NET Core application and for testing we use the ASP.NET Core TestHost (WebApplicationFactory) to facilitate integration testing.
To capture the logging we replace the ILoggerFactory with an implementation that uses the TestContext to write the application logging so it can be used for debugging if tests fail.
Since version 2.2.9 logging is no longer reliably captured.
Steps to reproduce
- Download this example solution: TestOutputTest.zip
- Run the test
- Check the TestContext messages, all the logging output for the request is missing.
As a test I added a "Hello from Get" message to the controller, which is also not visible.
Expected behavior
All the messages passed to the TestContext for a single test are captured.
If MSTest.TestAdapter and MSTest.TestFramework version 2.2.8 are used the output is captured as expected
Actual behavior
Messages are missing, probably because they are in a different async context.
Environment
.NET SDK 6.0.202
Windows 11
Visual Studio 2022 (17.1.4)
MsTest 2.2.9
Also tried using the pre-release version 2.2.10-preview-20220414-01, but same issue there.
Description
We are developing a ASP.NET Core application and for testing we use the ASP.NET Core TestHost (WebApplicationFactory) to facilitate integration testing.
To capture the logging we replace the
ILoggerFactorywith an implementation that uses theTestContextto write the application logging so it can be used for debugging if tests fail.Since version 2.2.9 logging is no longer reliably captured.
Steps to reproduce
As a test I added a "Hello from Get" message to the controller, which is also not visible.
Expected behavior
All the messages passed to the TestContext for a single test are captured.
If
MSTest.TestAdapterandMSTest.TestFrameworkversion 2.2.8 are used the output is captured as expectedActual behavior
Messages are missing, probably because they are in a different async context.
Environment
.NET SDK 6.0.202
Windows 11
Visual Studio 2022 (17.1.4)
MsTest 2.2.9
Also tried using the pre-release version 2.2.10-preview-20220414-01, but same issue there.