LCS Publication Details
Publication Title: Automatic Test Factoring for Java
Publication Author: Saff, David
Additional Authors: Shay Artzi, Jeff H. Perkins, Michael D. Ernst
LCS Document Number: MIT-LCS-TR-991
Publication Date: 6-8-2005
LCS Group: Program Analysis
Additional URL:
Abstract:
Test factoring creates fast, focused unit tests from slow system-wide tests; each new unit test exercises only a subset of the functionality exercised by the system test. Augmenting a test suite with factored unit tests should catch errors earlier in a test run. One way to factor a test is to introduce 'mock' objects. If a test exercises a component T, which interacts with another component E (the 'environment'), the implementation of E can be replaced by a mock. The mock checks that T's calls to E are as expected, and it simulates E's behavior in response. We introduce an automatic technique for test factoring. Given a system test for T and E, and a record of T's and E's behavior when the system test is run, test factoring generates unit tests for T in which E is mocked. The factored tests can isolate bugs in T from bugs in E and, if E is slow or expensive, improve test performance or cost. We have built an implementation of automatic dynamic test factoring for the Java language. Our experimental data indicates that it can reduce the running time of a system test suite by up to an order of magnitude.
To obtain this publication:

To purchase a printed copy of this publication please contact MIT Document Services.