Legacy Documentation. View NUnit 3 Documentation

RequiredAddinAttribute (NUnit 2.5)

The RequiredAddin attribute is used to indicate that an assembly requires a particular addin in order to function correctly. If that addin is not installed, the entire assembly is marked as non-runnable.

Note: In the Alpha-3 release, this attribute may be applied to classes or methods as well. This is of limited utility, for two reasons:

  1. If the method or class is not recognized as a test, due to the addin being missing, then NUnit will never process it.
  2. If the method or class is handled by some a different addin, that addin may not recognize the attribute.

The attribute will be limited to assemblies only in the next release.

Example

[assembly: RequiredAddin("MyTestFixtureAddin")]
[assembly: RequiredAddin("MyTestAddin")]
[assembly: RequiredAddin("MyDecoratorAddin")]

...

namespace NUnit.Tests
{
  using System;
  using NUnit.Framework;

  [MyTestFixture]
  public class MyTests
  {
    [MyTest]
	public void SomeTest()
	{
	  ...
	}
  }

  [TestFixture, MyDecorator]
  public class MoreTests
  {
    [Test, MyDecorator]
	public void AnotherTest()
	{
	  ...
	}
  }
}