Unit Tester
Specification
The Unit Tester component targets the .Net Framework version 2.0 and
requires, at least, this version to operate successfully.
Overview
Unit Tester provides a small, simple to use, testing framework
that can be used with all flavours of Visual Studio.
The Unit Tester component is designed to provide developers with
a simple mechanism to test their code in defined "units" of functionality. In most
cases a unit of functionality will refer to a single class, however it does not
have to, a class may have several unit tests created for it.
The Unit Tester component defines the code that tests a unit of
functionality as a "Test Case". A test case typically contains methods that test
the functionality of the members of a class. When unit testing a component that
has many classes there will be many test cases to run. Each test case can be run
individually or alternatively the Unit Tester provides a "Test
Suite" that can be used to contain, manage and run many test cases.
To use the Unit Tester component in a typical development scenario,
create a solution that contains the project e.g. a class library that you are developing,
add a Windows Forms project to the solution to act as a test harness. In the test
harness, add a reference to the Unit Tester component. For each
class in the class library project, create a class in the test harness that derives
from the Unit Tester TestCase abstract base class.
In each TestCase derived class, create the test methods that
the Unit Tester component is to execute as part of the test case. Create
code in the test harness Form that either instantiates and runs each test case individually
or adds each of the test cases to an instance of the Unit Tester
TestSuite class.
Features
The Unit Tester component includes the following features:
- Can be used with any flavour of Visual Studio but does not depend
on it, so Unit Tester can be used with any .Net
development tool.
- Once created a test case may be run individually or as part of a test suite containing
many test cases
- A test suite may be executed once, executed a specified number of times or executed
for a specified period of time.
- A test suite may be executed synchronously or asynchronously. A progress event is
implemented by both the
TestCase and the TestSuite classes
to provide feedback during a long test run.
- The
TestCase base class is derived from the static Assert
class, therefore coding assertions in test methods is very simple and intuitive.
- Each test method in a test case may specify the result that it is expected to produce.
By comparing the expected result with the actual result in the result report it
is easy to spot problems or errors.
- The results of a test run are compiled into a report. A test result report may contain
the name of each test method called and completed, comments added by the code in
the test method, the result expected from the test method and details of any exceptions
that were thrown by the member being tested. The content and appearance of a test
run result report can be customized using the
TestResultFormatter class.
- The results of a test run may be output to any
TextWriter derived destination,
e.g. the Console or a file.
- Comes with MSDN style help reference documentation detailing all of the types contained
in the Unit Tester component and their members. Sample code, in
C# and Visual Basic is included to demonstrate
how to call and use the core types and their members.
- Comes with two sample Visual Studio solutions, one in C#
and one in Visual Basic demonstrating how to use the Unit Tester
component.