Test Runner Console

The test runner console is text-based and not interactive. It is most useful in automated testing environments where you use an automated build tool, such as NAnt, to run NUnit tests automatically as part of the build cycle.

The test runner console has a number of options in addition to those available in the test runner GUI. The console interface outputs test results to an XML file. By default, the file is named TestResult.xml and is placed in the working directory. This XML file is overwritten without warning if it already exists. The schema and contents of the file are described earlier in "Results in XML format."

To use the test runner console, add the directory for nunit-console.exe (the default directory is c:\Program Files\NUnit V2.2\bin) to the environment path by selecting Control Panel→System, selecting the Advanced tab, and clicking the Environment Variables button. Append the directory containing nunit-console.exe to either the user or system path. Separate the path from any other entries with a semicolon.

Test an assembly by specifying its name on the command line:

nunit-console.exe NUnitPocketReference.dll

The output includes:

  • Output that you have directed to the console in the tests. This output is the same as that sent to the Console.Out window in the test runner GUI.

  • Statistics about the tests run including the number of successes, failures, tests not run, and the time it took to run the tests.

  • A list of tests that failed.

  • A list of tests that were ignored. ...

Get NUnit Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.