简体   繁体   English

NUnit Gui Runner中的每个选项卡应该用于什么?

[英]What is each tab in the NUnit Gui Runner supposed to be for?

There are six tabs in the NUnit Test runner: NUnit测试运行器中有六个选项卡:

Errors and Failures
Tests Not Run
Console.Out
Console.Error
Trace
Log

I know what Errors and Failures are for but the purpose of the remaining tabs is confusing. 我知道错误和失败的含义是什么,但是其余选项卡的用途令人困惑。 Both Console.Out and Trace appear to serve a similar purpose. Console.OutTrace似乎都起到了类似的作用。

As a comment has pointed out, I have written a similar question asking how does one write to all of the tabs. 正如评论所指出的那样,我写了一个类似的问题,问一个人如何写所有选项卡。 In this question, I am asking why does one write to each of the tabs? 在这个问题中,我想问为什么每个选项卡都写一个? Why does one write to the Console.Out vs the Trace vs the Log tab? 为什么要向Console.OutTraceLog选项卡写入内容? What is the intended purpose of each tab? 什么是每个选项卡的预期目的?

The Tests Not Run tab displays tests which were skipped. “未运行的测试”选项卡显示已跳过的测试。 These are tests which have the Ignore() attribute defined. 这些是定义了Ignore()属性的测试。 This is useful if you want to temporarily disable a test that is known to be temporarily invalid, or that is too time consuming to run on a regular basis. 如果您要暂时禁用已知暂时无效的测试,或者要花费大量时间无法定期运行,则这很有用。

The remaining tabs are all covered in your other question: 其余选项卡全部包含在您的其他问题中:

  • Console.Out -> Console.WriteLine() Console.Out-> Console.WriteLine()
  • Console.Error -> Console.Error.WriteLine() Console.Error-> Console.Error.WriteLine()
  • Trace -> System.Diagnostics.Trace.WriteLine() 跟踪-> System.Diagnostics.Trace.WriteLine()
  • Log -> log4net output 日志-> log4net输出

Console.Out writes data to stdout. Console.Out将数据写入stdout。

Console.Error writes data to stderr. Console.Error将数据写入stderr。

Trace writes data to the Trace Ojbect . 跟踪将数据写入“ 跟踪对象”

Log4Net writes to a "variety of log targets." Log4Net写入“各种日志目标”。

The purpose of all of these is the same: to obtain insight into what your code is doing as it runs, without using breakpoints and a debugger. 所有这些目的都是相同的:无需使用断点和调试器即可洞悉代码在运行时的工作方式。 Which one you use depends on your requirements: The Console methods produce user-visible output. 您使用哪一种取决于您的要求:Console方法产生用户可见的输出。 Trace is easy to show/hide (and includes quite a lot of extra information), but doesn't appear to have any kind of persistence backing it. 跟踪很容易显示/隐藏(并包含很多额外的信息),但似乎没有任何持久性支持。 Logging can be permanent, but requires the overhead of maintaining the log file. 日志记录可以是永久性的,但是需要维护日志文件的开销。

I would expect Console.Out to be used when writing or debugging your tests, whereas Trace would be used to display trace output from the code under test. 我希望在编写或调试测试时使用Console.Out,而使用Trace将显示被测代码的跟踪输出。 Trace output in your code can be conditional using Trace.WriteIf etc and turned on by switch definitions in your config file. 您的代码中的跟踪输出可以使用Trace.WriteIf等作为条件,并可以通过配置文件中的开关定义打开。

  • Console.Out = output from your test code (eg dump contents of objects returned by methods being tested). Console.Out =测试代码的输出(例如,转储被测试方法返回的对象的内容)。

  • Console.Error = output details of errors detected by your test code Console.Error =输出测试代码检测到的错误的详细信息

  • Trace = diagnostics tracing from the code being tested. 跟踪=从正在测试的代码进行诊断跟踪。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM