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
The 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 config file selects the first installed version of .NET it finds in this order: 1.1, 2.0, 1.0. You should edit the config files if you prefer a different order. Your tests will run using the same version of the framework that is used to run NUnit itself.
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.
NUnit 2.0 or 2.1 Tests Under NUnit 2.2
To run NUnit tests built against the NUnit 2.0 or 2.1 framework without recompiling them, you
must modify your test configuration file to cause the tests to use version 2.2 of the framework dll.
The files nunit20under22.config
and nunit21under22.config
are provided as templates for
this purpose. They are located in the src directory.