如何从命令行的 nunit-console 运行 nunit 2 测试?

How do I run nunit 2 tests from nunit-console from the command line?

我已经从 https://github.com/nunit/nunit-console 构建了 nunit-console 和来自 https://github.com/nunit/nunit-v2-framework-driver referencing nunit-2.7 assemblies from https://github.com/nunit-legacy/nunitv2/releases/download/2.7.0/NUnit-2.7.0-src.zip

的 nunit-v2-framework-driver

我正在为我构建的每个程序集直接从命令行显式调用单编译器 mcs(这样我就知道幕后发生了什么)。生成的 nunit-console 程序集可以 运行 按预期进行 nunit v3 测试。

我有一个包含大量 nunit 2 测试的旧项目,我知道 nunit-v2-framework-driver 可用于 运行 使用 nunit-console 进行 nunit 2 测试。

不过我不确定该怎么做 - 如何让 nunit-console 获取 nunit-v2-framework-driver 扩展?引用程序集似乎还不够。

如果您从源代码构建,则需要添加一个 .addins 文件,以将引擎指向您拥有扩展程序的位置。

.addins 文件应该位于 nunit.engine.dll 程序集旁边,并且只包含到 nunit.v2.driver.addins 的路径——它应该包含在您的 nunit-v2-framework-driver 构建中. (或者,直接指向 nunit.v2.driver.dll 的路径)

作为外观示例,您可能需要从 GitHub 发布页面下载 NUnit.Console-3.9.0.zip 中打包的控制台,然后查看 nunit.bundle.addins文件及其周围的文件结构。