• Deutsch (DE-CH-AT)
  • English (United Kingdom)
  • Japanese(JP)
SML@b Aspect Testing PDF Print


The Efficient Testing of Aspect Oriented Programs (ETAS) was investigated by Dr. Kostantina Richter (Testing Methods of Aspect-Oriented Programs, Master Thesis, 2008). The summarizin og AOP testing approaches is:

a) Data-flow-based unit testing of aspect oriented programs: This is an approach for testing AOPs using a data-flow-based approach for unit testing. This was one of the first approaches about testing AOPs. The developed unit testing approach tests two types of units for an aspect-oriented program: aspects that are modular units of crosscutting implementation of the program and classes whose behavior may be affected by one or more aspects. For each aspect or class, three levels of testing are performed:

  • Intra-module: This is performed for an individual module (e.g. a piece of advice, a piece of introduction, and a method).
  • Inter-module: This is performed for a public module along with other modules it calls in an aspect or class.
  • Intra-aspect or intra-class testing: This is performed for modules that can be accessed outside the aspect or class and can be invoked in any order by the users.

The method uses control flow graphs to compute def-use pairs of an aspect or class. The selection of tests for aspects or classes is based on the computation of these def-use pairs. The approach handles testing problems unique to AOPs and it is capable of detecting the failure to preserve state invariants faults.

b) A state-based approach to testing aspect oriented programs: This is an approach for testing AOPs using a State-Based approach. The main point in it is that it generates test suites for adequately testing object behavior and interaction between classes and aspects in terms of message sequences. It is based on FREE (Flattened Regular Expression) test design pattern for OOP. FREE is similar to the state model in UML. The authors extend FREE to ASM (Aspectual State Models) to specify classes and aspects.  The main process in the approach is to transform an ASM to a transition tree, where each path from the root to a terminal leaf node becomes a test case. The state-based testing approach for AOPs reveals faults like: incorrect strength of pointcut patterns and failure to preserve state invariants.

c) Aspect flow graph for testing aspect oriented programs

This approach for testing AOPs uses a hybrid testing model between a responsibility-based testing model and an implementation-based testing model. It is based on AFG (Aspect Flow Graph). AFG is constructed by merging two models, the ASSM (Aspect Scope State Model) that is a state transition diagram for an aspect-oriented program and the flow graphs for methods and advices. The flow graphs show the control flow within the methods and advices. Based on the AFG and the creation of transition tree, concert and executable code-based test suites can be derived in terms of coverage testing criteria.  The Aspect flow graph for testing aspect oriented programs reveals faults like : incorrect changes in control dependencies.

d) Unit-testing aspectual behavior: This method tests aspectual behavior, or behavior implemented in pieces of advice. It shows the possibility and requirements for clean unit testing for aspect-oriented programs using mock object mechanisms. The approach is based on the creation of JAML (Java Aspect Markup Language) and the development of JamlUnit. JamlUnit is a framework for unit testing of aspects written in JAML and it uses mock objects to simulate the execution of matched join point.  The authors of the method propose JamlUnit for performing unit testing of aspects written in JAML. They show that it works if the AOP language meets some requirements like JAML.

e) A model-based approach to test generation for aspect-oriented programs: This method for testing AOPs uses a model-based approach. Here exists the possibility to generate test suites for adequately testing interaction between classes and aspects in terms of message sequences. The approach is based on an extension to UML, that is, on aspect-oriented UML models. These models consist of three kinds of diagrams: class diagrams, aspect diagrams, and sequence diagrams.


The following table summarizes this description.



An example of testing protocols shows the following figure.





Last Updated on Friday, 18 January 2013 17:46