Overview

Unit testing is a simple but effective approach to improving the quality and reliability of a system. The key idea is to develop tests for a unit of code (which may be a fragment, a method or a module) as the code is being written. Development teams can employ this approach to ensure that quality is built into a project from the early stages.

The JADE unit testing framework enables unit tests to be executed automatically and for the test results to be captured. For details about unit testing, see "JADE Unit Testing", later in this chapter.

The goal of unit testing is to isolate each part of the program and show that the individual parts are correct. A unit test provides a strict, written contract that the piece of code must satisfy. Unit tests provide the following benefits.

Having developed a number of unit tests, the question of how comprehensively they test the system arises. Code coverage is a measure used in software testing to describe the degree to which the methods in a system have been tested. It is a useful measure to assure the quality of a set of tests, as opposed to directly reflecting the quality of the system under test.

Code coverage can help testers and developers to:

For details about code coverage, see "Code Coverage", later in this chapter.