Test coverage and impact analysis for detecting refactoring faults: a study on the extract method refactoring

Refactoring validation by automated testing is a common practice in agile development processes. However, this practice can be misleading when the test suite is not adequate. Particularly, refactoring faults can be tricky and difficult to detect. While coverage analysis is a standard practice to evaluate a test suite's fault detection capability, there is usually low correlation between coverage and fault detection. In this paper, we present an exploratory study on coverage of refactoring-impacted code, in order to identify shortcomings of test suites, focusing on the Extract Method Refactoring. We consider three open-source projects and their test suites. The results show that, in most cases, the lacking of test case calling the method changed in the refactoring increases the chance of missing faults. Also, a high proportion of test cases that do not cover the callers of that method does not reveal the fault either. Additional analysis of branch coverage on the test cases exercising impacted elements show a higher chance of detecting a fault when branch coverage is also high. It seems reasonable to conclude that a combination of impact analysis with branch coverage could be highly effective in detecting faults introduced by Extract Method.

[1]  Miryung Kim,et al.  A field study of refactoring challenges and benefits , 2012, SIGSOFT FSE.

[2]  Gustavo Soares Soares Automated behavioral testing of refactoring engines , 2012, SPLASH '12.

[3]  Phyllis G. Frankl,et al.  All-uses vs mutation testing: An experimental comparison of effectiveness , 1997, J. Syst. Softw..

[4]  Augusto Sampaio,et al.  Sound refactorings , 2010, Science of Computer Programming.

[5]  Phyllis G. Frankl,et al.  An experimental comparison of the effectiveness of the all-uses and all-edges adequacy criteria , 1991, TAV4.

[6]  Stephan Diehl,et al.  Are refactorings less error-prone than other changes? , 2006, MSR '06.

[7]  Joseph Robert Horgan,et al.  Effect of test set size and block coverage on the fault detection effectiveness , 1994, Proceedings of 1994 IEEE International Symposium on Software Reliability Engineering.

[8]  Miryung Kim,et al.  RefDistiller: a refactoring aware code review tool for inspecting manual refactoring edits , 2014, SIGSOFT FSE.

[9]  Gustavo Soares,et al.  Automated Behavioral Testing of Refactoring Engines , 2013, IEEE Transactions on Software Engineering.

[10]  Ralph E. Johnson,et al.  Drag-and-drop refactoring: Intuitive and efficient program transformation , 2013, 2013 35th International Conference on Software Engineering (ICSE).

[11]  Sarfraz Khurshid,et al.  Localizing failure-inducing program edits based on spectrum information , 2011, 2011 27th IEEE International Conference on Software Maintenance (ICSM).

[12]  Rohit Gheyi,et al.  Analyzing Refactorings on Software Repositories , 2011, 2011 25th Brazilian Symposium on Software Engineering.

[13]  Phyllis G. Frankl,et al.  Further empirical studies of test effectiveness , 1998, SIGSOFT '98/FSE-6.

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

[15]  Mik Kersten,et al.  How are Java software developers using the Elipse IDE? , 2006, IEEE Software.

[16]  Patrícia Duarte de Lima Machado,et al.  A refactoring-based approach for test case selection and prioritization , 2013, 2013 8th International Workshop on Automation of Software Test (AST).

[17]  Eleni Stroulia,et al.  UMLDiff: an algorithm for object-oriented design differencing , 2005, ASE.

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

[19]  Reid Holmes,et al.  Coverage is not strongly correlated with test suite effectiveness , 2014, ICSE.

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

[21]  William Perry Effective methods for software testing, third edition , 1995 .

[22]  Ralph E. Johnson,et al.  The role of refactorings in API evolution , 2005, 21st IEEE International Conference on Software Maintenance (ICSM'05).

[23]  Stas Negara,et al.  A Comparative Study of Manual and Automated Refactorings , 2013, ECOOP.

[24]  Rohit Gheyi,et al.  Making Program Refactoring Safer , 2010, IEEE Software.

[25]  Alex Groce,et al.  Comparing non-adequate test suites using coverage criteria , 2013, ISSTA.

[26]  Emerson R. Murphy-Hill,et al.  Manual refactoring changes with automated refactoring validation , 2014, ICSE.

[27]  Michael R. Lyu,et al.  The effect of code coverage on fault detection under different testing profiles , 2005, A-MOST.

[28]  Dietmar Pfahl,et al.  Using simulation for assessing the real impact of test-coverage on defect-coverage , 2000, IEEE Trans. Reliab..

[29]  Miryung Kim,et al.  An empirical investigation into the role of API-level refactorings during software evolution , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[30]  Martin Fowler,et al.  Refactoring - Improving the Design of Existing Code , 1999, Addison Wesley object technology series.