Unit Testing Aspectual Behavior

Cristina Videira Lopes and Trung Ngo

Abstract

In the Java Aspect Markup Language (JAML), aspects are represented using two kinds of modules: a) regular java classes, encapsulating aspectual behavior; and b) XML binders, defining aspectual compositions. Besides leveraging the abundance of software engineering tools available for Java and XML, this approach for aspect-oriented programming also provides opportunities for testing aspects as independent units. In this position paper, JamlUnit, an extension of JUnit, is proposed as a framework for performing unit testing of aspects written in JAML. More specifically, this paper focus on testing aspectual behavior, i.e. behavior implemented in pieces of advice. JamlUnit uses mock objects that emulate execution context (join point) information. JamlUnit shows that performing unit testing on aspectual behavior is possible and relatively straightforward, as long as the AOP language observes a couple of simple requirements.

Appears in Workshop on Testing Aspect-Oriented Programs, held in conjunction with AOSD'05.

Copyright (c) 2005 by the authors. All rights reserved.

Download paper.