All messages from EventListenerTextWriter goes to console output independent on stream name
See original GitHub issueI want to put some hidden message from test to ITestEventListener
extensions.
public void Test()
{
(new NUnit.Framework.Internal.Execution.EventListenerTextWriter("DiagnosticStream", System.IO.TextWriter.Null)).WriteLine("This is message from custom stream");
}
But this message also goes to console output. Is there some way to accomplish my needs?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:33 (21 by maintainers)
Top Results From Across the Web
Console and Engine Release Notes
Cecil to latest; 433 All messages from EventListenerTextWriter goes to console output independent on stream name; 454 Misc improvements to ...
Read more >c# - How to get the text sent to console output in an event ...
SetOut(new StreamWriter(progressStream)); Then use the events of the progress stream to see when it is written to.
Read more >Creating Trace Listeners in .Net - Bryan Soliman Blog
The purpose of a listener is to collect, store, and route tracing messages. Listeners direct the tracing output to an appropriate target, such ......
Read more >Create and Initialize Trace Listeners - .NET Framework
Learn how to create and initialize trace listeners by using classes such as System.Diagnostics.DefaultTraceListener in .NET.
Read more >Chocolatey Software | NUnit 3 Console Runner 3.10.0
Chocolatey is software management automation for Windows that wraps installers, executables, zips, and scripts into compiled packages.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If I were doing this, I would model it after TextOutput, but I would not use TextOutput.
[Reasons for not using TextOutput:
Anyway, I would create the following pieces:
Define a new xml element to represent the message. I would have this reviewed by the team before implementing since it’s the most important piece.
A way to create this message: probably a new constructor or a property of EventListenerTextWriter that specifies a different XML element to use.
A mechanism to send a message to a particular extension or other engine component. For example
TestContext.SendMessage(string destination, string message);
Provided we are not handling the messages in the engine itself, but only in extensions, no more is needed. All NUnit components will ignore the new XML element.
Again… the first piece is the critical one and it will go easier if it’s reviewed first as a design element. The rest can be handled through code review.
Closed by https://github.com/nunit/nunit/pull/3018. Thanks, Nikolay!