contents   previous




C. Types of testing

For our purposes here a component will refer to a coherent portion of the system which we plan to test independently. If it does not contain a (proper) sub-component (i.e. something smaller that will be tested), then it is refered to as a unit. A unit might be a class or a package containing a few classes that are tightly coupled, and that we prefer to test together. A thorough or testing plan will call for each of these units to be tested independently, and integrated into larger subsytems that will also be tested.

When testing a component A of the system, it is often necessary to simulate the behavior of another component B. This might be because A needs the functionality of B. If so, and if B has not been fully developed (maybe not even begun), then it becomes necessary to substitute a fake version of B called a test stub. The stub might have some of the functionality of the real deal, but is expected to fake at least a portion of it. So for example, if some method of B is required to do a complex computation and return a floating-point value, the stub might just return a random value instead.

On the other hand, if some not-ready-to-go component C is going to make extensive use of A, then it might be worthwhile to rapidly develop a test driver that simulates the behavior of C in connection with its usage of A. The idea is that if A faithfully services the driver, then we are more confident that it will later faithfully service C as well. Of course it is possible to build a fake component that functions both as a stud in some ways, and a driver in other ways. Bridge patterns can simplify the substituion of stubs and drivers for actual components.

The following is a list containing some types of tests that might be performed as part of an overall testing strategy (to be discussed later). Note that the terminology is not mutually exclusive, meaning for example that a certain unit test might be a blackbox (or whitebox) test.



next