Testing Object-Oriented Programs using Dynamic Aspects and Non-Determinism

Michael Achenbach, Klaus Ostermann. Testing Object-Oriented Programs using Dynamic Aspects and Non-Determinism. In Proceedings of the 1st ECOOP Workshop on Testing Object-Oriented Systems. ACM Press, Maribor, Slovenia, 2010.

Abstract

The implementation of unit tests with mock objects and stubs often involves substantial manual work. Stubbed methods return simple default values, therefore variations of these values require separate test cases. The integration of mock objects often requires more infrastructure code and design decisions exposing private data. We present an approach that both improves the expressiveness of test cases using non-deterministic choice and reduces design modifications using dynamic aspect-oriented programming techniques.

Non-deterministic choice facilitates local definitions of multiple executions without parameterization or generation of tests. It also eases modelling naturally non-deterministic program features like IO or multi-threading in integration tests. Dynamic AOP facilitates powerful design adaptations without exposing test features, keeping the scope of these adaptations local to each test. We also combine non-determinism and dynamic aspects in a new approach to testing multi-threaded programs using co-routines.