如何在Windows中安装NUnit 3控制台并运行测试?

one*_*run 20 c# nunit unit-testing nunit-console nunit-3.0

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

$ nunit3-console test.dll
Run Code Online (Sandbox Code Playgroud)

我google了很多,但找不到如何设置这个.官方教程没有任何用处,完全为零,跟随它让我无处可去:https://github.com/nunit/docs/wiki/Installation

one*_*run 26

很难找到,因为有很多过时的文档,无论是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

  • 不要忘记启动新的命令提示符等来获取新的环境路径变量 (2认同)