TestContext.WriteLine or Console.WriteLine when running on a different thread is not attached to the correct test from MsTest.Sdk/3.8.0 and forward #6683
Replies: 2 comments 1 reply
-
|
It's not about being on a different thread. If you are on the correct |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
I redirect the discussion to this post: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
We us MsTest for integration testing involving communication with hardware and in our case multiple threads are needed. Up until MsTest.Sdk/3.7.0 the test outputs was assigned to the correct test method.
From 3.8.0 and above the logs are assigned to the first or last test or not show at all depending on which version used.
I've attached a simple demo project. Changing from sdk 3.7.0 to 3.8.0 or 3.11.0 in the project file will cause the Standard output logs from the workerthread to show only for Mehod1 in the Test1 and Test2 class
I might be wrong but I think this changes in this file may affect the result
https://github.com/microsoft/testfx/blob/main/src/Adapter/MSTestAdapter.PlatformServices/Services/TestContextImplementation.cs
[Edit, updated to a simpler example that illustrates the issue]
I expect this to be logged for every test method:
In EventHandler: ContextId: TestsAndLogging.Test1, Current Count: 1
TestsAndLogging.zip
I have google a lot but can't find any up to date source giving an example of how to make the output logs to be assigned to the correct text output i a multithreaded usecase
Regards Mattias
Beta Was this translation helpful? Give feedback.
All reactions