NUnit
Encyclopedia
NUnit is an open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 unit testing framework
Software framework
In computer programming, a software framework is an abstraction in which software providing generic functionality can be selectively changed by user code, thus providing application specific software...

 for Microsoft .NET. It serves the same purpose as JUnit
JUnit
JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks collectively known as xUnit that originated with SUnit....

 does in the Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 world, and is one of many in the xUnit
XUnit
Various code-driven testing frameworks have come to be known collectively as xUnit. These frameworks allow testing of different elements of software, such as functions and classes...

 family.

Example

Example of an NUnit test fixture:

using NUnit.Framework;

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

// Equivalently, since version 2.4 NUnit offers a new and
// more intuitive assertion syntax based on constraint objects
// http://www.nunit.org/index.php?p=constraintModel&r=2.4.7:
Assert.That(2*2, Is.EqualTo(4), "Multiplication constraint-based");
}
}


The NUnit framework discovers the method ExampleTestOfNUnit.TestMultiplication automatically by reflection
Reflection (computer science)
In computer science, reflection is the process by which a computer program can observe and modify its own structure and behavior at runtime....

.

Extensions

FireBenchmarks is an addin able to record execution time of unit tests and generate XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

, CSV
CSV
CSV may refer to:* Clerics of Saint Viator* Common Stored Value Ticket* Confederación Sudamericana de Voleibol* Character Strengths and Virtues* Christian Social People's Party* Community Service Volunteers...

, XHTML
XHTML
XHTML is a family of XML markup languages that mirror or extend versions of the widely-used Hypertext Markup Language , the language in which web pages are written....

 performances reports with charts and history tracking. Its main purpose is to enable a developer or a team that work with an agile methodology to integrate performance metrics and analysis into the unit testing environment, to easily control and monitor the evolution of a software system in terms of algorithmic complexity and system resources load.

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
Windows Forms
Windows Forms is the name given to the graphical application programming interface included as a part of Microsoft .NET Framework, providing access to native Microsoft Windows interface elements by wrapping the extant Windows API in managed code...

. As of August 2010, Nunit.Forms is in Alpha release, and no versions have been released since May 2006.

NUnit.ASP is a discontinued 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
ASP.NET
ASP.NET is a Web application framework developed and marketed by Microsoft to allow programmers to build dynamic Web sites, Web applications and Web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages ...

.

Further reading

  • Andrew Hunt, David Thomas: Pragmatic Unit Testing in C# with NUnit, 2nd Ed. The Pragmatic Bookshelf, Raleigh 2007, ISBN 0-9776166-7-3
  • Jim Newkirk, Alexei Vorontsov: Test-Driven Development in Microsoft .NET. Microsoft Press, Redmond 2004, ISBN 0-7356-1948-4
  • Bill Hamilton: NUnit Pocket Reference. O'Reilly
    O'Reilly
    O'Reilly is the Anglicised form of the Gaelic Ó Raghallaigh. It is also the patronymic form of the Irish name Reilly . It is commonly found throughout Ireland, with the greatest concentration of the surname found in County Cavan followed by Longford, Meath, Westmeath, Fermanagh and Monaghan, and...

    , Cambridge 2004, ISBN 0-596-00739-6

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK