Legacy Documentation. View NUnit 3 Documentation

PlatformAttribute (NUnit 2.2.2)

The Platform attribute is used to specify platforms for which a test or fixture should be run. Platforms are specified using case-insensitive string values and may be either included or excluded from the run by use of the Include or Exclude properties respectively. Platforms to be included may alternatively be specified as an argument to the PlatformAttribute constructor. In either case, multiple comma-separated values may be specified.

Test Fixture Syntax

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

  [TestFixture]
  [Platform("NET-2.0")]
  public class DotNetTwoTests
  {
    // ...
  }
}

Test Syntax

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

  [TestFixture]
  public class SuccessTests
  {
    [Test]
    [Platform(Exclude="Win98,WinME")]
    public void SomeTest()
    { /* ... */ }
}

Platform Specifiers

The following values are recognized as platform specifiers. They may be expressed in upper, lower or mixed case.

  • Win
  • Win32
  • Win32S
  • Win32Windows
  • Win32NT
  • WinCE
  • Win95
  • Win98
  • WinMe
  • NT3
  • NT4
  • NT5
  • Win2K
  • WinXP
  • Win2003Server
  • Unix
  • Linux
  • Net
  • Net-1.0
  • Net-1.1
  • Net-2.0
  • NetCF
  • SSCLI
  • Rotor
  • Mono