120 likes | 240 Views
OO Testing Problems. Adequate Testing and OOP Perry/Kaiser. Antidecomposition Adequacy. Reusing a piece of software in a new context requires retesting. Antidecomposition (AD) adequacy rule (Weyuker)
E N D
OO Testing Problems Adequate Testing and OOP Perry/Kaiser
Antidecomposition Adequacy • Reusing a piece of software in a new context requires retesting. Antidecomposition (AD) adequacy rule (Weyuker) • There exists a program P and a component Q of P such that T is adequate for P, T' is the set of vectors of values that variables can assume on entrance to Q for some t of T and T' is not adequate for Q. P Q
Applicability • Program-based testing • Some part of Q is not reachable in P but is reachable in other contexts • Specification-based testing • The enclosing program P may not utilize all the functionality defined by the specification of Q
Application to AP • Retesting after class graph change. Reusing a piece of software (e.g., a strategy) in a new context (a new class graph) requires retesting. Antidecomposition adequacy rule (Weyuker) • There exists a program P and a component Q of P such that T is adequate for P, T' is the set of vectors of values that variables can assume on entrance to Q for some t of T and T' is not adequate for Q.
Application to AP • Adaptive program Q used in program P (determined by a class graph and Q). • If P is adequately tested, Q might not be adequately tested. P Q
If class graph changes, it is necessary to re-test generated program. Whether program is hand-coded or generated, it needs to be tested. Comparison: AP versus OO during evolution
DJ example ClassGraph cg = new ClassGraph();//*.java A a = new A(…); cg.traverse(a, new StrategyGraph (“A->B”, new MyVisitor());
Application Antidecomposition: Retest inherited methods Class C { int v; void j(){v=0;}} class D extends C { void k(){v=1;}} Need to retest j in D!!!
Other applications of testing rules • Encapsulated unit: syntactic separation • interface • implementation • Change in implementation only: what needs to be retested?
Anticomposition rule • Adequately testing each individual program component does not necessarily suffice to adequately test the entire program. • Consider P and Q to be mutually recursive. P has the opportunity to modify the context seen by Q in a more complex way than could be done by stubs during testing of components in isolation
Surprise • Intuition: Specification-based testing: limit testing only to modified unit. • Anticomposition: need to retest every dependent unit as well
Test adequacy axioms • Antiextensionality: if two programs compute the same function