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 is built using versions 1.1 and 2.0 of the framework. The two builds are provided as separate downloads and either build can be made to run against other versions of the CLR.
As delivered, the
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 into a single AppDomain, 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.
Note: The above only applies if a single AppDomain is being used. If an NUnit project is loaded using a separate AppDomain for each assembly, then the individual configuration files for each of the assemblies are used.
Generally, you should be able to simply copy your application config file and rename it as described above.
In versions of NUnit prior to 2.6, it was possible to change the behavior of NUnit by adding special sections to the test config file. This feature is no longer supported.
The following recommendations are provided in the case of each of the settings that are no longer available:
NUnit no longer recognizes test methods without attributes.Use TestAttribute.
We recommend the use of RequiresSTAAttribute or RequiresMTAAttribute on those test cases, test fixtures or setup fixtures that require a particular apartment. As a temporary measure, the nunit-console -apartment option may be used.
This is no longer supported.
This is now controlled by a setting in the NUnit Gui runner.