Java Test Driver Generation from Object-Oriented Interaction Traces

  • Authors:
  • Frank S. de Boer;Marcello B. Bonsangue;Andreas Grüner;Martin Steffen

  • Affiliations:
  • CWI, Amsterdam, The Netherlands;LIACS, Leiden, The Netherlands;LIACS, Leiden, The Netherlands;UiO, Oslo, Norway

  • Venue:
  • Electronic Notes in Theoretical Computer Science (ENTCS)
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

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 specified at the Java program level. Though using directly the programming language may facilitate acceptance by software developers at first sight, the entailed syntax noise sometimes distracts from the actual test specification, speaking about interaction traces. We propose a Java-like test specification 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 reflects the nested calls and return structure of thread-based interaction at the interface. From a given trace specification, a testing environment, i.e., a set of classes for mock objects, is synthesized. The design of the specification 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 specification notation. On the other hand, additional expressions in the specification 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.