1 / 39

A Taxonomy of OO Classes to Support Implementation-Based Testing

This presentation introduces a taxonomy of object-oriented classes for implementation-based testing, with the aim of improving software testing processes and automating testing. The taxonomy classifies classes based on their dependencies and features. Results and future work are also discussed.

abigailj
Download Presentation

A Taxonomy of OO Classes to Support Implementation-Based Testing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Taxonomy of OO Classes to Support Implementation-Based Testing Peter J. Clarke Software Testing Research Group School of Computer Science 03/22/2005

  2. Introduction • Annual cost of inadequate software testing $21 B (s/w developers), total - $59.5 B • Potential cost reduction $10.6 B Planning Report 02-3: The Economic Impacts of Inadequate Infrastructure for Software Testing NIST May 2002 • Improve software testing process • A new class abstraction technique • Reduce time to analyze code during testing • Further automate the testing process

  3. Outline of Presentation 1. Background 2. Motivation 3. Taxonomy of OO Classes 4. Mapping IBTTs to a CUT 5. Results 6. Future Work 7. Summary

  4. 1. Background - Terminology • Class Structure (We use the terminology presented by Meyer - Eiffel) attributes = data members, instance variables. routines = member functions, methods. features = attributes + routines • CUT= Class Under Test • Cluster = several tightly coupled classes

  5. Terminology cont Characteristicsof class C: • properties of the features in C types (built-in, user-defined), shared class features, accessibility, polymorphism, dynamic binding, deferred features, exception handling, and concurrency • dependencies C has with other classes i.e. declarations and inheritance

  6. Class-Based Testing Process of operating a class under specified conditions, observing or recording the results, and making an evaluation of the class based on aspects of the implementation. (Based on IEEE defn of s/w testing)

  7. Class-Based Testing cont Two approaches: • Specification-based testing • Test case selection • Oracle problem • Implementation-based testing • Test case selection • Adequacy coverage criteria (source code)

  8. Cross-section of Implementation-Based Testing Techniques (IBTTs) *Data-FlowHarrold et al. 1994 Exception-HandlingSinha et al. 1999 Incremental Concurrent Koppol et al. 2003 *OMENSouter et al. 2000 AutomatedBuy et al. 2000 Object StateKung et al. 1994 Incremental Harold et al. 1992 Test tuple generation Message Sequence generation Test case reuse

  9. IBTTs and Class Characteristics

  10. 2. Motivation • Does any scalable class abstraction technique (CAT) support implementation-based testing of classes? • If such a CAT existed could it be used to further automate the testing process? • How would you describe the classes shown in the next slide?

  11. // Java example class T extends Thread{ private int countD = 5, numT, delay; private static int countT = 0; public T(int inDelay){ numT = ++countT; delay = inDelay;} public void run( ){ try{ while(true){ System.out.println("Thread "+ numT + "(" + countD + ")"); sleep(delay); if(--countD = = 0) return;} } catch(InterruptedException e){ return;} } public static void main(String[] args){ for(int i = 0; i < 5; i++) new T(i).start( );} } // C++ Example class Point {...}; class ClosedShape{ protected: Point center; public: ClosedShape(Point p1): center(p1) {} virtual ~ClosedShape() {} virtual double perimeter() const = 0; }; class Circle: public ClosedShape {...};

  12. Existing CATs • Generation of graphs to support program analysis. • Design recovery e.g. UML class diagrams. • Identification of inherited features. • Extraction of OO design metrics. Increasing semantic distance. [Gannod et al. ’98]

  13. 3. Another CAT A taxonomy of OO classes – classifies an OO class C into a group (taxon) based on the dependencies C has with other classes in a program. Properties: • include all possibilities (domain coverage) • mutually exclusive subgroups (or taxa) • unambiguous Class characteristics are represented as a cataloged entry.

  14. Taxonomy cont Components of each cataloged entry: • Class Name– fully qualified name of class in program. • Nomenclature- identifies the group (or taxa) the containing the cataloged class. • Feature Properties: • Attributes– subgroups of attributes with similar properties. • Routines– subgroups of routines with similar properties. • Feature classification- summary of inherited features.

  15. Taxonomy cont • Nomenclature, Attributes and Routinescomponent entrieseach consists of: modifier+type family • modifiersummarizes properties/dependencies modifier = add-on descriptor+core descriptor • type familyclassifies types associated with class

  16. Core and Add-on (C++) Descriptors

  17. Type Families NA - No Associated types P, P* - Primitive types e.g., int, char, . . . U, U* - User defined types e.g., classes L, L* - classes from a Standard Library A, A* - Any type (parameter to generic class) m<n>, m<n>* - m {U, L}, n  {P({P, P*, U, U*, L, L*}) - } instances of parameterized classes *denotes a reference/pointer to the type

  18. C++ Example Cataloged Entry Class Name:ClosedShape class Point { …}; class ClosedShape{ protected: Point center; public: ClosedShape(Point p1): center(p1) {} virtual ~ClosedShape( ) {} virtual double perimeter( ) const = 0; }; class Circle: public ClosedShape {…}; Nomenclature: Abstract Parent Family U Feature Properties Attributes: [1] Protected Family U Routines: [1] Non-Virtual Public Family U [1] Virtual Public Family NA [1] (Constant) Deferred Virtual Public Family NA Feature Classification: None

  19. // Java example class T extends Thread{ private int countD = 5, numT, delay; private static int countT = 0; public T(int inDelay){ numT = ++countT; delay = inDelay;} public void run( ){ try{ while(true){ System.out.println("Thread "+ numT + "(" + countD + ")"); sleep(delay); if(--countD = = 0) return;} } catch(InterruptedException e){ return;} } public static void main(String[] args){ for(int i = 0; i < 5; i++) new T(i).start( );} } Class Name: T Nomenclature: Concurrent External Child Families P U L* Feature Properties Attributes: [3] Private Family P [1] Private Static Family P Routines: [1] Non-Virtual Public Family P [1] Exception-H Virtual Public Family L* [1] Concurrent Non-Virtual Public Static Family P U L* Feature Classification: Unknown

  20. 4. TaxTOOL – A Taxonomy Tool for an OOLanguage (C++) <<subsystem>> Tax_Repository Tax_Entries <<subsystem>> Clouseau_API Tax_AllAttrs <<updates>> Tax_AllFuns <<uses>> <<accesses>> <<invokes>> <<subsystem>> Tax_Cataloger <<subsystem>> Tax_Stats

  21. Table: Summary of Cataloged C++ Applications using TaxTOOL

  22. 5. Mapping IBTTs to a CUT Algorithm IBTT_CUTMap • Input: A summary of the CUT and a list representing a summary of IBTTs. • Process: Identify IBTT(s) suitable for testing features of CUT. • Output: List of 4-tuples (component entry, feature pairs, testing technique id, priority) and a list of pairs (component entry, feature pairs)

  23. Mapping IBTTs to a CUT cont Matches operator () for Component entries: A  B  A.modifier  L(B.modifier)  A.typeFamily  B.typeFamily   Example: External Child Families P U(External Child | Internal Child) Family P That is: External Child  L(External Child | Internal Child)  {P, U} {P}  

  24. // Algorithm to map IBTTs to a CUT 1: IBTT_CUTMap(cutEntry, ibttList) 2: initialize ibttCutMap // variable to return tuple lists 3: for all ibtt in ibttList do 4: for all ibttEntry in ibtt do 5: if cutEntry.Nomen ≈ ibttEntry.Nomen then 6: for all Attr in cutEntry do 7: if cutEntry.Attr ≈ ibttEntry.Attr then 8: create 4-tuple, update ibttCutMap.tupleList using ibttEntry.Priority 9: end if 10: end for 11: for all Rout in cutEntry do 12: if cutEntry.Rout ≈ ibttEntry.Rout then 13: create 4-tuple, update ibttCutMap.tupleList using ibttEntry.Priority 14: end if 15: end for 16: end for 17: end for 18: return ibttCutMap 19: end IBTT_CUTMap

  25. CUT IBTT Entry UniqueID: Data-Flow_Harrold94 Class Name: Circle EntryList: ... Nomenclature: External Child Families P U Priority: 3 Feature Properties Nomenclature:(External Child | Internal Child) Family P Attributes: [1] New Private Family P [1] Recursive Protected Family U Routines: [1] New Non-Virtual Public Families P U ... Feature Classification: ... Feature Properties Attributes: New(Private| Protected | Public) [Static] Family P Routines: (New | Redefined) (Non-Virtual | Virtual) (Private | Protected Public) [Static] Family P

  26. MapTOOL: Tool to map IBTTs to a CUT Uses TaxTOOL To build an IBTT cataloged entry TaxTOOL Tax_IO <<queries>> Clouseau_API <<uses>> Tax_Cataloger queries Tax_IO for the IBTT list <<queries>> <<updates>> Tax_Repository <<queries>> Tax_Map Queries TaxTOOL for the CUT cataloged entry

  27. Table: Summary of mapping two IBTTs to the six C++ applications (preliminary)

  28. Chart: Summary of mapping two IBTTs to the six C++ applications Bars for each application: left – attributes, right - routines

  29. 6. Current and Future Work • Enhance TaxTOOL and MapTOOL to analyze applications with >10K lines of code. • Create an Implementation-Based Testing Framework for Java. • TaxTOOLJ • Class Ordering System (COSJ) • MapTOOLJ Collaborators: Dr. Brian Malloy (Clemson University). Students: Djuradj Babic(PhD), David Crowther (MS)

  30. Current/Future Work cont • Concurrent/Distributed systems: • Investigating test coverage criteria for High-Level Petri Nets using model checking. • Investigate the relationship between test coverage for High-Level Petri Nets and the test coverage for the corresponding implementation. Collaborators: Dr. Xudong He and Dr. Junhua Ding

  31. 7. Summary • Overview class-based testing • New CAT to support implementation-based testing of classes • Presented results from TaxTOOL • Application of new CAT – automate the mapping IBTTs to a CUT • Presented preliminary result from MapTOOL • Future work

  32. Webpage: http://www.cs.fiu.edu/~clarkep/ • Publications • “Online” version of TaxTOOL Questions Thank you !

  33. “Real World” Example Class TkeyApp : class TKeyApp : public vApp{ public: TKeyApp(char* name) : vApp(name) {} virtual ~TKeyApp() {} virtual vWindow* NewAppWin(vWindow* win, char* name, int h, int w, vAppWinInfo* winInfo); }; A class from the vkey GUI application by Swan 2000 Uses the V C++ GUI framework release 1.2.5 Wampler2000

  34. OODMs for TkeyApp (Lorenz & Kidd)

  35. Class Diagram for TkeyApp.

  36. Cataloged Entry for TKeyApp Nomenclature:External Child Families P P* U* L L* Attributes: (6 entries, 8 attributes) [2] Recursive Protected Family P ... Routines: (21 entries, 53 routines) [1] New Non-Virtual Public Family P* [1] New Virtual Public Family NA [1] Redefined Has-Polymorphic Virtual Public Families P P* U* [22] Recursive Non-Virtual Public Family NA ... Feature Classification: (6 entries) [8] Recursive Attributes [41] Recursive Non-Virtual Routines [1] Redefined Virtual Routine ...

More Related