next up previous contents
Next: 4.2 Black Box Testing Up: 4 Unit Testing Previous: 4 Unit Testing   Contents


4.1 General Strategy

Once the author of a class has completed coding for a feature of the class, they must run all the Unit Test cases for that class. The test cases for a particular class are to be written by someone designated by the Project Manager. Wherever possible, the author of a class' Test case will be a different person than the author of the class. Also, wherever possible, the test cases for a class are to be written at the same time as the class, so that at least some of the test cases can be used by the author during Informal Testing. The class must pass all of its test cases before it is considered finished.

Unit tests must be performed in isolation, that is, a class must not be able to access any other classes in the program. Classes must be tested in isolation to ensure that each class functions independently from the others. However, some classes depend on other classes, and will not function without them. To remedy this situation, a number of stubs will be created. A stub is simply a dummy class that simulates the behavior of a class for testing purposes. These stubs will be stored in CVS under src/test/sam/unit/stubs. In order to unit test a class that imports another SAM class, the class must be copied into this directory before test cases are run.

Unit Tests will be written using a Black Box methodology (see section 4.2), and the particular tests will be chosen by some or all of Equivalence Partitioning (see section 4.2.1), Boundary Value Analysis (see section 4.2.2) and Random Selection (see section 4.2.3). For the more important logic classes, Glass Box testing will also be used if time permits (see section 4.3).

For classes that involve the creation and/or manipulation of a graphical user interface (GUI), Unit Testing is more difficult, since these classes rely on external user events to trigger functions, which cannot be easily reproduced. Therefore, Unit Testing will only be done on GUI classes if it is deemed suitable and helps, rather than hinders, development. For more details on how GUI classes will be tested, see section 7.


next up previous contents
Next: 4.2 Black Box Testing Up: 4 Unit Testing Previous: 4 Unit Testing   Contents