In the context of test-driven development for object-oriented programs, mock objects are increasingly used for unit testing. Several Java mock object frameworks exist, which all have in common that mock objects, realizing the test environment, are directly speci ed at the Java program level. Though using directly the programming language may facilitate acceptance by software developers at rst sight, the entailed syntax noise sometimes distracts from the actual test speci cation, speaking about interaction traces. We propose a Java-like test speci cation language, which allows to describe the behavior of the test harness in terms of the expected interaction traces between the program and its environment. The language is tailor-made for Java, e.g., in that it re ects the nested calls and return structure of thread-based interaction at the interface. From a given trace speci cation, a testing environment, i.e., a set of classes for mock objects, is synthesized. The design of the speci cation language is a careful balance between two goals: using programming constructs in Java-like notation helps the programmer to specify the interaction without having to learn a completely new speci cation notation. On the other hand, additional expressions in the speci cation language allow to specify the desired trace behavior in a concise, abstract way, hiding the intricacies of the required synchronization code at the lower-level programming language.
, , , ,
Elsevier B.V.
Electronic Notes in Theoretical Computer Science
MOBI-J (vervolg)
International Workshop on Harnessing Theories for Tool Support in Software
Computer Security

Bonsangue, M., de Boer, F., Gruener, A., & Steffen, M. (2009). Java Test Driver Generation from Object-Oriented Interaction Traces. In Procedings of the 2nd International Workshop on Harnessing Theories for Tool Support in Software (TTSS 2008) (pp. 33–47). Elsevier B.V.