MSTest、NUnit、MbUnit、xUnit.NET 测试运行程序的标准输出

发布于 2024-07-14 15:34:02 字数 319 浏览 3 评论 0原文

在任何常见的 .NET 测试框架 MSTest、NUnit、MbUnit 或 xUnit.NET 中,如何让命令行测试运行程序输出简单的是/否、真/假或 1/0 来判断是否所有测试都已完成通过还是失败?

我愿意接受类似的解决方法:

  1. 如果所有测试都通过,则没有输出,如果有任何失败,则输出。
  2. 失败的测试计数。 我可以寻找零或非零值。
  3. 与 #1 或 #2 类似的其他内容

哪些框架提供这种功能?

我今天玩了一些 MSTest,但没有找到让 MSTest.exe 输出我可以使用的东西的方法。

How do you, in any of the common .NET testing frameworks MSTest, NUnit, MbUnit, or xUnit.NET, get the command line test runner to output a simple yes/no or true/false or 1/0 on whether all the tests passed or failed?

I'm open to workarounds like:

  1. No output if all the tests passed, output if anything fails.
  2. Count of tests that failed. I could look for zero or non-zero values.
  3. Other things similar to #1 or #2

Which of these frameworks provide this kind of capability?

I did some playing with MSTest today and didn't see a way to make MSTest.exe output something I could use.

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

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

发布评论

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

评论(3

那小子欠揍 2024-07-21 15:34:02

如果您愿意,它们都会输出 XML(尤其是 MSTest)。 您可以使用 XSLT,例如 我的版本 MS测试。

They all output XML if you want (especially MSTest). You can use XSLT like my version for MSTest.

薄荷梦 2024-07-21 15:34:02

查看 Gallio,这是 MbUnit 构建的框架和其他工具(测试运行器等) ,但这也处理输出 MSTest、NUnit、RSpec 等。

虽然这并不完全是您所要求的,但如果您使用 Gallio 测试运行程序的输出,那么您将获得对测试格式的免费支持 -它本质上是一个标准输出。

Have a look at Gallio, a framework and other tools (test runner, etc.) that MbUnit is built on, but that also handles the outputs MSTest, NUnit, RSpec, etc.

While that isn't exactly what you asked for, if you use the output from the Gallio test-runner, then you've got free support for the test formats - it's essentially a standard output.

最舍不得你 2024-07-21 15:34:02

MSTest 和大多数其他运行程序都会返回一个您可以检查的退出代码。

MSTest and most other runners return an exitcode you can check on.

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