简体   繁体   English

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

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

I have built nunit-console from https://github.com/nunit/nunit-console and nunit-v2-framework-driver from 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 我从https://github.com/nunit/nunit-console和nunit-v2-framework-driver构建了nunit-console,来自https://github.com/nunit/nunit-v2-framework-driver引用nunit-2.7来自https://github.com/nunit-legacy/nunitv2/releases/download/2.7.0/NUnit-2.7.0-src.zip的程序集

I am invoking the mono compiler mcs explicitly, directly from the command line, for each assembly that I build (so that I know what's going on under the hood). 我直接从命令行为我构建的每个程序集显式调用单声道编译器mcs (这样我就知道幕后发生了什么)。 The nunit-console assembly produced can run nunit v3 tests as expected. 生成的nunit-console程序集可以按预期运行nunit v3测试。

I have an old project with lots of nunit 2 tests and understand that the nunit-v2-framework-driver can be used to run nunit 2 tests with nunit-console. 我有一个包含大量nunit 2测试的旧项目,并且了解nunit-v2-framework-driver可用于使用nunit-console运行nunit 2测试。

I'm not sure how to do this though - how can I get nunit-console to pick up the nunit-v2-framework-driver extension? 我不知道如何做到这一点 - 我如何让nunit-console拿起nunit-v2-framework-driver扩展? Referencing the assembly does not seem to be enough. 引用程序集似乎不够。

If you're building from source, you need to add a .addins file, to point the engine to where you have the extension located. 如果您是从源构建的,则需要添加.addins文件,以将引擎指向您具有扩展名的位置。

The .addins file should sit next to the nunit.engine.dll assembly, and just contain the path to nunit.v2.driver.addins - which should be included with your nunit-v2-framework-driver build. .addins文件应该位于nunit.engine.dll程序集旁边,并且只包含nunit.v2.driver.addins的路径 - 这应该包含在您的nunit-v2-framework-driver构建中。 (Or alternatively, a path to nunit.v2.driver.dll directly) (或者,直接通往nunit.v2.driver.dll的路径)

As an example of how this should look, you might want to download the Console as packaged in NUnit.Console-3.9.0.zip from the GitHub releases page, and take a look at the nunit.bundle.addins file, and the file structure around it. 作为一个示例,您可能希望从GitHub版本页面下载NUnit.Console-3.9.0.zip打包的控制台,并查看nunit.bundle.addins文件和文件周围的结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM