c# - 如何在 Windows 上安装 NUnit 3 控制台并运行测试?

标签 c# unit-testing nunit nunit-3.0 nunit-console

我想从这样的控制台运行测试(在任何目录中,DLL 文件可以用于不同的 .NET 版本):

$ nunit3-console test.dll

我在谷歌上搜索了很多,但找不到如何设置它。

官方教程没有任何用处,完全为零。跟随它让我无处可去:https://github.com/nunit/docs/wiki/Installation

最佳答案

很难找到,因为有很多过时的文档,无论是针对 NUnit2 还是 NUnit3。

步骤:

  1. 官方 NUnit3 控制台安装程序在这里:https://github.com/nunit/nunit-console/releases (路径与文档中的不同)
  2. 下载NUnit.Console-*.msi包并安装
  3. 将此添加到系统 PATH 变量:C:\Program Files (x86)\NUnit.org\nunit-console
  4. 打开命令行
  5. 类型:

    $ nunit3-console test.dll

//要并行运行多个测试程序集,请参阅: https://stackoverflow.com/a/45486444/1453525

关于c# - 如何在 Windows 上安装 NUnit 3 控制台并运行测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45482507/

相关文章:

c# - Asp MVC 和 Web Api 异步 Controller

c# - contains 和 equal(==) 的区别

c# - 将以西里尔文命名的文件上传到 blob 容器

performance - 内存 H2 db 的单元测试变得非常慢

c# - 除了使测试更容易之外,封闭系统中的接口(interface)还带来什么优势?

visual-studio-2010 - nunit 锁定 dll

c# - 空异常错误数据表c#

ScalaTest - 根据输入/预期输出创建动态测试 (forAll)

c# - 使用 AutoFixture 中的 AutoMock 对构造函数中的响应式(Reactive)代码进行单元测试?

c# - 在不访问源代码的情况下覆盖 NUnit 中的 ToString