Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rigorous Testing by Merging Structural and Behavioral UML Representations Presented by Chin-Yi Tsai.

Similar presentations


Presentation on theme: "Rigorous Testing by Merging Structural and Behavioral UML Representations Presented by Chin-Yi Tsai."— Presentation transcript:

1 Rigorous Testing by Merging Structural and Behavioral UML Representations Presented by Chin-Yi Tsai

2 2 Outline Introduction Introduction Background and Related Work Background and Related Work An Integrated Testing Approach An Integrated Testing Approach Conclusion Conclusion

3 3 Introduction Testing of design models usually consists of walk-throughs and inspections both of which lack the rigor of systematic testing. Testing of design models usually consists of walk-throughs and inspections both of which lack the rigor of systematic testing. Test adequacy criteria for UML model help define necessary objective during the process of test creation. Test adequacy criteria for UML model help define necessary objective during the process of test creation. Test criteria are specific to a particular UML view (class diagram, collaboration diagram, sequence diagram) Test criteria are specific to a particular UML view (class diagram, collaboration diagram, sequence diagram) UML views in isolation can not provide a representation of the cross notational aspects in UML. UML views in isolation can not provide a representation of the cross notational aspects in UML. To integrate two complementary views of UML To integrate two complementary views of UML Structural views through Class Diagrams Structural views through Class Diagrams Behavioral views through Sequence Diagram Behavioral views through Sequence Diagram

4 4 Introduction (cont ’ d) A new graph that encapsulates the many paths that exist between objects via their method calls as directed acyclic graph (OMDAG). A new graph that encapsulates the many paths that exist between objects via their method calls as directed acyclic graph (OMDAG). Object method execution table (OMET) that captures both execution sequence and associated attribute values by merging the UML views. Object method execution table (OMET) that captures both execution sequence and associated attribute values by merging the UML views. Use information from class diagram and sequence diagram to derive and execute tests that satisfy test adequacy criteria for both structural and behavioral views. Use information from class diagram and sequence diagram to derive and execute tests that satisfy test adequacy criteria for both structural and behavioral views.

5 5 Introduction (cont ’ d) 1. Extraction of attributes and parameters from Class Diagram (class diagram) 2. The transformation of Sequence Diagram into OMDAG (sequence diagram) 3. An algorithm that merges the structural and behavioral representations into an OMET

6 6 Background and Related Work Binder [3] described generic code test requirements that can be derived from UML models. Outt and Ab-durazik [8] developed a technique for generating test cases for code from a restricted form of UML State Diagrams. Abdurazik and Outt [1] also developed test criteria based on Collaboration Diagrams for static and dynamic testing of code. Labiche and Briand [4] describe the TOTEM (Testing Object orienTed systEms with the Unied Modeling Language) system test methodology. In Scheetz et al. [10] an approach to generating system (black box) test cases from UML Class Diagrams is described.

7 7 UML Testing Criteria Class Diagram Criteria Class Diagram Criteria Association-End Multiplicity Criterion Association-End Multiplicity Criterion Given a test set T and a System Model SM, T must cause each representative multiplicity-pair in SM to be created. Given a test set T and a System Model SM, T must cause each representative multiplicity-pair in SM to be created. All class relation All class relation Generation Criterion Generation Criterion Given a test set T and a Systems Model SM, T must cause every specialization in a generalization to be created. Class hierarchical structure Class Attribute Criterion Class Attribute Criterion Give a test set T, a System Model SM, and a class C, T must cause a set of representative attribute value combinations in each instance of class C to be created. Internal structure of each class Internal structure of each class

8 8 UML Testing Criteria Collaboration Diagram Criteria Collaboration Diagram Criteria Condition Coverage Criteria Condition Coverage Criteria Give a test set T and Collaboration Diagram CD, T must cause each condition in each decision to evaluate to both TRUE and FALSE. Full Predicate Coverage Criteria Full Predicate Coverage Criteria All Message Paths Criteria All Message Paths Criteria All possible sequences in the sequence diagram All possible sequences in the sequence diagram Collection Coverage Criteria Collection Coverage Criteria

9 9 An Integrated Testing Approach This testing method consists of the following steps: This testing method consists of the following steps: 1. Identify attribute/parameter partitions for all the structural elements in the design. (Outcome: Coverage items for the attribute and method parameters.) 2. Transform Sequence Diagrams into OMDAGS. (Outcome: OMDAGS.) 3. Generate paths through OMDAGS. 4. Traverse paths in OMDAGs, select and assign attribute/parameter values from partitions based on objects in OMDAG path. 5. Record results of steps 3 and 4 in object method execution table (OMET). 6. Generate and execute test cases and determine coverage of criteria using [2].

10 10 Partitions for the Structural Representation Partitions, including boundary-value partitions are determined by either OCL or by domain knowledge. Partitions, including boundary-value partitions are determined by either OCL or by domain knowledge.

11 11 The Object Method Directed Acyclic Graph as a Behavioral Representation The OMDAG is created by The OMDAG is created by Associating methods in the Sequence Diagram with their originating objects Associating methods in the Sequence Diagram with their originating objects Main:deal(), Deler:return() Main:deal(), Deler:return() Traversing the Sequence Diagram from beginning to end, showing choices and conditions for method execution Traversing the Sequence Diagram from beginning to end, showing choices and conditions for method execution

12 12 OMDAG Conditional statementnesting

13 13 A Test Generation and Execution Algorithm The partitions for attribute and method parameter values and the OMDAG The partitions for attribute and method parameter values and the OMDAG To combine them into test sequences To combine them into test sequences Traversing the OMDAG Traversing the OMDAG Selecting appropriate attribute and parameter values for object instantiations that would cause the desired test sequence to execute Selecting appropriate attribute and parameter values for object instantiations that would cause the desired test sequence to execute

14 14 Traverse the OMDAG Traverse the OMDAG P = P 1, …, P n P = P 1, …, P n Determine objects and values to execute paths Determine objects and values to execute paths When all tests have been defined in the OMET, to evaluate … When all tests have been defined in the OMET, to evaluate …

15 15 Determine object and values to execute paths Determine which active objects are needed to execute P i Determine which active objects are needed to execute P i Create a series of constructor calls Create a series of constructor calls pre(P i ) pre(P i ) preseq(P i ) preseq(P i ) Simulate the path p i one node at a time and select and record attribute and parameter value in the OMET Simulate the path p i one node at a time and select and record attribute and parameter value in the OMET Analysis the exception Analysis the exception

16 16 A Simple Example

17 17 OMDAG path P1 = 1 -> 2c -> 3c -> 4 -> 5 -> 5.1 -> 5.2 -> 5.3 -> 5.4 -> 6 -> 7 ->7.1 -> 7.2 -> 8a -> 8.1 a -> 8.2a -> 8.2.1a -> 8.2.2a -> 8.3a ->9a ->10a ->11 -> 12 Determine pre(P) Need an instance of the MainWindow preseq(P) require an instance of MW1 of MainWindow

18 18 OMET Analyze the coverage using the testing criteria

19 19 Conclusion The test generation algorithm relies upon boundaries and partitions. The test generation algorithm relies upon boundaries and partitions. This information needs to be provided in the UML model This information needs to be provided in the UML model The OMET is the key artifact that is created by merging the Sequence and Class Diagrams. The OMET is the key artifact that is created by merging the Sequence and Class Diagrams. The OMET can reveal architectural problems or logical errors. The OMET can reveal architectural problems or logical errors. Use the OMET to analyze the dynamic behavior of program before it is implemented. Use the OMET to analyze the dynamic behavior of program before it is implemented. The OMET could be used to profile a system by extracting statistics concerning function calls, initializations, number of classed, etc. The OMET could be used to profile a system by extracting statistics concerning function calls, initializations, number of classed, etc.


Download ppt "Rigorous Testing by Merging Structural and Behavioral UML Representations Presented by Chin-Yi Tsai."

Similar presentations


Ads by Google