
|
Account Inheritance, polymorphism and regression testing |
Deriving Black-Box Test Cases from a State Transition Diagram (STD) Demonstration: Deriving the Transition Tree from the STD From the state model, we can proceed with the test case design by developing a transition tree. The initial state is the root node of the tree. So, the root node for Account class is the initial state of Account - open. For each transition from the root state, draw a branch to a node that represents the next state. Repeat this for each state unless the next state is the final state or the next state appears in the ancestor node. The next phase of test design is to get the test sequences from the transition tree. Each branch of the tree becomes a test case (Chow's algorithm). Covering this tree will discover bugs that may be missed by just testing each method, transition, or state once.
Demonstration: Deriving the Test Sequence from the Transition Tree The test sequence is created by traversing the state transition graph. The test sequence should start from the initial state, go through all the possible transitions, and return back to the initial state, in a depth-first fashion. The test sequence derived from the transition tree of Account class are:
The operations listed in the test sequences above respond to a particular state of the account object by either:
The parameters or arguments of the operations (if applicable) are relevant in this context. They are not shown in the test sequence but are part of the test cases. The test plan is produced by identifying the method arguments & their values, and the expected state and possible exceptions for each transition. The actual test run involves setting the object under test (OUT) to the initial state, applying the test sequence, and checking the final state. |
Funded by Committee of University Teaching And Staff Development (CUTSD) through DEETYA, 1998