Legacy Documentation. View NUnit 3 Documentation

Assembly Isolation

NUnit isolates test assemblies from its own code and from one another by use of separate AppDomains and/or Processes.

By default, NUnit loads a test assembly into a separate AppDomain, while its own code runs in the primary AppDomain.

When multiple assemblies are run at the same time, NUnit loads them differently depending on how they were specified. For assemblies that are part of an NUnit project, then a single AppDomain is used. If the assemblies were specified on the console runner command line, then a separate AppDomain is used for each of them.

If greater separation is desired, test assemblies may be loaded into a separate Process or into multiple processes. This is done automatically by NUnit in the case where the tests are to be run under a different runtime from the one that NUnit is currently using. Tests running in a separate process are executed under the control of the nunit-agent program.

Controlling Isolation

Beyond the NUnit default behavior, the user may control the level of isolation through the command line or through NUnit's general settings. Process and AppDomain isolation may also be specified as part of the settings of an NUnit project.

Command Line

Assembly Isolation may be specified on the console runner commandline using the /process and /domain options. See NUnit-Console Command Line Options for more information.

General Settings

The built-in NUnit defaults may be overridden using the Assembly Isolation panel of the NUnit Settings Dialog. Settings made here are saved and become the new default values for all executions of NUnit until changed. For more info, see the Settings Dialog page.

Project Settings

Isolation settings may be specified for an individual NUnit project using the Project Editor.