Chapter 6. JUnit

Overview

The JUnit unit test framework is the reference implementation of xUnit. As its name implies, it is developed in and used with Java. It is undoubtedly the most widely used, extended, and discussed framework for software unit testing today. JUnit is the foundation for more specialized unit testing tools, including Cactus, Jester, JUnitPerf, and many more, and integrates closely with others, such as Ant. The large community of JUnit users means that it is the basis for many new ideas and developments in unit testing technology.

The generic xUnit architecture, described in Chapter 3, reflects the architecture of JUnit. Java is designed from the ground up as a true object-oriented language, incorporating many modern features such as pure abstract classes, object reflection, and native exception-handling. JUnit makes full use of these features.

The purpose of JUnit is to provide a framework for building and running unit tests. The JUnit distribution also is a great example of a simple, solid software product that is built using test driven development. Examining its source code is instructive.

JUnit is open source software released under the Common Public License. This license frees all contributors from any liability or responsibility for the code, and makes users free to distribute, copy, alter, sell, and otherwise have their way with it. For details, refer to http://www.opensource.org.

The definitive source for everything pertaining to JUnit is http://www.junit.org ...

Get Unit Test Frameworks now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.