An empirical analysis of the distribution of unit test smells and their impact on software maintenance

Unit testing represents a key activity in software development and maintenance. Test suites with high internal quality facilitate maintenance activities, such as code comprehension and regression testing. Several guidelines have been proposed to help developers write good test suites. Unfortunately, such rules are not always followed resulting in the presence of bad test code smells (or simply test smells). Test smells have been defined as poorly designed tests and their presence may negatively affect the maintainability of test suites and production code. Despite the many studies that address code smells in general, until now there has been no empirical evidence regarding test smells (i) distribution in software systems nor (ii) their impact on the maintainability of software systems. This paper fills this gap by presenting two empirical studies. The first study is an exploratory analysis of 18 software systems (two industrial and 16 open source) aimed at analyzing the distribution of test smells in source code. The second study, a controlled experiment involving twenty master students, is aimed at analyzing whether the presence of test smells affects the comprehension of source code during software maintenance. The results show that (i) test smells are widely spread throughout the software systems studied and (ii) most of the test smells have a strong negative impact on the comprehensibility of test suites and production code.

[1]  Gerard Meszaros,et al.  xUnit Test Patterns: Refactoring Test Code , 2007 .

[2]  Marco Torchiano,et al.  How Developers' Experience and Ability Influence Web Application Comprehension Tasks Supported by UML Stereotypes: A Series of Four Experiments , 2010, IEEE Transactions on Software Engineering.

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

[4]  Serge Demeyer,et al.  On The Detection of Test Smells: A Metrics-Based Approach for General Fixture and Eager Test , 2007, IEEE Trans. Software Eng..

[5]  Dag I. K. Sjøberg,et al.  Evaluating the effect of a delegated versus centralized control style on the maintainability of object-oriented software , 2004, IEEE Transactions on Software Engineering.

[6]  Gabriele Bavota,et al.  SCOTCH: Test-to-code traceability using slicing and conceptual coupling , 2011, 2011 27th IEEE International Conference on Software Maintenance (ICSM).

[7]  Brian Foote,et al.  Designing Reusable Classes , 2001 .

[8]  B. Van Rompaey,et al.  On The Detection of Test Smells: A Metrics-Based Approach for General Fixture and Eager Test , 2007, IEEE Transactions on Software Engineering.

[9]  Bart Van Rompaey,et al.  TestQ: Exploring Structural and Maintenance Characteristics of Unit Test Suites , 2008 .

[10]  Arie van Deursen,et al.  The Video Store Revisited – Thoughts on Refactoring and Testing , 2002 .

[11]  Stéphane Ducasse,et al.  Rule-based Assessment of Test Quality , 2007, J. Object Technol..

[12]  Claes Wohlin,et al.  Experimentation in software engineering: an introduction , 2000 .

[13]  R. A. Groeneveld,et al.  Practical Nonparametric Statistics (2nd ed). , 1981 .

[14]  F. W. Calliss,et al.  An experiment investigating the effect of information hiding on maintainability , 1993, Proceedings of Phoenix Conference on Computers and Communications.

[15]  Jacob Cohen Statistical Power Analysis for the Behavioral Sciences , 1969, The SAGE Encyclopedia of Research Design.

[16]  David J. Groggel,et al.  Practical Nonparametric Statistics , 2000, Technometrics.

[17]  Foutse Khomh,et al.  An exploratory study of the impact of antipatterns on class change- and fault-proneness , 2011, Empirical Software Engineering.

[18]  Arie van Deursen,et al.  Refactoring test code , 2001 .

[19]  Norman Wilde,et al.  Maintaining object-oriented software , 1993, IEEE Software.

[20]  P. Lachenbruch Statistical Power Analysis for the Behavioral Sciences (2nd ed.) , 1989 .

[21]  Foutse Khomh,et al.  An Empirical Study of the Impact of Two Antipatterns, Blob and Spaghetti Code, on Program Comprehension , 2011, 2011 15th European Conference on Software Maintenance and Reengineering.

[22]  Giuliano Antoniol,et al.  Recovering Traceability Links between Code and Documentation , 2002, IEEE Trans. Software Eng..