An approach for testing pointcut descriptors in AspectJ

Aspect‐oriented programming (AOP) promises better software quality through enhanced modularity. Crosscutting concerns are encapsulated in separate units called aspects and are introduced at specific points in the base program at compile time or runtime. However, aspect‐oriented mechanisms also introduce new risks for reliability that must be tackled by specific testing techniques in order to fully benefit from the use of AOP. This paper focuses on the pointcut descriptor (PCD) that declares the set of points in the base program's execution where the crosscutting concern must be woven. A fault in the PCD can have a ripple effect and result in many different faults. New behavior may be added in unexpected places, or places where new behavior should be added may be missed. When implementing aspect‐oriented programs with AspectJ, JUnit is most commonly used to test the program. However, JUnit does not offer any mechanism to look for faults specifically located in the PCD. As a consequence, these faults can be detected only through complex test scenarios and side effects that are difficult to trigger and observe. This paper proposes to monitor the execution of advices in an aspect‐oriented program and use this information to build test cases that target faults in PCDs. The AdviceTracer tool has been developed to automatically monitor and store all information related to advice executions. It also offers a set of operations that can be used to check the presence or absence of advices at specific points in the execution. These operations improve the definition of an oracle for PCD test cases. An empirical study is performed to compare JUnit and AdviceTracer for testing PCDs in terms of the complexity of test cases and their ability to detect faults. The study is performed on a Healthwatcher system that has 93 classes and 19 PCDs. It reveals that test cases that use AdviceTracer to test PCDs are easier to write (shorter test cases and written in less time than with JUnit) and detect more faults. Copyright © 2011 John Wiley & Sons, Ltd.

[1]  Sudipto Ghosh,et al.  A Joinpoint Coverage Measurement Tool for Evaluating the Effectiveness of Test Inputs for AspectJ Programs , 2008, 2008 19th International Symposium on Software Reliability Engineering (ISSRE).

[2]  Kris De Volder,et al.  Tool support for understanding and diagnosing pointcut expressions , 2008, AOSD.

[3]  Cristina V. Lopes,et al.  Testing aspect-oriented programming Pointcut Descriptors , 2006, WTAOP '06.

[4]  Mark Harman,et al.  Automated test data generation for aspect-oriented programs , 2009, AOSD '09.

[5]  Sérgio Soares,et al.  Distribution and persistence as aspects , 2006, Softw. Pract. Exp..

[6]  Alessandro Orso,et al.  Regression test selection for Java software , 2001, OOPSLA '01.

[7]  Jürgen Graf,et al.  Using pointcut delta analysis to support evolution of aspect-oriented software , 2005, 21st IEEE International Conference on Software Maintenance (ICSM'05).

[8]  Atanas Rountev,et al.  Regression Test Selection for AspectJ Software , 2007, 29th International Conference on Software Engineering (ICSE'07).

[9]  Kris Gybels,et al.  On the Existence of the AOSD-Evolution Paradox , 2003 .

[10]  David Notkin,et al.  Detecting Redundant Unit Tests for AspectJ Programs , 2006, 2006 17th International Symposium on Software Reliability Engineering.

[11]  Auri Marcelo Rizzo Vincenzi,et al.  Control and data flow structural testing criteria for aspect-oriented programs , 2007, J. Syst. Softw..

[12]  Tao Xie,et al.  A framework and tool supports for generating test inputs of AspectJ programs , 2006, AOSD.

[13]  Olivier Barais,et al.  Improving maintenance in AOP through an interaction specification framework , 2008, 2008 IEEE International Conference on Software Maintenance.

[14]  Tao Xie,et al.  Automated Generation of Pointcut Mutants for Testing Pointcuts in AspectJ Programs , 2008, 2008 19th International Symposium on Software Reliability Engineering (ISSRE).

[15]  Yves Le Traon,et al.  AjMutator: A Tool for the Mutation Analysis of AspectJ Pointcut Descriptors , 2009, 2009 International Conference on Software Testing, Verification, and Validation Workshops.

[16]  Fabiano Cutigi Ferrari,et al.  Mutation Testing for Aspect-Oriented Programs , 2008, 2008 1st International Conference on Software Testing, Verification, and Validation.

[17]  Richard J. Lipton,et al.  Hints on Test Data Selection: Help for the Practicing Programmer , 1978, Computer.

[18]  W. Marsden I and J , 2012 .

[19]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[20]  Yves Le Traon,et al.  Inquiring the usage of aspect-oriented programming: An empirical study , 2009, 2009 IEEE International Conference on Software Maintenance.

[21]  James M. Bieman,et al.  Towards the Systematic Testing of Aspect-Oriented Programs , 2004 .

[22]  Dianxiang Xu,et al.  State-based incremental testing of aspect-oriented programs , 2006, AOSD.

[23]  Yves Le Traon,et al.  A Test-Driven Approach to Developing Pointcut Descriptors in AspectJ , 2009, 2009 International Conference on Software Testing Verification and Validation.

[24]  Roger T. Alexander,et al.  A Candidate Fault Model for AspectJ Pointcuts , 2006, 2006 17th International Symposium on Software Reliability Engineering.

[25]  Frederick C. Harris,et al.  Estimation and Enhancement of Real-Time Software Reliability Through Mutation Analysis , 1992, IEEE Trans. Computers.

[26]  Christian Koppen,et al.  PCDiff : Attacking the Fragile Pointcut Problem , 2004 .

[27]  Laurie J. Hendren,et al.  SableCC, an object-oriented compiler framework , 1998, Proceedings. Technology of Object-Oriented Languages. TOOLS 26 (Cat. No.98EX176).

[28]  Hidehiko Masuhara,et al.  Test-based pointcuts for robust and fine-grained join point specification , 2008, AOSD.

[29]  Roger T. Alexander,et al.  Distributing classes with woven concerns: an exploration of potential fault scenarios , 2005, AOSD '05.

[30]  Gregor Kiczales,et al.  Aspect-oriented programming , 2001, ESEC/FSE-9.