Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; MenuItem has a deprecated constructor in /home/charl422/nunitsoftware.com/nunitv2/php/build_menu.php on line 34
NUnit - Compatibility
NUnit 2.6.7 Legacy Documentation. View NUnit 3 Documentation

NUnit 3 Compatibility Report

The /compatibility option of the console runner causes a compatibility report to be produced, which identifies potential compatibility issues when converting to NUnit 3. The report identifies issues in the command-line and in the test code itself.

Corrective actions to take to resolve each issue are prefixed by the minimum version of NUnit in which the action is possible. For example, actions marked 3.0: can only be taken after upgrading to NUnit 3, while those marked 2.6.5: are available under NUnit 2.6.5. Actions marked 2.x> are available in any version of NUnit V2.

Starting with release 2.6.7 of the console runner, it is possible to use the compatibility option with tests that reference older versions of NUnit V2. Some problems, however, will not be detected in this situation. For each type of issue, below, we indicate whether a specific framework version is needed in order to detect it.

Command-line Issues

These issues are detected for all 2.x framework versions.
OptionLevelNUnit 3 IssueAction
/processWarningDefaults to Multiple3.0: Allow to default or select option.
/domainWarningDefaults to Multiple3.0: Allow to default or select option.
/fixtureErrorNot available2.6.5: Use --test option.
3.0: Use --where option.
/runErrorNot available2.6.5: Use --test option.
3.0: Use --where option.
/runlistErrorNot available2.6.5: Use --testlist.
/includeErrorNot available3.0: Use --where.
/excludeErrorNot available3.0: Use --where.
/apartmentErrorNot available2.6.5: Use the ApartmentAttribute instead.
/xmlErrorNot available2.6.5: Use --result.
/noxmlErrorNot available2.6.5: Use --noresult.
/xmlConsoleErrorNot available2.X: Remove.
/basepathErrorNot available2.X: Remove.
/privatebinpathErrorNot available2.X: Remove.
/cleanupWarningNot available2.X: Remove - not needed.
/nodotsWarningNot available2.X: Remove - not needed.

Issues in the Test Code

Attributes

These issues are detected for all 2.x framework versions.
NameLevelNUnit 3 IssueAction
ExpectedExceptionAttributeErrorNot available.2.X: Use Assert.Throws or Assert.That(..., Throws...).
IgnoreAttributeErrorMust have a reason specified.2.X: Specify a reason.
NUnitAddinAttributeErrorNot available. Addins are no longer suppported.3.0: Use custom attributes or engine extensions.
RequiredAddinAttributeError
RequiresMTAAttributeErrorNot available.2.6.5: Use ApartmentAttribute.
RequiresSTAAttributeError
SetUpAttributeErrorNo longer allowed in a SetUpFixture.2.6.5: Use OneTimeSetUpAttribute.
SuiteAttributeErrorNot available.2.X: Restructure tests to eliminate legacy Suites.
TearDownAttributeErrorNo longer allowed in a SetUpFixture2.6.5: Use OneTimeTearDownAttribute.
TestCaseAttributeErrorNo longer supports ExpectedException.2.X: Use Assert.Throws or Assert.That(..., Throws...).
TestCaseAttributeErrorNo longer supports Result property.2.6.5: Use ExpectedResult.
TestCaseAttributeErrorIgnore property changes from bool to string.3.0: Specify reason as value.
TestCaseSourceAttributeErrorMust reference a static member.2.6.5: Use a static field, property or method.
TestCaseSourceAttributeErrorNo longer supports ExpectedException.2.X: Use Assert.Throws or Assert.That(..., Throws...).
TestCaseSourceAttributeErrorIgnored case requires a reason.2.X: Specify a reason.
TestFixtureAttributeErrorIgnore property changes from bool to string.3.0: Specify reason as value.
TestFixtureSetUpAttributeErrorNot available.2.6.5: Use OneTimeSetUpAttribute.
TestFixtureTearDownAttributeErrorNot available.2.6.5: Use OneTimeTearDownAttribute.
ValueSourceAttributeErrorMust reference a static member.2.X: Use a static field, property or method.
System.MTAThreadWarningHas no effect.2.6.5: Use ApartmentAttribute.
System.STAThreadWarningHas no effect.2.6.5: Use ApartmentAttribute.

Assertions and Constraints

These issues are only detected for versions 2.6.5 and later of the framework.
FeatureLevelNUnit 3 IssueAction
Assert.IsNullOrEmptyErrorNot available.2.X: Use Assert.That(..., Is.Null.Or.Empty).
Assert.IsNotNullOrEmptyErrorNot available.2.X: Use Assert.That(..., Is.Not.Null.Or.Empty).
AssertionNelperErrorNot available.2.X: Use standard constraint syntax or consider third-party NUnit.StaticExpect package.
Is.InstanceOfTypeErrorNot available.2.X: Use Is.InstanceOf.
Is.StringContainingErrorNot available.2.6.5: Use Does.Contain.
Is.StringStartingErrorNot available.2.6.5: Use Does.StartWith.
Is.StringEndingErrorNot available.2.6.5: Use Does.EndWith.
Is.StringMatchingErrorNot available.2.6.5: Use Does.Match.
NullOrEmptyStringConstraintErrorNot available.2.X: Use separate constraints or see Assert.IsNullOrEmpty above
Text.AllErrorNot available.2.X: Use Is.All or Has.All.
Text.ContainsErrorNot available.2.6.5: Use Does.Contain.
Text.DoesNotContainErrorNot available.2.6.5: >Use Does.Not.Contain.
Text.StartsWithErrorNot available.2.6.5: Use Does.StartWith.
Text.DoesNotStartWithErrorNot available.2.6.5: Use Does.Not.StartWith.
Text.EndsWithErrorNot available.2.6.5: Use Does.EndWith.
Text.DoesNotEndWithErrorNot available.2.6.5: Use Does.Not.EndWith.
Text.MatchesErrorNot available.2.6.5: Use Does.Match.
Text.DoesNotMatchErrorNot available.2.6.5: Use Does.Not.Match.

Other Issues

These issues are detected for all 2.x versions that support async.
FeatureLevelNUnit 3 IssueAction
Async tests returning voidErrorNot available.2.x: Return Task.