5 research outputs found

    A Test-Driven Approach to Developing Pointcut Descriptors in AspectJ

    Get PDF
    International audienceAspect-oriented programming (AOP) languages introduce new constructs that can lead to new types of faults, which must be targeted by testing techniques. In particular, AOP languages such as AspectJ use a pointcut descriptor (PCD) that provides a convenient way to declaratively specify a set of joinpoints in the program where the aspect should be woven. However, a major difficulty when testing that the PCD matches the intended set of joinpoints is the lack of precise specification for this set other than the PCD itself. In this paper, we propose a test-driven approach for the development and validation of the PCD. We developed a tool, AdviceTracer, which enriches the JUnit API with new types of assertions that can be used to specify the expected joinpoints. In order to validate our approach, we also developed a mutation tool that systematically injects faults into PCDs. Using these two tools, we perform experiments to validate that our approach can be applied for specifying expected joinpoints and for detecting faults in the PCD

    Using Class Interfaces and Mock Objects to Unit Test Aspects

    Get PDF
    In object oriented programming (OOP) class objects are individual units of code that encapsulate the desired functionality of each object. AOP is an attempt to handle the cross-cutting concerns that represent functionality needed by a class, but is not specific to that class. The cross-cutting functionality is implemented in AOP by using a class-like structure, the aspect. Aspects do not have their own context and as such are dependent upon other objects for their context. By not having their own context it is difficult to test the functionality of aspects. This study investigated the effectiveness of using class interfaces and mock objects to unit test aspects. This was accomplished by having the mock object inherit from the same interface as the base code, so that the mock object could be swapped in for the aspect
    corecore