madhavrao… » Unit Testing

There are many Unit Testing Tools available for .Net Framework. This post will be updated with list of Unit Testing Tools as and when I come across any new tool and cover each of them in detail in separate posts

  • NUnit
  • dotUnit
  • csUnit
  • MBUnit
  • DotNetMock
  • ZaneBug
  • NUnitLite
  • MSTest
  • TypeMock
  • NDbUnit
  • NUnitAsp
  • RhinoMock
  • EasyMock.Net
  • NUnitForms
  • .NetUnit
  • BizUnit
  • AspUnit
  • COMUnit
  • NMock
  • NMock2
  • XtUnit

NUnit

Website: http://www.nunit.org/
Description: NUnit is a unit-testing framework for all .Net languages. Initially ported from JUnit, the current production release, version 2.4, is the fifth major release of this xUnit based unit testing tool for Microsoft .NET. It is written entirely in C# and has been completely redesigned to take advantage of many .NET language features, for example custom attributes and other reflection related capabilities. NUnit brings xUnit to all .NET languages. It uses attributes to identify test cases, test fixtures and test suites.

dotUnit

Website: http://dotunit.sourceforge.net/
Description: dotunit is a port of JUnit (www.junit.org) to the Microsoft .net platform. It provides a testing framework to support automated testing of applications, particularly to facilitate unit, function and regression testing. It uses inheritance to identify, test cases, test fixtures and test suites. It also facilitates testing private members, methods.

csUnit

Website: http://www.csunit.org/
Description: csUnit is a free and open source unit testing tool for the .NET Framework. csUnit works with all .NET languages including C#, Visual Basic .NET, J#, and managed C++. It comes with a choice of command line, graphical user interface, and an add-in for Visual Studio.

MBUnit

Website: http://www.mbunit.com/
Description: MbUnit is advanced extensible unit testing framework. MbUnit offers all features that are available with NUnit and csUnit along with extensibility which is not available with them. It was initially named as GUnit, which was been changed to MbUnit to avoid clashing with another project. GUnit stands for Generative Unit Testing Framework

Zanebug

Website: http://www.adapdev.com/zanebug/
Description: Zanebug was developed to provide a unified platform for unit and integration testing. The current release addresses component-level unit testing, with a fair amount of development time focused on performance statistics and a flexible architecture. The long-term view for Zanebug is a tool that provides integrated component, form and web-based testing both locally and remotely with all the necessary performance information necessary for enterprise development.

NUnitLite

Website: http://www.nunitlite.com/
Description: NUniteLite is a lightweight testing framework for .NET, based on the ideas in NUnit and providing a subset of its features. It uses minimal resources and will run on resource-restricted platforms such as those used in embedded and mobile development.

MSTest

Website: http://msdn.microsoft.com/vstudio/teamsystem/
Description: MSTest is Microsoft Test Suite, which comes with Visual Studio Developer. It is available only with few edition of Visual Studio and is as good as NUint Test Suite. In fact Test Cases written for MSTest can be executed with NUnit, if they are been re-build by changing namespaces.

TypeMock

Website: http://www.typemock.com/
Description: TypeMock is a unit testing framework with object mocking ability. It simplifies task of writing unit test cases.

NDbUnit

Website: http://www.ndbunit.org/
Description: NDbUnit is a .NET library for putting a database into a known state. NDbUnit may be used to increase repeatability in unit tests that interact with a database by ensuring that the database’s state is consistent across execution of tests. NDbUnit does this by allowing the unit test to perform an operation on a dataset before or after the execution of a test, thus ensuring a consistent state. It is based on dbUnit

NUintAsp

Website: http://nunitasp.sourceforge.net/
Description: NUnitAsp is a tool for automatically testing ASP.NET web pages. It’s an extension to NUnit, a tool for test-driven development in .NET.

Rhino.Mocks

Website: http://www.ayende.com/projects/rhino-mocks.aspx
Description: A dynamic mock object framework for the .Net platform. It’s purpose is to ease testing by allowing the developer to create mock implementations of custom objects and verify the interactions using unit testing.

EasyMock.Net

Website: http://sourceforge.net/projects/easymocknet/
Description: EasyMock.NET is a class library that provides an easy way to use mock objects for given interfaces or remote objects. EasyMock.NET is a port of the EasyMock framework, which can be found for the Java(TM) platform.

NunitForms

Website: http://nunitforms.sourceforge.net/
Description: NUnitForms is an NUnit extension for unit and acceptance testing of Windows Forms applications. NUnitForms also provides a Recorder application that can record your interactions with a form and "write" a test for you that duplicates your actions. You can perform asserts during this process by right-clicking on your controls and selecting the property to assert. While not all of the testing functionality is currently supported by the recorder, it does provide a good way to familiarize yourself with the API and to demonstrate how testing is accomplished with NUnitForms.

.NetUnit

Website: http://sourceforge.net/projects/dotnetunit/
Description: An implementation of the XUnit testing framework designed specifically for unit testing components written for the .NET platform.

BizUnit

Website: http://www.codeplex.com/bizunit
Description: Test framework for automated testing, enables the rapid development of test cases, specifically targetted but not restricted to testing BizTalk solutions.

AspUnit

Website: http://aspunit.sourceforge.net/
Description: ASPUnit is a unit testing framework based on the architecture of JUnit, the current open source de facto standard for unit testing. ASPUnit is a web-based port of COMUnit using Active Server Pages. It is a VBScript implementation that has been tested to run on top of Microsoft Internet Information Server 5.0 or 5.1.

COMUnit

Website: http://comunit.sourceforge.net/
Description: COMUnit is a unit testing framework based on the architecture of JUnit, the de facto open source standard for creating unit tests. COMUnit is a Visual Basic port of the JUnit framework that is designed to facilitate developing unit tests for Microsoft COM components and Visual Basic applications.

NMock

Website: http://nmock.sourceforge.net/
Description: NMock is a dynamic mock object library for .NET. Mock objects make it easier to test single components—often single classes—without relying on real implementations of all of the other components. This means we can test just one class, rather than a whole tree of objects, and can pinpoint bugs much more clearly. Mock objects are often used during Test Driven Development.

NMock2

Website: http://sourceforge.net/projects/nmock2/
Description: NMock 2.0 is a library for assisting test driven development of C# code by providing a dynamic Mock Object framework.

XtUnit

Website: http://teamagile.com/mainpages/Downloads.html
Description: XtUnit is a unit testing extension for .Net based frameworks. It uses the interception application block to provide runtime abilities of rolling back any changes that were made to the database during Data related unit tests.

DotNetMock

Website: http://sourceforge.net/projects/dotnetmock/
Description: DotNetMock is a framework and a library to facilitate the use of MockObjects for unit testing on the .NET platform. It supports the creation of your own MockObjects as well as the dynamic creation of MockObjects. It supports almost any version of NUnit, and MbUnit. DotNetMock DynamicMocks can mock interfaces at runtime and can even modify ref/out parameters.

What is Unit Testing?
Unit testing is a procedure, to validate the individual unit of source code are working properly. A unit is the smallest testable part of the application. In procedural programming a unit may be an individual program, function, procedure, etc., while in object-oriented programming, the smallest unit is a method; which may belong to a base/super class, abstract class or derived/child class.
Each Unit test case is independent of others, mock objects and test harness can be used to assist testing in isolation.

What are benefits of Unit Testing?
Benefits of Unit Testing are as follows:

  • It allows isolating and testing each part of the system independently.
  • It allows the programmer to refractor the code later, and make sure module still works correctly.
  • It helps to eliminate uncertainty in the units.
  • It provides a sort of living documentation of the system

What is Mock Objects?
Mock Objects are simulated objects that mimic the behavior of real objects in a controlled way. In a unit test, mock objects can simulate the behavior of the complex, real (non-mock) objects and are therefore useful when a real object is difficult or incorporate into a unit test. Mock Objects makes it possible to test a unit of code, even before dependent code is developed.

When to use a Mock Object?
Mock Objects should be used in following scenarios:

  • Original object supplies non-deterministic results.
  • Original object has states that are difficult to create or reproduce
  • Original object is slow
  • Original object does not yet exist.

What are Benefits of using Mock Objects?
Benefits of using Mock Objects are as follows:

  • It allows unit testing a code, even before dependent  code is developed.
  • It allows to concentrate on code under unit test, rather than integration issues of dependent objects
  • It also helps in defining functionality of the original objects to some extent.

What is Test harness?
A test harness or automated test framework is a collection of software and test data configured to test a program unit by running it under varying conditions and monitor its behavior and output.
It has two main parts

  • Test execution engine
  • Test script repository

What are benefits of Test harness?
Benefits of Test harness are as follows:

  •    Increase productivity due to automation of testing process
  •    Increased probability that regression test will occur
  •    Increased quality of software components and application