Legacy Documentation. View NUnit 3 Documentation

Configuration Files

NUnit uses configuration files for the test runner executable - either nunit-console.exe or nunitgui.exe - as well as for the tests being run. Only settings that pertain to NUnit itself should be in the nunit-console.exe.config and nunit-gui.exe.config, while those that pertain to your own application and tests should be in a separate configuration file.

NUnit Configuration Files

One main purpose of the nunit-console and nunit-gui config files is to allow NUnit to run with various versions of the .NET framework. NUnit 2.2 is built using version 1.1 of the framework, but can be made to run against version 1.0 or 2.0. As delivered, the section of each config file is commented out, causing the applications to run with the .NET 1.1. If you uncomment the section, the entries there control the order in which alternate framework versions are selected. The delivered config files use this order: 2.0, 1.1, 1.0. If you prefer a different order, you can change the order of the entries.

Test Configuration File

When a configuration file is used to provide settings or to control the environment in which a test is run, specific naming conventions must be followed.

If a single assembly is being loaded, then the configuration file is given the name of the assembly file with the config extension. For example, the configuration file used to run nunit.tests.dll must be named nunit.tests.dll.config and located in the same directory as the dll.

If an NUnit project is being loaded, the configuration file uses the name of the project file with the extension changed to config. For example, the project AllTests.nunit would require a configuration file named AllTests.config, located in the same directory as AllTests.nunit. The same rule is followed when loading Visual Studio projects or solutions.

Generally, you should be able to simply copy your application config file and rename it as described above. However, see the next section if you wish to run tests compiled for an earlier version of NUnit.