如何写入NUnit gui runner的Log选项卡和Console.Error选项卡

时间:2021-10-31 15:41:32

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

在NUnit Gui Runner中,有6个选项卡。我可以写入Console.Out写一些类似于:

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

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

我可以通过写下以下内容来写入Trace选项卡:

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

但是如何写入其他两个选项卡“Log”和“Console.Error”?

1 个解决方案

#1


24  

To write to Console.Error, you do this:

要写入Console.Error,请执行以下操作:

Console.Error.WriteLine("blah");

Console.Error.WriteLine( “嗒嗒”);

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:

要写入日志,您需要在测试项目中配置log4net,然后在项目的.exe.config文件中设置log4net appender。使用log4net设置NUnit实际上有点棘手,这里有一个入门指南:

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

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

#1


24  

To write to Console.Error, you do this:

要写入Console.Error,请执行以下操作:

Console.Error.WriteLine("blah");

Console.Error.WriteLine( “嗒嗒”);

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:

要写入日志,您需要在测试项目中配置log4net,然后在项目的.exe.config文件中设置log4net appender。使用log4net设置NUnit实际上有点棘手,这里有一个入门指南:

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

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