Thursday, May 5, 2011

How do you write to the Log tab and Console.Error tab of the NUnit gui runner

In the NUnit Gui Runner, there are 6 tabs. I can write to the Console.Out by writing something like:

Console.WriteLine("This will end up in the Console.Out");

I can write to the Trace tab by writing something like:

System.Diagnostics.Trace.WriteLine("This will end up on the Trace tab");

But how do I write to the two other tabs, "Log" and "Console.Error"?

From stackoverflow
  • I believe to write to Console.Error, you do this:

    Console.Error.WriteLine("blah");

    To write to the Log, you need to configure log4net in your test project, then setup a log4net appender in the .exe.config file for your project. NUnit is actually a little tricky to setup with log4net, here's a little guide to get started:

    http://www.softwarefrontier.com/2007/09/using-log4net-with-nunit.html

0 comments:

Post a Comment