Obsidian: Pattern-Based Unit Test Implementations
- 1 Computer Science Department, College of Charleston, Charleston, SC, USA
- 2 Computer Science Department, College of Charleston, Charleston, SC, USA
Abstract
There exist many automated unit test-generator tools for Java with the primary task of generating test cases, comprised of inputs and a corresponding oracle, each of which is explicitly paired with a specific supporting test implementation. The authors posit that this explicit pairing, or conflating, of test implementation with test case is unnecessary and counter-productive. The authors address this problem by separating the conflated concerns into two distinct tasks: 1) instantiating test implementations and 2) instantiating test cases. This paper focuses on automating the first task in support of the second with the goal of freeing the test engineer to concentrate on test case instantiation. The authors present a new open-source test-preparation tool Obsidian that produces robust, comprehensive, and maintainable unit test implementations. Obsidian, built on the JUnit framework, uses a set of context patterns and associate d algorithms combined with information from the Java Reflection API to generate these unit test implementations from Java byte code. These context patterns guide Obsidian to prepare test implementations that guarantee compilation, support exception handling, enable multiple test cases when required, and provide a suitable location for assertions about the test case outcome(s). Obsidian supports regression testing and test-driven development through its novel audits of the testing process.
- K. Beck, “Extreme Programming Explained: Embrace Change,” Addison-Wesley, Reading, 2000.
- K. Beck, “Test-Driven Development: By Example,” Addison-Wesley, Boston, 2003.
- B. Robinson, M. D. Ernst, J. H. Perkins,?V. Augustine and N. Li, “Scaling up Automated Test Generation: Automatically Generating Maintainable Regression Unit Tests for Programs,” Proceedings of the 2011 26th IEEE/ACM International Conference on Automated Software Engineering, Washington, 2011, pp. 23-32. http://dx.doi.org/10.1109/ASE.2011.6100059
- G. McCluskey, “Using Java Reflection,” 1998. http://java.sun.com/developer/ALT/Reflection/
- D. S. Rosenblum, “Towards a Method of Programming with Assertions,” In: Proceedings of the 14th International Conference on Software Engineering, ACM, New York, 1992, pp. 92-104. http://doi.acm.org/10.1145/143062.143098
- G. J. Myers, “The Art of Software Testing,” Wiley, New York, 1979.
- G. Fraser and A. Arcuri, “Evosuite: Automatic Test Suitegeneration for Object-Oriented Software,” ACM Symposium on the Foundations of Software Engineering (FSE), 2011, pp. 416-419.
- C. Pacheco and M. Ernst, “Randoop: Feedback-Directed Random Testing for Java,” Conference on Object Oriented Programming Systems Languages and Applications: Companion to the 22nd ACM SIGPLAN Conference on Object Oriented Programming Systems and Applications Companion, Vol. 21, 2007, pp. 815-816.
- N. Tillmann and J. De Halleux, “Pex-White Box Test Generation for Net,” Tests and Proofs, Vol. 4966, 2008, pp. 134-153.
- C. Oriat, “Jartege: A Tool for Random Generation of Unit Tests for Java Classes,” Quality of Software Architectures and Software Quality, Vol. 3712, 2005, pp. 242-256. http://dx.doi.org/10.1007/1155 8569_18
- K. Sen and G. Agha, “Cute and Jcute: Concolic Unit Testing and Explicit Path Model-Checking Tools,” Computer Aided Verification, Vol. 4144, 2006, pp. 419-423. http://dx.doi.org/10.1007/11817963_38
- C. Csallner and Y. Smaragdakis, “Jcrasher: An Automatic Robustness Tester for Java,” Software: Practice and Experience, Vol. 34, No. 11, 2004, pp. 1025-1050. http://dx.doi.org/10.1002/spe.602
- M. Boshernitsan and R. Doong, A. Savoia, “From Daikon to Agitator: Lessons and Challenges in Building a Commercial Tool for Developer Testing,” In: Proceedings of ISSTA 2006, ACM, New York, 2006, pp. 169-180.