Legacy Documentation. View NUnit 3 Documentation

Installation

By default the NUnit installation program places all of the files into the C:\Program Files\NUnit 2.4.1 directory. In the installation directory there are three sub-directories: bin, doc, and samples. Source code is no longer provided with the binary installation package. Download the source package if source is needed.

Running NUnit

The installation program places a number of items in the Start menu. There are a number of shortcuts, which run the NUnit GUI under various versions of .NET or under Mono, depending on the versions available on your system at the time of installation.

Configuration

When running NUnit from the command line or through the desktop shortcut, the configuration files files nunit.exe.config and nunit-console.exe.config control which version of the CLR is used. As installed, the section of the config file is commented out and may be left that way unless problems arise. If uncommented, the order of precedence is .NET 2.0, .NET 1.1 and .NET 1.0. To change which version is used, simply change the order of the elements in the config files. The nunit About Box shows the version currently being used.

Settings that you place in these files are not available to your tests or to the production code you are testing. A separate config file is used when running tests. If you are running tests from the test.dll assembly, the config file should be named test.dll.config. If you are running tests from the NUnit test project MyTests.nunit, the config file should be named MyTests.config. In either case the config file must reside in the same directory as the file from which it takes its name.

In addition to settings of your own, the config file for a set of tests may contain information used by NUnit in loading your tests. In particular, this allows you to control the apartment state and priority of the thread that NUnit uses to run your tests. Other settings may be added in the future. See the file nunit.tests.dll for an example.

Installation Verification

Verify that the installation has worked successfully by running the NUnit gui and loading and running NUnitTests.nunit in the bin directory. All tests should pass.

Note: Although the NUnit installation has been modified to allow non-admin users to install, there are still a large number of tests which can only run successfully under an administrative id. This is a problem with the code in the tests themselves, not with NUnit.

Timing Tests

The assembly timing-tests.dll contains several long-running tests that are used to verify that all remoting timeout problems have been fixed. The test cases all run for six to 12 minutes and give no indication whatsoever that they are working! This is required since correct handling of a non-communicative user test is what these tests are all about.

Additional Tests

Additional tests are included with the samples and in separate assemblies used as data by the verification tests themselves. Failures or not run conditions in these tests are intentional.

Manual Installation

If you are building NUnit from source, it is recommended that you use the NAnt script for your final build, since it puts all the required files into one directory, from which you can easily copy them. Perform a manual installation by following these steps:

  1. Copy the following files to the target directory:
    • nunit.framework.dll
    • nunit.framework.extensions.dll
    • nunit.core.dll
    • nunit.core.interfaces.dll
    • nunit.core.extensions.dll
    • nunit.mocks.dll
    • nunit.uikit.dll
    • nunit.util.dll
    • nunit-console-runner.dll
    • nunit-console.exe
    • nunit-console.exe.config
    • nunit-gui-runner.dll
    • nunit.exe
    • nunit.exe.config
  2. Create shortcuts as needed.
  3. If you want to be able to run the nunit tests, copy the following files to the same location as the others, along with any additional config files for the dlls.
    • mock-assembly.dll
    • nonamespace-assembly.dll
    • notestfixtures-assembly.dll
    • nunit.core.tests.dll
    • nunit.extensions.tests.dll
    • nunit.framework.tests.dll
    • nunit.mocks.tests.dll
    • nunit.uikit.tests.dll
    • nunit.util.tests.dll
    • nunit-console.tests.dll
    • nunit-gui.tests.dll
    • nunit.testutilities.dll
    • test-assembly.dll
    • timing-tests.dll
    • NunitTests.nunit
    • NUnitTests.config

Installation Under Mono

Mono is delivered with a version of NUnit already pre-installed. The Mono 1.0 release included a beta version of NUnit 2.2. Later builds may include a more up-to-date version of NUnit. Before attempting to install NUnit under Mono, determine whether an equivalent or newer version is already installed. It may be necessary to remove the pre-installed version from the GAC in order for the new version to be recognized.