NUnit-Console

The nunit-console.exe program is a text-based runner and can be used when you want to run all your tests and don’t need a red/yellow/green indication of success or failure.

It is useful for automation of tests and integration into other systems. It automatically saves its results in XML format, allowing you to produce reports or otherwise process the results. The following is a screenshot of the console program.

In this example, nunit-console has just run the tests in the mock-assembly.dll that is part of the NUnit distribution. This assembly contains a number of tests, some of which are either ignored or marked explicit. The summary line shows the result of the test run. Click here to see the XML produced for this test run.

NUnit-Console Return Codes

Beginning with version 2.4.3, the nunit-console program returns negative values for any program errors. A zero return code indicates that there were no errors and that all tests passed. A positive return code represents the number of test errors or failures.

0OKRun completed with all tests passing
> 0FAILURE_COUNTRun completed with one or more test failures
-1INVALID_ARGAn invalid argument was passed to nunit-console
-2FILE_NOT_FOUNDA file specified in the command line was not found
-3FIXTURE_NOT_FOUNDA fixture specified in the command line was not found

X86 Version

The .NET 2.0 version of the nunit-console program is built using /platform:anycpu, which causes it to be jit-compiled to 32-bit code on a 32-bit system and 64-bit code on a 64 bit system. This causes an exception when NUnit is used to test a 32-bit application on a 64-bit system. To avoid this problem, use the nunit-console-x86 program, which is built using /platform:x86, when testing 32-bit code on a 64-bit system.