NUnit Acceptance Tests

Developers love self-referential programs! Hence, NUnit has always run all it's own tests, even those that are not really unit tests.

Now, beginning with NUnit 2.4, NUnit has top-level tests using Ward Cunningham's FIT framework. At this time, the tests are pretty rudimentary, but it's a start and it's a framework for doing more.

Running the Tests

Open a console or shell window and navigate to the NUnit bin directory, which contains this file. To run the test under Microsoft .Net, enter the command

    runFile NUnitFitTests.html TestResults.html .
To run it under Mono, enter
    mono runFile.exe NUnitFitTests.html TestResults.html .
Note the space and dot at the end of each command. The results of your test will be in TestResults.html in the same directory.

Platform and CLR Version

NUnit.Fixtures.PlatformInfo

Verify Unit Tests

Load and run the NUnit unit tests, verifying that the results are as expected. When these tests are run on different platforms, different numbers of tests may be skipped, so the values for Skipped and Run tests are informational only.

The number of tests in each assembly should be constant across all platforms - any discrepancy usually means that one of the test source files was not compiled on the platform. There should be no failures and no tests ignored.

Note: At the moment, the nunit.extensions.tests assembly is failing because the fixture doesn't initialize addins in the test domain.

NUnit.Fixtures.AssemblyRunner
Assembly Tests() Run() Skipped() Ignored() Failures()
nunit.framework.tests.dll 397     0 0
nunit.core.tests.dll 355     0 0
nunit.util.tests.dll 238     0 0
nunit.mocks.tests.dll 43     0 0
nunit.extensions.tests.dll 5     0 0
nunit-console.tests.dll 40     0 0
nunit.uikit.tests.dll 34     0 0
nunit-gui.tests.dll 15     0 0
nunit.fixtures.tests.dll 6     0 0

Code Snippet Tests

These tests create a test assembly from a snippet of code and then load and run the tests that it contains, verifying that the structure of the loaded tests is as expected and that the number of tests run, skipped, ignored or failed is correct.

NUnit.Fixtures.SnippetRunner
Code Tree() Run() Skipped() Ignored() Failures()
public class TestClass
{
}
EMPTY 0 0 0 0
using NUnit.Framework;

[TestFixture]
public class TestClass
{
}
TestClass 0 0 0 0
using NUnit.Framework;

[TestFixture]
public class TestClass
{
    [Test]
    public void T1() { }
    [Test]
    public void T2() { }
    [Test]
    public void T3() { }
}
TestClass
>T1
>T2
>T3
3 0 0 0
using NUnit.Framework;

[TestFixture]
public class TestClass1
{
    [Test]
    public void T1() { }
}

[TestFixture]
public class TestClass2
{
    [Test]
    public void T2() { }
    [Test]
    public void T3() { }
}
TestClass1
>T1
TestClass2
>T2
>T3
3 0 0 0
using NUnit.Framework;

[TestFixture]
public class TestClass
{
    [Test]
    public void T1() { }
    [Test, Ignore]
    public void T2() { }
    [Test]
    public void T3() { }
}
TestClass
>T1
>T2
>T3
2 0 1 0
using NUnit.Framework;

[TestFixture]
public class TestClass
{
    [Test]
    public void T1() { }
    [Test, Explicit]
    public void T2() { }
    [Test]
    public void T3() { }
}
TestClass
>T1
>T2
>T3
2 1 0 0

Summary Information

fit.Summary