Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"?

like image 549
MedicineMan Avatar asked May 07 '09 01:05

MedicineMan


1 Answers

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

like image 132
Andy White Avatar answered Oct 18 '22 05:10

Andy White