Unit Test Frameworks

     

The classes TestCase , TestRunner , TestFixture , TestSuite , and TestResult represent the core of the xUnit architecture. To understand what they do is to understand how xUnit works. Figure 3-6 shows how they all fit together.

Figure 3-6. Core classes of the xUnit test framework architecture

The test classes created in this chapter and the classes they interact with are shown in Figure 3-7.

Figure 3-7. The test classes LibraryTests, LibraryTest, and BookTest

LibraryTests is a TestSuite containing BookTest and LibraryTest . LibraryTest is a TestFixture , and BookTest is a TestCase . Conceptually, TextTestRunner runs LibraryTests , which runs BookTest and LibraryTest , which in turn run their test methods .

This concludes the discussion of the generic xUnit architecture. Chapter 6 through Chapter 10 describe the specific architectural details of some popular versions of xUnit, with usage examples for each one.

Категории