Legacy Documentation. View NUnit 3 Documentation

Description (NUnit 2.4)

The Description attribute is used to apply descriptive text to a Test, TestFixture or Assembly. The text appears in the XML output file and is shown in the Test Properties dialog.

Example:

[assembly: Description("Assembly description here")]

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

  [TestFixture, Description("Fixture description here")]
  public class SomeTests
  {
    [Test, Description("Test description here")]
    public void OneTest()
    { /* ... */ }
  }
}
<assembly: Description("Assembly description here")>

Imports System
Imports Nunit.Framework

Namespace Nunit.Tests

  <TestFixture(), Description("Fixture description here")>_
  Public Class SomeTests
    <Test(), Description("Test description here")>_
    Public Sub OneTest()
    ' ...
    End Sub
  End Class
End Namespace
[assembly:Description("Assembly description here")]

#using <Nunit.Framework.dll>
using namespace System;
using namespace NUnit::Framework;

namespace NUnitTests
{
  [TestFixture, Description("Fixture description here")]
  public __gc class SomeTests
  {
    [Test, Description("Test description here")]
    void OneTest();
  };
}

#include "cppsample.h"

namespace NUnitTests {
  // ...
}
/** @assembly NUnit.Framework.Description("Assembly description here") */

package NUnit.Tests;

import System.*;
import NUnit.Framework.TestFixture;


/** @attribute NUnit.Framework.TestFixture() */
/** @attribute NUnit.Framework.Description("Fixture description here") */
public class SomeTests
{
  /** @attribute NUnit.Framework.Test() */
  /** @attribute NUnit.Framework.Description("Test description here") */
  public void OneTest()
  { /* ... */ }
}

Note: The Test and TestFixture attributes continue to support an optional Description property. The Description attribute should be used for new applciations. If both are used, the Description attribute takes precedence.