6.2 Architecture

     

JUnit contains about 75 named classes plus a number of inner classes and interfaces. It is organized into packages, as shown in Figure 6-1.

Figure 6-1. The JUnit packages and their import dependencies
figs/utf_0601.gif

The package junit.framework represents the core functionality, and the foundation on which unit tests are built. Much of the rest of the code is the relatively complex Swing, AWT, and text user interface (UI) packages, the package junit.samples (containing unit test examples), and the package junit.tests (containing JUnit's own unit tests). JUnit's developers "eat their own dog food" by providing a complete set of unit tests for all of its functionality.

The class architecture for the package junit.framework is shown in Figure 6-2.

Figure 6-2. Class architecture of the package junit.framework
figs/utf_0602.gif

The architecture of junit.framework follows the generic xUnit architectural model described in Chapter 3. In particular, notice a key architectural element, the interface Test , which is implemented by the classes TestCase and TestSuite . The abstract class TestCase is the parent of all unit test classes.

As described in Chapter 3, the key classes used when building unit tests are TestCase , TestSuite , and the TestRunner s. Appendix B is a detailed class reference for the junit.framework package.



Unit Test Frameworks
Unit Test Frameworks
ISBN: 0596006896
EAN: 2147483647
Year: 2006
Pages: 146
Authors: Paul Hamill

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net