-
Notifications
You must be signed in to change notification settings - Fork 384
Add ITestOutputHelper to MockConsole for visible console output in test failures #5700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… CollectCommand tests Co-authored-by: mdh1418 <16830051+mdh1418@users.noreply.github.com>
… handling Co-authored-by: mdh1418 <16830051+mdh1418@users.noreply.github.com>
Co-authored-by: mdh1418 <16830051+mdh1418@users.noreply.github.com>
…ilures Co-authored-by: mdh1418 <16830051+mdh1418@users.noreply.github.com>
mdh1418
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot can we also update the ConsoleExporterTests to use the ITestOutputHelper as well
…leExporterTests Co-authored-by: mdh1418 <16830051+mdh1418@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves diagnosability of failing tests by making MockConsole optionally mirror console output to xUnit’s ITestOutputHelper, and updates several test suites to pass the output helper into MockConsole.
Changes:
- Added optional
ITestOutputHelperplumbing toMockConsole, including line-buffering and an explicitFlushOutput()method. - Updated
CollectCommandFunctionalTests,CollectLinuxCommandFunctionalTests, andConsoleExporterTeststo injectITestOutputHelperand pass it toMockConsole.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/tests/Common/MockConsole.cs | Adds optional xUnit output multiplexing, buffering, and flush integration in assert helpers. |
| src/tests/dotnet-trace/CollectCommandFunctionalTests.cs | Injects ITestOutputHelper and routes console output through MockConsole. |
| src/tests/dotnet-trace/CollectLinuxCommandFunctionalTests.cs | Injects ITestOutputHelper and routes console output through MockConsole across test cases. |
| src/tests/dotnet-counters/ConsoleExporterTests.cs | Injects ITestOutputHelper and passes it to MockConsole for better failure output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
|
Example outputs when there are failures.
./test.sh |
Co-authored-by: mdh1418 <16830051+mdh1418@users.noreply.github.com>
Applied the suggested changes in 61ff689. Both exception filters now use case-insensitive comparison with |
…FlushTestLogging Co-authored-by: noahfalk <6243776+noahfalk@users.noreply.github.com>
Improve Console Output Visibility in CollectCommand Tests
This PR addresses issue #5698 by making console output visible when tests fail.
Changes completed:
Key features:
Result:
Console output including error messages and exceptions is now visible in test output under "Standard Output Messages:", making it much easier to diagnose issues when tests fail.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.