Compatibility

This section describes how to run tests created in older versions of NUnit using NUnit 2.2 and highlights the most significant changes made in the last two releases of NUnit.

Using NUnit 2.1 Tests with NUnit 2.2

To run NUnit 2.1 tests with NUnit 2.2, recompile the tests using the NUnit 2.2 nunit.framework assembly. You might also need to add a reference to the nunit.core assembly if you are using core types.

Using NUnit 2.0 Tests with NUnit 2.2

There are two options for running NUnit 2.0 tests with NUnit 2.2. The first option is to upgrade the 2.0 tests and recompile the test assemblies using the new nunit.framework assembly.

Tip

The NUnit 2.2 documentation states that the Assertion class is deprecated and marked obsolete. Although not necessary, you might want to convert all assertions to use the new Assert class to ensure compatibility with future versions of NUnit.

The second option allows you to run NUnit 2.0 tests with NUnit 2.2 without changing the NUnit 2.0 tests. Create the appropriate binding redirect in the test runner configuration file (nunit-gui.exe.config or nunit-console.exe.config). The nunit20under21.config file in the src subdirectory of the NUnit 2.2 installation directory has the required redirect in the bindingRedirect element and can be used as is or as a template.

Upgrading from NUnit 1.x to 2.2

You cannot run NUnit 1.x tests using NUnit 2.2—the only option is to upgrade the Version 1.x tests. The following points outline the changes you must make to ...

Get NUnit Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.