NUnit Gui Runner 中的每个选项卡的用途是什么?

发布于 2024-07-19 15:48:30 字数 381 浏览 9 评论 0原文

NUnit 测试运行程序中有六个选项卡:

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

我知道错误和失败的用途,但其余选项卡的用途令人困惑。 Console.OutTrace 似乎都有类似的用途。

正如评论所指出的,我写了一个类似的问题,询问如何写入所有选项卡。 在这个问题中,我问为什么要写入每个选项卡? 为什么要写入Console.OutTraceLog选项卡? 每个选项卡的预期用途是什么?

There are six tabs in the NUnit Test runner:

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.

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? What is the intended purpose of each tab?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

拥抱我好吗 2024-07-26 15:48:30

“未运行的测试”选项卡显示跳过的测试。 这些是定义了 Ignore() 属性的测试。 如果您想要暂时禁用已知暂时无效的测试,或者定期运行太耗时的测试,这非常有用。

其余选项卡均包含在您的其他问题中:

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

Console.Out 将数据写入 stdout。

Console.Error 将数据写入 stderr。

Trace 将数据写入 Trace Ojbect

Log4Net 写入“各种日志目标”。

所有这些的目的都是相同的:深入了解代码运行时正在执行的操作,而无需使用断点和调试器。 您使用哪一种取决于您的要求:控制台方法生成用户可见的输出。 跟踪很容易显示/隐藏(并且包含大量额外信息),但似乎没有任何类型的持久性支持。 日志记录可以是永久性的,但需要维护日志文件的开销。

The Tests Not Run tab displays tests which were skipped. These are tests which have the Ignore() attribute defined. 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.Error -> Console.Error.WriteLine()
  • Trace -> System.Diagnostics.Trace.WriteLine()
  • Log -> log4net output

Console.Out writes data to stdout.

Console.Error writes data to stderr.

Trace writes data to the Trace Ojbect .

Log4Net writes to a "variety of log targets."

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. 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.

彡翼 2024-07-26 15:48:30

我希望在编写或调试测试时使用 Console.Out,而 Trace 将用于显示被测代码的跟踪输出。 代码中的跟踪输出可以使用 Trace.WriteIf 等进行条件化,并通过配置文件中的开关定义打开。

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. Trace output in your code can be conditional using Trace.WriteIf etc and turned on by switch definitions in your config file.

风筝在阴天搁浅。 2024-07-26 15:48:30
  • Console.Out = 测试代码的输出(例如转储被测试方法返回的对象的内容)。

  • Console.Error = 测试代码检测到的错误的输出详细信息

  • Trace = 正在测试的代码的诊断跟踪。

  • Console.Out = output from your test code (e.g. dump contents of objects returned by methods being tested).

  • Console.Error = output details of errors detected by your test code

  • Trace = diagnostics tracing from the code being tested.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文