MedicineMan
MedicineMan

Reputation: 15314

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

Upvotes: 19

Views: 14801

Answers (1)

Andy White
Andy White

Reputation: 88345

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

Upvotes: 24

Related Questions