ReAssert: Suggesting Repairs for Broken Unit Tests

Developers often change software in ways that cause tests to fail. When this occurs, developers must determine whether failures are caused by errors in the code under test or in the test code itself. In the latter case, developers must repair failing tests or remove them from the test suite. Repairing tests is time consuming but beneficial, since removing tests reduces a test suite's ability to detect regressions. Fortunately, simple program transformations can repair many failing tests automatically. We present ReAssert, a novel technique and tool that suggests repairs to failing tests' code which cause the tests to pass. Examples include replacing literal values in tests, changing assertion methods, or replacing one assertion with several. If the developer chooses to apply the repairs, ReAssert modifies the code automatically. Our experiments show that ReAssert can repair many common test failures and that its suggested repairs correspond to developers' expectations.

[1]  Atif M. Memon,et al.  Automatically repairing event sequence-based GUI test suites for regression testing , 2008, TSEM.

[2]  Troels Mørch Test Driven Development , 2005 .

[3]  Michael D. Ernst,et al.  Feedback-Directed Random Test Generation , 2007, 29th International Conference on Software Engineering (ICSE'07).

[4]  A. Orso,et al.  Efficient and precise dynamic impact analysis using execute-after sequences , 2005, Proceedings. 27th International Conference on Software Engineering, 2005. ICSE 2005..

[5]  Nikolai Tillmann,et al.  Pex-White Box Test Generation for .NET , 2008, TAP.

[6]  Tao Xie,et al.  Augmenting Automatically Generated Unit-Test Suites with Regression Oracle Checking , 2006, ECOOP.

[7]  Sudheendra Hangal,et al.  Tracking down software bugs using automatic anomaly detection , 2002, ICSE '02.

[8]  Andreas Zeller Automated Debugging: Are We Close , 2001, Computer.

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

[10]  S. Inglis,et al.  Jumble Java Byte Code to Measure the Effectiveness of Unit Tests , 2007, Testing: Academic and Industrial Conference Practice and Research Techniques - MUTATION (TAICPART-MUTATION 2007).

[11]  Marat Boshernitsan,et al.  From daikon to agitator: lessons and challenges in building a commercial tool for developer testing , 2006, ISSTA '06.

[12]  Mary Lou Soffa,et al.  Regression testing of GUIs , 2003, ESEC/FSE-11.

[13]  Thomas D. LaToza,et al.  Software Development at Microsoft Observed , 2005 .

[14]  Xin Yao,et al.  A novel co-evolutionary approach to automatic software bug fixing , 2008, 2008 IEEE Congress on Evolutionary Computation (IEEE World Congress on Computational Intelligence).

[15]  Yannis Smaragdakis,et al.  DSD-Crasher: A hybrid analysis tool for bug finding , 2006, TSEM.

[16]  Frank Tip,et al.  A survey of program slicing techniques , 1994, J. Program. Lang..

[17]  Jeffrey Overbey,et al.  Inferring Method Effect Summaries for Nested Heap Regions , 2009, 2009 IEEE/ACM International Conference on Automated Software Engineering.

[18]  Barry W. Boehm,et al.  Discipline and practices of TDD: (test driven development) , 2003, OOPSLA '03.

[19]  David W. Binkley,et al.  Program slicing , 2008, 2008 Frontiers of Software Maintenance.

[20]  Darko Marinov,et al.  A Framework for State-Space Exploration of Java-Based Actor Programs , 2009, 2009 IEEE/ACM International Conference on Automated Software Engineering.

[21]  Atif M. Memon,et al.  DART: a framework for regression testing "nightly/daily builds" of GUI applications , 2003, International Conference on Software Maintenance, 2003. ICSM 2003. Proceedings..

[22]  H. Cleve,et al.  Locating causes of program failures , 2005, Proceedings. 27th International Conference on Software Engineering, 2005. ICSE 2005..

[23]  Michael D. Ernst,et al.  An experimental evaluation of continuous testing during development , 2004, ISSTA '04.

[24]  Wayne Zachary,et al.  A Tool for Automatically Generating Transcripts of Human-Computer Interaction , 1993 .

[25]  Nikolai Tillmann,et al.  Unit tests reloaded: parameterized unit testing with symbolic execution , 2006, IEEE Software.

[26]  Martin Erwig,et al.  Goal-directed debugging of spreadsheets , 2005, 2005 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC'05).

[27]  William E. Howden,et al.  Weak Mutation Testing and Completeness of Test Sets , 1982, IEEE Transactions on Software Engineering.

[28]  Marat Boshernitsan,et al.  Predicting Effectiveness of Automatic Testing Tools , 2008, 2008 23rd IEEE/ACM International Conference on Automated Software Engineering.

[29]  Tao Xie,et al.  Time-aware test-case prioritization using integer linear programming , 2009, ISSTA.

[30]  Lech Madeyski,et al.  Test-Driven Development - An Empirical Evaluation of Agile Practice , 2009 .

[31]  Jeffrey Overbey,et al.  A type and effect system for deterministic parallel Java , 2009, OOPSLA '09.

[32]  Cem Kaner Improving the maintainability of automated test suites , 1997 .

[33]  Rajiv Gupta,et al.  BugFix: A learning-based tool to assist developers in fixing bugs , 2009, 2009 IEEE 17th International Conference on Program Comprehension.

[34]  Neelam Gupta,et al.  Automated Debugging Using Path-Based Weakest Preconditions , 2004, FASE.

[35]  Janusz W. Laski,et al.  Dynamic slicing of computer programs , 1990, J. Syst. Softw..

[36]  Martin C. Rinard,et al.  Automatic detection and repair of errors in data structures , 2003, OOPSLA '03.

[37]  Joseph Robert Horgan,et al.  Dynamic program slicing , 1990, PLDI '90.

[38]  Chen Fu,et al.  Maintaining and evolving GUI-directed test scripts , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[39]  Matthew B. Dwyer,et al.  Differential symbolic execution , 2008, SIGSOFT '08/FSE-16.

[40]  Kent L. Beck,et al.  Test-driven Development - by example , 2002, The Addison-Wesley signature series.

[41]  Frank Tip,et al.  Change impact analysis for object-oriented programs , 2001, PASTE '01.

[42]  Andreas Zeller,et al.  Efficient mutation testing by checking invariant violations , 2009, ISSTA.

[43]  Sarfraz Khurshid,et al.  Assertion-based repair of complex data structures , 2007, ASE.

[44]  Frank Tip,et al.  Chianti: a tool for change impact analysis of java programs , 2004, OOPSLA.

[45]  John T. Stasko,et al.  Visualization of test information to assist fault localization , 2002, ICSE '02.

[46]  James M. Purtilo,et al.  Parse tree annotations , 1989, CACM.

[47]  Claire Le Goues,et al.  Automatically finding patches using genetic programming , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[48]  Tao Xie,et al.  UnitPlus: assisting developer testing in Eclipse , 2007, eclipse '07.