Legacy Documentation. View NUnit 3 Documentation

NUnit-Gui Command Line Options

The forms interface may be run with or without the name of a file containing tests on the command line. If the program is started without any file specified, it automatically loads the most recently loaded assembly.

Note: Options that take values may use an equal sign, a colon or a space to separate the option from its value.

Run without loading an Assembly

To suppress loading of the most recent assembly, use the /noload switch:

        nunit-gui /noload

Specifying an Assembly

The other option is to specify an assembly or project file name on the command line. The following will start the forms interface with the assembly nunit.tests.dll:

        nunit-gui nunit.tests.dll

The following will start the forms interface loading the same assembly through its Visual Studio project definition:

        nunit-gui nunit.tests.csproj

Assuming an NUnit test project has been created containing the assembly, the following will again load nunit.tests.dll:

        nunit-gui nunit.tests.nunit

Specifying an Assembly and a Fixture

When specifying a a fixture, you must give the full name of the test fixture along with the containing assembly. For example, to load only the NUnit.Tests.AssertionTests in the nunit.tests.dll assembly use the following command:

        nunit-gui /fixture:NUnit.Tests.AssertionTests nunit.tests.dll

The name specified after the /fixture option may be that of a TestFixture class, or a namespace. If a namespace is given, then all fixtures under that namespace are loaded. This option may be used with Visual Studio or NUnit projects as well.

Specifying the Version of the CLR

Most applications are written to run under a specific version of the CLR. A few are designed to operate correctly under multiple versions. In either case, it is important to be able to specify the CLR version to be used for testing.

When only one version of the CLR is used, the config files for nunit-gui and nunit-console may be set up to specify that version. As a more convenient alternative when switching CLRs, you may use the provided clr.bat command to specify the version under which NUnit should run.

For example, to run the gui under the RTM version of the .Net 2.0 framework, use:

       clr net-2.0 nunit-gui

The clr.bat file is located in the NUnit bin directory. You may put this on your path, or copy it to a convenient location. Enter clr /? for a list of options.

Note: If you use a <startup> section in the config file, it takes precedence over this option.

Note: This command is specific to the Microsoft .Net framework. The Mono framework provides other means to specify the version to be used when running a command and the NUnit Windows interface does not currently run under Mono.

Load and Run Tests

Normally, nunit-gui only loads an assembly and then waits for the user to click on the Run button. If you wish to have the tests run immediately, use the /run option:
        nunit-gui nunit.tests.dll /run

Specifying which Configuration to Load

When loading a Visual Studio project or an NUnit project, the first configuration found will be loaded by default. Usually this is Debug. The configuration loaded may be controlled using the /config switch. The following will load the Release configuration of the nunit.tests.dll:

        nunit-gui nunit.tests.csproj /config:Release

Note: This option has no effect when loading an assembly directly.

Specifying Multiple Assemblies

The forms interface does not currently provide for specifying more than one assembly on the command line. Multiple-assembly projects must be loaded by specifying the name of a Visual Studio solution file or an NUnit test project.

Displaying Help

The /help or /? option displays a message box containing a brief help message.