Skip to content

Console Command Line

Charlie Poole edited this page Jan 31, 2016 · 30 revisions

The console interface runner is invoked by a command in the form

    NUNIT3-CONSOLE [inputfiles] [options]

where inputfiles is one or more assemblies or test projects of a type that NUnit can process and options is zero or more options. Input files and options may be mixed in any order.

Input Files

The console program must always have an assembly or project specified. Assemblies are specified by file name or path, which may be absolute or relative. Relative paths are interpreted based on the current directory.

In addition to assemblies, you may specify any project type that is understood by NUnit. Out of the box, this includes various Visual Studio project types as well as NUnit (.nunit) projects.

If the NUnit V2 framework driver is installed, test assemblies may be run based on any version of the NUnit framework beginning with 2.0. Without the V2 driver, only version 3.0 and higher tests may be run.

Options

--test=NAMES Comma-separated list of NAMES of tests to run or explore. This option may be repeated. Note that this option is retained for backward compatibility. The --where option can now be used instead.
--testlist=FILE The name (or path) of a FILE containing a list of tests to run or explore, one per line.
--where=EXPRESSION An expression indicating which tests to run. It may specify test names, classes, methods, catgories or properties comparing them to actual values with the operators ==, !=, =~ and !~. See Test Selection Language for a full description of the syntax.
--config=NAME NAME of a project configuration to load (e.g.: Debug).
--process=PROCESS PROCESS isolation for test assemblies. Values: Single, Separate, Multiple. If not specified, defaults to Separate for a single assembly or Multiple for more than one. By default, processes are run in parallel.
--inprocess This option is a synonym for --process=Single
--agents=NUMBER NUMBER of agents that may be allowed to run simultaneously assuming you are not running inprocess. If not specified, all agent processes run tests at the same time, whatever the number of assemblies. This setting is used to control running your assemblies in parallel.
--domain=DOMAIN DOMAIN isolation for test assemblies. Values: None, Single, Multiple. If not specified, defaults to Separate for a single assembly or Multiple for more than one.
--framework=FRAMEWORK FRAMEWORK type/version to use for tests. Examples: mono, net-4.5, v4.0, 2.0, mono-4.0
--x86 Run tests in a 32-bit process on 64-bit systems.
--dispose-runners Dispose each test runner after it has finished running its tests
--timeout=MILLISECONDS Set timeout for each test case in MILLISECONDS.
--seed=SEED Set the random SEED used to generate test cases.
--workers=NUMBER Specify the NUMBER of worker threads to be used in running tests. This setting is used to control running your tests in parallel and is used in conjunction with the Parallelizable Attribute. If not specified, workers defaults to the number of processors on the machine, or 2, whichever is greater.
--stoponerror Stop run immediately upon any test failure or error.
--debug Causes NUnit to break into the debugger immediately before it executes your tests. This is particularly useful when the tests are running in a separate process to which you would otherwise have to attach.
--debug-agent Available only in debug builds of NUnit, this option is for use by developers in debugging the nunit-agent itself. It breaks in the agent code immediately upon entry of the process.
--wait Wait for input before closing console window.
--work=PATH PATH of the directory to use for output files.
--output, --out=PATH File PATH to contain text output from the tests.
--err=PATH File PATH to contain error output from the tests.
--result=SPEC An output SPEC for saving the test results. This option may be repeated.
--explore[=SPEC] Display or save test info rather than running tests. Optionally provide an output SPEC for saving the test info. This option may be repeated.
--noresult Don't save any test results.
--labels=VALUE Specify whether to write test case names to the output. Values: Off, On, All
--trace=LEVEL Set internal trace LEVEL. Values: Off, Error, Warning, Info, Verbose (Debug)
--shadowcopy Tells .NET to copy loaded assemblies to the shadowcopy directory.
--teamcity Turns on use of TeamCity service messages.
--noheader, --noh Suppress display of program information at start of run.
--nocolor, --noc Displays console output without color.
--verbose, -v Display additional information as the test runs.
--help, -h Display this message and exit.

Description

By default, this command runs the tests contained in the assemblies and projects specified. If the --explore option is used, no tests are executed but a description of the tests is saved in the specified or default format.

Several options that specify processing of XML output take an output specification as a value. A SPEC may take one of the following forms:

  • --OPTION:filename
  • --OPTION:filename;format=formatname
  • --OPTION:filename;transform=xsltfile

The --result option may use any of the following formats:

  • nunit3 - the native XML format for NUnit 3.0
  • nunit2 - legacy XML format used by earlier releases of NUnit

The --explore option may use any of the following formats:

  • nunit3 - the native XML format for NUnit 3.0
  • cases - a text file listing the full names of all test cases.

If --explore is used without any specification following, a list of test cases is output to the console.

If neither --result nor --explore is used, NUnit saves the results to TestResult.xml in nunit3 format.

Any transforms provided must handle input in the native nunit3 format.

Clone this wiki locally