Testing Object-Oriented Systems - Part 2: Models
The subtitle of Binder's book is "Models, Patterns, and Tools." Part 2 focuses on the "Models" part.
Chapter 5 introduces part 2. In it, Binder argues that testing must be model-based. The space that must be examined (tested) for even the smallest useful application is huge. Applying models to that space allows testing to be systematic, focused, and automated. Testing models are useful simplifications of the system under test. Binder differentiates between models that are test-ready and ones that aren't. He calls models that aren't test-ready "cartoons." Cartoons are too ambiguous, incomplete, or fragmentary to directly generate test cases from. He lists the following requirements for testable models:
- Complete and accurate reflection of the implementation to be tested.
- Abstracts details that would make testing cost prohibitive.
- Preserves details that is essential for revealing faults and demonstrating conformance.
- Represents all events of the state model.
- Represents all actions of the state model.
- Represents the state in a way that tests can determine the current state.
Binder ends the chapter talking about the strengths and weaknesses of formal and informal test methods.
Chapter 6 talks about combinational models. These models are appropriate for systems or components where the output is determined solely by the state of the inputs. This type of model uses decision tables to represent the implementation under test. The chapter then walks through how to generate decision tables using various techniques. Many of these techniques come from digital logic design. Boolean algebra, Karnaugh maps, and cause-effect graphs are introduced. Test generation approaches based on failure models are shown.
Chapter 7 talks about state machines. State machines differ from combinational models in that their output is dependent not only on the state of the inputs but also history. Various representations of state machines are shown and their appropriateness for use in testing is discussed. The Flattened Regular Expression (FREE) model is described as one that is particularly amenable for testing. The necessity of understanding how inheritance is used in the implementation under test and its affect on testing is explained. Fault models for state machines are described. Various test generation approches are also described.
Chapter 8, "A Tester's Guide to the UML," ends part 2 of the book. Each of the various UML diagrams (except statecharts, which are introduced in chapter 7) are introduced and their usefulness as a basis of testing is discussed.
I was impressed with part 2 of the book. It's clear from Binder's references that he has done a lot of research in testing and it's clear from his book that he's done a lot of thinking and evaluating of the literature to come to his view of testing. It seems like a rigorous but reasonable approach to testing.