Forward standard output of testhost#4998
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When Tests write output using
Console.WriteLineit may or might not be seen by the user, depending on which target framework they are using, which OS, and which testing framework.When it is seen:
User is running .NET Framework tests in-process, is using vstest.console 17.6.3 or earlier, and is not using MSTest.
User is running tests on Linux.
When it is not seen:
<MSTest><CaptureTraceOutput>false</CaptureTraceOutput></MSTest>option.Solution
This pull request standardizes the output capturing and passing to parent processes via Informational
TestMessage. This same mechanism is used by xUnit to send their[xUnit.net 00:00:00.11] Starting: xunit001messages.Two options are added and enabled by default:
CaptureStandardOutputenables output capturing by VSTest. When disabled the behavior returns to the one of 17.6.3 and earlier.ForwardStandardOutputenables output forwarding. When enabled it forwards output to VS.When disabled, but CaptureStandardOutput is enabled it will suppress all output and return to behavior in 17.7.0 and newer.
Additionally two feature flags are added to allow easier global opt-out:
Setting them to 1 has the same effect as setting the above options to FALSE.
Related issue
Fix #799
Fix #4828
Fix #4947