你怎么写的NUnit的GUI亚军的日志选项卡并Console.Error标签 [英] How do you write to the Log tab and Console.Error tab of the NUnit gui runner
问题描述
在NUnit的桂亚军,有6个选项卡。我可以写类似写Console.Out:
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");
但我怎么写其他两个选项卡,日志和Console.Error?
But how do I write to the two other tabs, "Log" and "Console.Error"?
推荐答案
要写信给Console.Error,你这样做:
To write to Console.Error, you do this:
Console.Error.WriteLine(嗒嗒);
Console.Error.WriteLine("blah");
要写入日志,你需要配置log4net的在您的测试项目中,为您的项目.exe.config文件与再设置一个log4net的附加目的地。 NUnit的其实是一个有点棘手设置与log4net的,这里有一个小导游开始:
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:
<一个href="http://www.softwarefrontier.com/2007/09/using-log4net-with-nunit.html">http://www.softwarefrontier.com/2007/09/using-log4net-with-nunit.html
这篇关于你怎么写的NUnit的GUI亚军的日志选项卡并Console.Error标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!