如何写入NUnit gui runner的Log选项卡和Console.Error选项卡
在NUnit Gui Runner中,有6个选项卡。 我可以写入Console.Out写一些类似于:
Console.WriteLine("This will end up in the Console.Out");
我可以通过写下以下内容来写入Trace选项卡:
System.Diagnostics.Trace.WriteLine("This will end up on the Trace tab");
但是如何写入其他两个选项卡“Log”和“Console.Error”?
要写入Console.Error,请执行以下操作:
Console.Error.WriteLine( “嗒嗒”);
要写入日志,您需要在测试项目中配置log4net,然后在项目的.exe.config文件中设置log4net appender。 使用log4net设置NUnit实际上有点棘手,这里有一个入门指南:
http://www.softwarefrontier.com/2007/09/using-log4net-with-nunit.html