Trace in NUnit works only while debugging from Visual Studio
I want to display tra开发者_运维问答ce info into Text Output tab in NUnit GUI (ver. 2.5.7, target runtime 4.0):
Trace.Listeners.Add(new ConsoleTraceListener());
Trace.WriteLine("Hello NUnit");
This works fine when I launch NUnit GUI from Visual Studio (2010) via Debug -> Start external application.
But when from .nunit project file and console runner - don't. Why??
I found not a solution but the reason.
I have MyProject.Test.dll
(contains tests itself) and MyProject.dll
(the target of tests).
When I use Trace.WriteLine()
in MyProject.dll
expecting appearance in NUnit it disappoints me and fails.
But when I use Trace.WriteLine()
exactly in MyProject.Test.dll
- it works. But this makes less sense because I need to trace the target itself to determine the reason of test fail without rewriting.
So will be happy to get know a solution to use trace in target and display it via test.
精彩评论