1 Department of Computer Science, Faculty of Science, Aarhus University, Aarhus University2 University of Marburg
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.
Proceedings of the 1st Workshop on Testing Object-oriented Systems. Etoos '10, 2010