Search code examples
c#nunitnunit-console

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

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). The nunit-console assembly produced can run nunit v3 tests as expected.

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.

I'm not sure how to do this though - how can I get nunit-console to pick up the nunit-v2-framework-driver extension? Referencing the assembly does not seem to be enough.


Solution

  • If you're building from source, you need to add a .addins file, to point the engine to where you have the extension located.

    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. (Or alternatively, a path to nunit.v2.driver.dll directly)

    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.