Automatic Extraction of Object-Oriented Observer Abstractions from Unit-Test Executions

Unit testing has become a common step in software development. Although manually created unit tests are valuable, they are often insufficient; therefore, programmers can use an automatic unit-test-generation tool to produce a large number of additional tests for a class. However, without a priori specifications, programmers cannot practically inspect the execution of each automatically generated test. In this paper, we develop the observer abstraction approach for automatically extracting object-state-transition information of a class from unit-test executions, without requiring a priori specifications. Given a class and a set of its initial tests generated by a third-party tool, we generate new tests to augment the initial tests and produce the abstract state of an object based on the return values of a set of observers (public methods with non-void returns) invoked on the object. From the executions of both the new and initial tests, we automatically extract observer abstractions, each of which is an object state machine (OSM): a state in the OSM represents an abstract state and a transition in the OSM represents method calls. We have implemented the Obstra tool for the approach and have applied the approach on complex data structures; our experiences suggest that this approach provides useful object-state-transition information for programmers to inspect unit-test executions effectively.

[1]  Sarfraz Khurshid,et al.  Korat: automated testing based on Java predicates , 2002, ISSTA '02.

[2]  Monica S. Lam,et al.  Automatic extraction of object-oriented component interfaces , 2002, ISSTA '02.

[3]  Ken Arnold,et al.  The Java Programming Language , 1996 .

[4]  Margus Veanes,et al.  Generating finite state machines from abstract state machines , 2002, ISSTA '02.

[5]  A. Jefferson Offutt,et al.  Integration testing of object‐oriented components using finite state machines , 2006, Softw. Test. Verification Reliab..

[6]  Emden R. Gansner,et al.  An open graph visualization system and its applications to software engineering , 2000, Softw. Pract. Exp..

[7]  David Notkin,et al.  Tool-assisted unit test selection based on operational violations , 2003, 18th IEEE International Conference on Automated Software Engineering, 2003. Proceedings..

[8]  Hassen Saïdi,et al.  Construction of Abstract State Graphs with PVS , 1997, CAV.

[9]  Radu Iosif,et al.  Symmetry Reduction Criteria for Software Model Checking , 2002, SPIN.

[10]  Michal Young,et al.  Residual test coverage monitoring , 1999, Proceedings of the 1999 International Conference on Software Engineering (IEEE Cat. No.99CB37002).

[11]  Dung Nguyen Design patterns for data structures , 1998, SIGCSE '98.

[12]  Matthew B. Dwyer,et al.  Tool-supported program abstraction for finite-state verification , 2001, Proceedings of the 23rd International Conference on Software Engineering. ICSE 2001.

[13]  David Notkin,et al.  Mutually Enhancing Test Generation and Specification Inference , 2003, FATES.

[14]  Klaus Havelund,et al.  Model Checking Programs , 2004, Automated Software Engineering.

[15]  David Notkin,et al.  Rostra: a framework for detecting redundant object-oriented unit tests , 2004, Proceedings. 19th International Conference on Automated Software Engineering, 2004..

[16]  David Notkin,et al.  Rostra: a framework for detecting redundant object-oriented unit tests , 2004 .

[17]  Emden R. Gansner,et al.  An open graph visualization system and its applications to software engineering , 2000 .

[18]  John Penix,et al.  Using predicate abstraction to reduce object-oriented programs for model checking , 2000, FMSP '00.

[19]  Amer Diwan,et al.  Discovering Algebraic Specifications from Java Classes , 2003, ECOOP.

[20]  Mary Lou Soffa,et al.  Automated test data generation using an iterative relaxation method , 1998, SIGSOFT '98/FSE-6.

[21]  Barbara Liskov,et al.  Program Development in Java - Abstraction, Specification, and Object-Oriented Design , 1986 .

[22]  David Lee,et al.  Principles and methods of testing finite state machines-a survey , 1996, Proc. IEEE.

[23]  David Chenho Kung,et al.  On object state testing , 1994, Proceedings Eighteenth Annual International Computer Software and Applications Conference (COMPSAC 94).

[24]  David J. Robson,et al.  The state-based testing of object-oriented programs , 1993, 1993 Conference on Software Maintenance.

[25]  James R. Larus,et al.  Mining specifications , 2002, POPL '02.

[26]  William G. Griswold,et al.  Dynamically discovering likely program invariants to support program evolution , 1999, Proceedings of the 1999 International Conference on Software Engineering (IEEE Cat. No.99CB37002).

[27]  Tao Xie,et al.  Improving Generation of Object-Oriented Test Suites by Avoiding Redundant Tests , 2004 .