Dsc+Mock

Mainul Islam, Christoph Csallner
2010 Proceedings of the Eighth International Workshop on Dynamic Analysis - WODA '10  
Coding against interfaces is a powerful technique in objectoriented programming. It decouples code and enables independent development. However, code decoupled via interfaces poses additional challenges for testing and dynamic execution, as not all pieces of code that are necessary to execute a piece of code may be available. For example, a client class may be coded against several interfaces. For testing, however, no classes may be available that implement the interfaces. This means that, to
more » ... pport testing, we need to generate mock classes along with test cases. Current test case generators do not fully support this kind of independent development and testing. In this paper, we describe a novel technique for generating test cases and mock classes for object-oriented programs that are coded against interfaces. We report on our initial experience with an implementation of our technique for Java. Our prototype implementation achieved higher code coverage than related tools that do not generate mock classes, such as Pex. • We provide simple code examples that existing test case generation techniques fail to cover. • We motivate that such code can be covered with custom generated classes we call mock-classes.
doi:10.1145/1868321.1868326 dblp:conf/issta/IslamC10 fatcat:v3hh3q5x7zc7pmt4b2t6ilrcnq