ExplicitAttribute (NUnit 2.2)
The Explicit attribute causes a test or test fixture to be ignored unless it is
explicitly selected for running. The test or fixture will be run if it is
selected in the gui, if its name is specified on the console runner command
line as the fixture to run or if it is included by use of a Category filter.
An optional string argument may be used to give the reason for marking
the test Explicit.
If a test or fixture with the Explicit attribute is encountered in the course of
running tests, it is skipped unless it has been specifically selected by one
of the above means. The test does not affect the outcome of the run at all:
it is not considered as ignored and is not even counted in the total number
of tests. In the gui, the tree node for the test remains gray and the
status bar color is not affected.
Note: In versions of NUnit prior to 2.4, these tests were
shown as ignored.
Test Fixture Syntax
namespace NUnit.Tests
{
using System;
using NUnit.Framework;
[TestFixture, Explicit]
public class ExplicitTests
{
// ...
}
}
Imports System
Imports Nunit.Framework
Namespace Nunit.Tests
<TestFixture(), Explicit()>
Public Class ExplicitTests
' ...
End Class
End Namespace
#using <Nunit.Framework.dll>
using namespace System;
using namespace NUnit::Framework;
namespace NUnitTests
{
[TestFixture]
[Explicit]
public __gc class ExplicitTests
{
// ...
};
}
#include "cppsample.h"
namespace NUnitTests {
// ...
}
package NUnit.Tests;
import System.*;
import NUnit.Framework.TestFixture;
/** @attribute NUnit.Framework.TestFixture() */
/** @attribute NUnit.Framework.Explicit() */
public class ExplicitTests
{
// ...
}
Test Syntax
namespace NUnit.Tests
{
using System;
using NUnit.Framework;
[TestFixture]
public class SuccessTests
{
[Test, Explicit]
public void ExplicitTest()
{ /* ... */ }
}
Imports System
Imports Nunit.Framework
Namespace Nunit.Tests
<TestFixture()>
Public Class SuccessTests
<Test(), Explicit()> Public Sub ExplicitTest()
' ...
End Sub
End Class
End Namespace
#using <Nunit.Framework.dll>
using namespace System;
using namespace NUnit::Framework;
namespace NUnitTests
{
[TestFixture]
public __gc class SuccessTests
{
[Test][Explicit] void ExplicitTest();
};
}
#include "cppsample.h"
namespace NUnitTests {
// ...
}
package NUnit.Tests;
import System.*;
import NUnit.Framework.TestFixture;
/** @attribute NUnit.Framework.TestFixture() */
public class SuccessTests
{
/** @attribute NUnit.Framework.Test() */
/** @attribute NUnit.Framework.Explicit() */
public void ExplicitTest()
{ /* ... */ }
}