Amplifying tests to validate exception handling code

Validating code handling exceptional behavior is difficult, particularly when dealing with external resources that may be noisy and unreliable, as it requires: 1) the systematic exploration of the space of exceptions that may be thrown by the external resources, and 2) the setup of the context to trigger specific patterns of exceptions. In this work we present an approach that addresses those difficulties by performing an exhaustive amplification of the space of exceptional behavior associated with an external resource that is exercised by a test suite. Each amplification attempts to expose a program exception handling construct to new behavior by mocking an external resource so that it returns normally or throws an exception following a predefined pattern. Our assessment of the approach indicates that it can be fully automated, is powerful enough to detect 65% of the faults reported in the bug reports of this kind, and is precise enough that 77% of the detected anomalies correspond to faults fixed by the developers.

[1]  David S. Rosenblum,et al.  Context-Aware Adaptive Applications: Fault Patterns and Their Automated Identification , 2010, IEEE Transactions on Software Engineering.

[2]  Alessandro Orso,et al.  Automated support for development, maintenance, and testing in the presence of implicit flow control , 2004, Proceedings. 26th International Conference on Software Engineering.

[3]  Tao Xie,et al.  Mining exception-handling rules as sequence association rules , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[4]  Saurabh Sinha,et al.  Analysis and Testing of Programs with Exception Handling Constructs , 2000, IEEE Trans. Software Eng..

[5]  Chen Fu,et al.  Testing of java web services for robustness , 2004, ISSTA '04.

[6]  Alessandro Orso,et al.  Automated Support for Development, Maintenance, and Testing in the Presence of Implicit Control Flow , 2004, ICSE.

[7]  Martin P. Robillard,et al.  Static analysis to support the evolution of exception structure in object-oriented systems , 2003, TSEM.

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

[9]  Daniel Jackson,et al.  Elements of style: analyzing a software design feature with a counterexample detector , 1996, ISSTA '96.

[10]  Jong-Deok Choi,et al.  Efficient and precise modeling of exceptions for the analysis of Java programs , 1999, PASTE '99.

[11]  Sarfraz Khurshid,et al.  Software assurance by bounded exhaustive testing , 2004, IEEE Transactions on Software Engineering.

[12]  Westley Weimer,et al.  Automatic documentation inference for exceptions , 2008, ISSTA '08.

[13]  George C. Necula,et al.  Mining Temporal Specifications for Error Detection , 2005, TACAS.

[14]  Chen Fu,et al.  Exception-Chain Analysis: Revealing Exception Handling Architecture in Java Server Applications , 2007, 29th International Conference on Software Engineering (ICSE'07).

[15]  Tao Xie,et al.  Mining API Error-Handling Specifications from Source Code , 2009, FASE.

[16]  Darko Marinov,et al.  Automated testing of refactoring engines , 2007, ESEC-FSE '07.

[17]  David S. Rosenblum,et al.  Automated Generation of Context-Aware Tests , 2007, 29th International Conference on Software Engineering (ICSE'07).

[18]  Shing-Chi Cheung,et al.  Inconsistency detection and resolution for context-aware middleware support , 2005, ESEC/FSE-13.