Pages

Monday, February 4, 2008

NUnit

NUnit is an open source unit testing framework for Microsoft .NET. It serves the same purpose as JUnit does in the Java world, and is one of many in the xUnit family.

NUnit.Forms is an expansion to the core NUnit framework and is also open source. It specifically looks at expanding NUnit to be able to handle testing user interface elements in Windows Forms.

NUnit.ASP is an expansion to the core NUnit framework and is also open source. It specifically looks at expanding NUnit to be able to handle testing user interface elements in ASP.NET.

Example of an NUnit test fixture:

using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;

[TestFixture]
public class TestOfNUnit
{
[Test]
public void TestMultiplication()
{
Assert.AreEqual(4, 2*2, "Multiplication");

// Equivalently, NUnit offers a new (in v2.4)
// and more intuitive constraint-based assertion syntax:
Assert.That(4, Is.EqualTo(2*2), "Multiplication constraint-based");
}
}

For more information check out the below link
http://www.nunit.com/index.php

No comments: