views:

286

answers:

1

I'm running tests using the TestDriven.NET VS add-in, and the class library I'm testing is instrumented using TraceSource. How can I get the output of that TraceSource to show up in the Output window in Visual Studio? The DefaultTraceListener doesn't appear to be working quite right. Do I need to manually add a ConsoleListener or something (boy, would that be tedious with one TraceSource per class...)?

+2  A: 

The MSDN documentation states:

A DefaultTraceListener emits Write and WriteLine messages to the OutputDebugString and to the Debugger.Log method. In Visual Studio, this causes the debugging messages to appear in the Output window. Fail and failed Assert messages also emit to the OutputDebugString Windows API and the Debugger.Log method, and also cause a message box to be displayed. This behavior is the default behavior for Debug and Trace messages, because DefaultTraceListener is automatically included in every Listeners collection and is the only listener automatically included. (emphasis mine)

I haven't used TestDrivent.NET so I wouldn't know why the trace output isn't appearing in your Output window, but you might be able to use DbgView to view your output since it collects output written by OutputDebugString.

Emanuel