Skip to content
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

Use ITestOutputHelper instead of Console.WriteLine #371

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

omajid
Copy link
Member

@omajid omajid commented Feb 4, 2025

Messages logged by tests to the console using Console.WriteLine and Console.Error.WriteLine are not captured by newer versions of the .NET SDK. Instead, they get lost. So we get no real feedback for failing tests in logs.

Messages logged by ITestOutputHelper are captured by the test runner, and automatically displayed by the test runner for failing tests. They don't get displayed for passing tests out of the box, but can be displayed by configuring the test logger.

See #370 for more discussion about the need for this.

@omajid omajid requested a review from tmds February 5, 2025 15:03
@@ -40,30 +41,37 @@ public class AssembliesValid
new Regex("/packs/"),
};

private readonly ITestOutputHelper output;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: prefix with _.

Messages logged by tests to the console using Console.WriteLine and
Console.Error.WriteLine are not captured by newer versions of the .NET
SDK. Instead, they get lost. So we get no real feedback for failing
tests in logs.

Messages logged by ITestOutputHelper are captured by the test runner,
and automatically displayed by the test runner for failing tests. They
don't get displayed for passing tests out of the box, but can be
displayed by configuring the test logger.
@omajid omajid force-pushed the console-output-save branch from c2cf422 to b171d37 Compare February 5, 2025 17:41
@omajid omajid merged commit ed6b290 into redhat-developer:main Feb 5, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants