Professional Documents
Culture Documents
Aim: Drive development with unit tests using Test Driven Development.
Theory:
Test Driven Development:
The steps of test first development (TFD) are overviewed in the UML activity
diagram of following diagram. The first step is to quickly add a test, basically just enough code
to fail. Next you run your tests, often the complete test suite although for sake of speed you may
decide to run only a subset, to ensure that the new test does in fact fail. You then update your
functional code to make it pass the new tests. The fourth step is to run your tests again. If they
fail you need to update your functional code and retest. Once the tests pass the next step is to
start over.
Features:
Standard unit testing features such as test, fixture, setup, teardown, ignore, expected
exception, etc.
Easy to use graphical user interface
Recipes for combining several test assemblies into one test suite
Addin for Visual Studio 2005 and Visual Studio 2008
Executes tests based on the following frameworks:
o csUnit
o NUnit (version 2.4.7, .NET 2.0)
o Microsoft unit testing (basic support, VS 2008)
Search capabilites across tests, output, and statistics
Statistics per test to create performance base line
Categories to group tests for execution
Support for applications targeting .NET 2.0, .NET 3.0, and .NET 3.5
Works with any .NET language (C#, VB.NET, Managed C++, etc.)
Runs on Windows Vista SP 1 or Windows XP SP 3
JUnit (Java):
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 JUnit.
It is an open-source testing framework for java programmers. The java programmer can
create test cases and test his/her own code. It is one of the unit testing frameworks. Current
version is junit 4. To perform unit testing, we need to create test cases. The unit test case is a
code which ensures that the program logic works as expected. The org.junit package contains
many interfaces and classes for junit testing such as Assert, Test, Before, After etc.