Testing Extensible Design Patterns in OO Frameworks through Scenario TemplatesD.S. Sanders
Software Verification & Validation
Design Patterns
Proven architectures for constructing flexible and maintainable software
Promotes design reuse Language independent Neither classes nor objects
Origins & Progenitors
The “Gang of Four” Eric Gamma Richard Helm Ralph Johnson John Vlissides
Collectively penned “Design Patterns”: Elements of Reusable OO Software
Written between 1991-1994; released ‘95
Creational Patterns
Abstract Factory* Factory Method* Builder Prototype Singleton
Structural Patterns
Adapter Bridge Composite Decorator Façade Flyweight Visitor
Behavioral Patterns
Chain of Responsibility Command Interpreter Iterator Mediator
Momento Observer State Strategy* Template Method Visitor*
Post Gang of Four Patterns
Architectural Patterns Model – View – Controller
Concurrency Patterns Single Threaded Execution Guarded Suspension Balking Read / Write Lock Two Phase Termination
Memory Lane – Comp 110
Dynamic Typing Some or all type checking done at runtime
More memory lane – Comp 110 Dynamic Binding
Determining at runtime the appropriate method to call
Pattern Categorization - Redux Static
Does not allow for easy extension Behavior does not change after compile time Easier to test
Extensible Allows functionality of the app to change Adds new classes to the system Some of the classes loaded at runtime
Factory Method Pattern
Factory Method Example
Factory Method Example
Strategy Pattern
Strategy Pattern Example
So much testing…so little time Scenario Based Testing Method Sequence Specification (MtSS) Message Sequence Specification (MgSS) Message Framework Specification (MfSS)
The Bank
MtSS of Account Class and MgSS of Method Withdraw
Message Framework Sequence Specs
Test Cases
MfSS Slicing Partition Testing
Object Types Number of / Groups of Objects Object Input Space
More Memory Lane – Comp 380 Stress Testing Boundary Testing Negative Testing Random Testing
Compensating for Extensibility Testing Dynamic Typing Testing Dynamic Binding Testing Extensibility
Testing Results
Conclusion
Testing Extensible Design Patterns is difficult MfSS will generate scenario templates which
lead to test cases Use in Industry seems limited Source Code Credit
Kathy Sierra, Bert Bates (Factory, Strategy) Collegeboard.org (GridWorld Case Study)
Top Related