Legacy Documentation. View NUnit 3 Documentation

TestFixtureTearDownAttribute (NUnit 2.1)

This attribute is used inside a TestFixture to provide a single set of functions that are performed once after all tests are completed. A TestFixture can have only one TestFixtureTearDown method. If more than one is defined the TestFixture will compile successfully but its tests will not run.

Example:

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

  [TestFixture]
  public class SuccessTests
  {
    [TestFixtureSetUp] public void Init()
    { /* ... */ }

    [TestFixtureTearDown] public void Dispose()
    { /* ... */ }

    [Test] public void Add()
    { /* ... */ }
  }
}