Ignore (NUnit 2.0)
The ignore attribute is an attribute to not run a test or test fixture
for a period of time. The person marks either a Test or a TestFixture
with the Ignore Attribute. The running program sees the attribute
and does not run the test or tests. The progress bar will turn yellow
if a test is not run and the test will be mentioned in the reports
that it was not run.
This feature should be used to temporarily not run a test or fixture.
This is a better mechanism than commenting out the test or renaming
methods, since the tests will be compiled with the rest of the code
and there is an indication at run time that a test is not being
run. This insures that tests will not be forgotten.
Test Fixture Syntax
|
namespace NUnit.Tests
{
using System;
using NUnit.Framework;
[TestFixture]
[Ignore("Ignore a fixture")]
public class SuccessTests
{
// ...
}
}
Imports System
Imports Nunit.Framework
Namespace Nunit.Tests
<TestFixture(), Ignore("Ignore a fixture")>
Public Class SuccessTests
' ...
End Class
End Namespace
#using <Nunit.Framework.dll>
using namespace System;
using namespace NUnit::Framework;
namespace NUnitTests
{
[TestFixture]
[Ignore("Ignore a fixture")]
public __gc class SuccessTests
{
// ...
};
}
#include "cppsample.h"
namespace NUnitTests {
// ...
}
package NUnit.Tests;
import System.*;
import NUnit.Framework.TestFixture;
/** @attribute NUnit.Framework.TestFixture() */
/** @attribute NUnit.Framework.Ignore("Ignore a fixture") */
public class SuccessTests
{
// ...
}
|
Test Syntax
|
namespace NUnit.Tests
{
using System;
using NUnit.Framework;
[TestFixture]
public class SuccessTests
{
[Test]
[Ignore("Ignore a test")]
public void IgnoredTest()
{ /* ... */ }
}
Imports System
Imports Nunit.Framework
Namespace Nunit.Tests
<TestFixture()>
Public Class SuccessTests
<Test(), Ignore("Ignore a test")> Public Sub Ignored()
' ...
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][Ignore("Ignore a test")] void IgnoredTest();
};
}
#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.Ignore("ignored test") */
public void IgnoredTest()
{ /* ... */ }
}
|
|