Automated Unit Test Generation for Classes with Environment Dependencies - ASE 2014
by Andrea Arcuri, Gordon Fraser, Juan Pablo Galeotti

Proceedings of the 2014 International Conference on Automated Software Engineering (ASE), Pages 79-90, ASE '14, ACM, September 2014.

ISBN: 978-1-4503-3013-8

Digital Library via DOI: 10.1145/2642937.2642986 - Local copy: Download as PDF file.

Abstract

Automated test generation for object-oriented software typically consists of producing sequences of calls aiming at high code coverage. In practice, the success of this process may be inhibited when classes interact with their environment, such as the file system, network, user-interactions, etc. This leads to two major problems: First, code that depends on the environment can sometimes not be fully covered simply by generating sequences of calls to a class under test, for example when execution of a branch depends on the contents of a file. Second, even if code that is environment- dependent can be covered, the resulting tests may be unstable, i.e., they would pass when first generated, but then may fail when executed in a different environment. For example, tests on classes that make use of the system time may have failing assertions if the tests are executed at a different time than when they were generated. In this paper, we apply bytecode instrumentation to automatically separate code from its environmental dependencies, and ex- tend the EVOSUITE Java test generation tool such that it can explicitly set the state of the environment as part of the sequences of calls it generates. Using a prototype implementation, which handles a wide range of environmental interactions such as the file system, console inputs and many non-deterministic functions of the Java virtual machine (JVM), we performed experiments on 100 Java projects randomly selected from SourceForge (the SF100 corpus). The results show significantly improved code coverage ? in some cases even in the order of +80%/+90%. Furthermore, our techniques reduce the number of unstable tests by more than 50%.

BibTeX Entry

@inproceedings{arcuri-ase-2014,
    title = "Automated Unit Test Generation for Classes with Environment Dependencies",
    author = "Andrea Arcuri and Gordon Fraser and Juan Pablo Galeotti",
    year = "2014",
    month = sep,
    booktitle = "Proceedings of the 2014 International Conference on Automated Software Engineering (ASE)",
    location = "Vasteras, Sweden",
    pages = "79--90",
    publisher = "ACM",
    series = "ASE '14",
    ISBN = "978-1-4503-3013-8",
    doi = "10.1145/2642937.2642986",
}

Show all publications of the Software Engineering Chair.