Migrates your NUnit v2 project to v3 with the help of Roslyn analyzers.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build status Quality Gate Coverage Technical debt ratio

Have a project grounded in NUnit v2 and want v3?

So you have your unit tests project founded on NUnit v2 realm. And you are considering the upgrade. And yes, your are right - this means three kind of changes you are going to deal with:

  1. Straightforward ones - easy to do with some regex replace.
  2. Not so obvious ones - you will need to take a careful look to make the code compile.
  3. Really painful ones - even if the code compiles, some unit tests result in red.

Helping you with breaking changes

For vast majority of breaking changes introduced by v3 of the framework this utility reports warnings or errors, for some - equips you with code fixes. Here goes the example:

Migrating exceptions

More on how to perform migration with the help of this utility can be found on wiki.


See the following tables to see what is currently supported (based on https://github.com/nunit/docs/wiki/Breaking-Changes material).

  • 🔍 - detecting breaking changes (Roslyn analyzer)
  • 💡 - fixing breaking changes to v3 equivalent code (Roslyn code fix)
Development status
  • - released, the feature is there in place
  • 🔜 - the feature is planned to be developed soon
  • - there are no plans to develop the feature
Name Notes 🔍 💡
ExpectedExceptionAttribute No longer supported. Use Assert.Throws or Assert.That.
IgnoreAttribute The reason is now mandatory
RequiredAddinAttribute No longer supported.
RequiresMTAAttribute Deprecated. Use ApartmentAttribute
RequiresSTAAttribute Deprecated. Use ApartmentAttribute
SuiteAttribute No longer supported.
System.MTAThreadAttribute No longer treated as RequiresMTAAttribute
System.STAThreadAttribute No longer treated as RequiresSTAAttribute
TearDown and OneTimeTearDown There is a change to the logic by which teardown methods are called.
TestCaseAttribute Named parameter Result= is no longer supported. Use ExpectedResult=. Named parameter Ignore= now takes a string, giving the reason for ignoring the test.
TestCaseSourceAttribute The attribute forms using a string argument to refer to the data source must now use only static fields, properties or methods.
TestFixtureAttribute Named parameter Ignore= now takes a string, giving the reason for ignoring the test.
TestFixtureSetUpAttribute Deprecated. Use OneTimeSetUpAttribute.
TestFixtureTearDownAttribute Deprecated. Use OneTimeTearDownAttribute.
ValueSourceAttribute The source name of the data source must now use only static fields, properties or methods.
Assertions and Constraints
Feature Notes 🔍 💡
Assert.IsNullOrEmpty No longer supported. Use Assert.That(..., Is.Null.Or.Empty)
Assert.IsNotNullOrEmpty No longer supported. Use Assert.That(..., Is.Not.Null.And.Not.Empty)
Is.InstanceOfType No longer supported. Use Is.InstanceOf
Is.StringStarting Deprecated. Use Does.StartWith
Is.StringContaining Deprecated. Use Does.Contain
Is.StringEnding Deprecated. Use Does.EndWith
Is.StringMatching Deprecated. Use Does.Match
NullOrEmptyStringConstraint No longer supported. See Assert.IsNullOrEmpty above
SubDirectoryContainsConstraint No longer supported. Various alternatives are available.
Text.All No longer supported. Use Has.All or Is.All
Text.Contains No longer supported. Use Does.Contain or Contains.Substring
Text.DoesNotContain No longer supported. Use Does.Not.Contain
Text.StartsWith No longer supported. Use Does.StartWith
Text.DoesNotStartWith No longer supported. Use Does.Not.StartWith
Text.EndsWith No longer supported. Use Does.EndWith
Text.DoesNotEndWith No longer supported. Use Does.Not.EndWith
Text.Matches No longer supported. Use Does.Match
Text.DoesNotMatch No longer supported. Use Does.Not.Match
Other Framework Features
Feature Notes 🔍 💡
Addins No longer supported.
CurrentDirectory No longer set to the directory containing the test assembly. Use TestContext.CurrentContext.TestDirectory to locate that directory.
NUnitLite NUnitLite executable tests must now reference nunit.framework in addition to NUnitLite.
SetUpFixture Now uses OneTimeSetUpAttribute and OneTimeTearDownAttribute to designate higher-level setup and teardown methods. SetUpAttribute and TearDownAttribute are no longer allowed.
TestCaseData The Throws Named Property is no longer available. Use Assert.Throws or Assert.That in your test case.
TestContext The fields available in the TestContext have changed, although the same information remains available as for NUnit V2.


This is an early stage of project development, but it is open for contributions. To start with, submit your idea by creating an issue and let us discuss it together afterwards.


Copyright © 2017-2018 Marcin Wachulski


NUnit Migrator is licensed under MIT. See LICENSE for more information.