Automatic Test Smell Detection Using Information Retrieval Techniques

Software testing is a key activity to control the reliability of production code. Unfortunately, the effectiveness of test cases can be threatened by the presence of faults. Recent work showed that static indicators can be exploited to identify test-related issues. In particular test smells, i.e., sub-optimal design choices applied by developers when implementing test cases, have been shown to be related to test case effectiveness. While some approaches for the automatic detection of test smells have been proposed so far, they generally suffer of poor performance: as a consequence, current detectors cannot properly provide support to developers when diagnosing the quality of test cases. In this paper, we aim at making a step ahead toward the automated detection of test smells by devising a novel textual-based detector, coined TASTE (Textual AnalySis for Test smEll detection), with the aim of evaluating the usefulness of textual analysis for detecting three test smell types, General Fixture, Eager Test, and Lack of Cohesion of Methods. We evaluate TASTE in an empirical study that involves a manually-built dataset composed of 494 test smell instances belonging to 12 software projects, comparing the capabilities of our detector with those of two code metrics-based techniques proposed by Van Rompaey et al. and Greiler et al. Our results show that the structural-based detection applied by existing approaches cannot identify most of the test smells in our dataset, while TASTE is up to 44% more effective. Finally, we find that textual and structural approaches can identify different sets of test smells, thereby indicating complementarity.

[1]  Arie van Deursen,et al.  Studying the co-evolution of production and test code in open source and industrial developer test processes through repository mining , 2008, Empirical Software Engineering.

[2]  Annibale Panichella,et al.  On the Diffusion of Test Smells in Automatically Generated Test Code: An Empirical Study , 2016, 2016 IEEE/ACM 9th International Workshop on Search-Based Software Testing (SBST).

[3]  A. Yamashita,et al.  Exploring the impact of inter-smell relations on software maintainability: An empirical study , 2013, 2013 35th International Conference on Software Engineering (ICSE).

[4]  Audris Mockus,et al.  Quantifying the Effect of Code Smells on Maintenance Effort , 2013, IEEE Transactions on Software Engineering.

[5]  J. Cullum,et al.  Lanczos algorithms for large symmetric eigenvalue computations , 1985 .

[6]  Barbara J. Grosz,et al.  Natural-Language Processing , 1982, Artificial Intelligence.

[7]  Gabriele Bavota,et al.  An empirical investigation into the nature of test smells , 2016, 2016 31st IEEE/ACM International Conference on Automated Software Engineering (ASE).

[8]  Gabriele Bavota,et al.  Improving software modularization via automated analysis of latent topics and dependencies , 2014, TSEM.

[9]  Alessandro Orso,et al.  Understanding myths and realities of test-suite evolution , 2012, SIGSOFT FSE.

[10]  Alexander Chatzigeorgiou,et al.  Identification of Move Method Refactoring Opportunities , 2009, IEEE Transactions on Software Engineering.

[11]  Andy Zaidman,et al.  Analyzing the State of Static Analysis: A Large-Scale Evaluation in Open Source Software , 2016, 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

[12]  Richard A. Harshman,et al.  Indexing by Latent Semantic Analysis , 1990, J. Am. Soc. Inf. Sci..

[13]  Dewayne E. Perry,et al.  Metrics and laws of software evolution-the nineties view , 1997, Proceedings Fourth International Software Metrics Symposium.

[14]  Robert V. Binder,et al.  Testing object‐oriented software: a survey , 1996 .

[15]  Darko Marinov,et al.  DeFlaker: Automatically Detecting Flaky Tests , 2018, 2018 IEEE/ACM 40th International Conference on Software Engineering (ICSE).

[16]  Andrea De Lucia,et al.  Detecting code smells using machine learning techniques: Are we there yet? , 2018, 2018 IEEE 25th International Conference on Software Analysis, Evolution and Reengineering (SANER).

[17]  Georgios Gousios,et al.  Work practices and challenges in pull-based development: the contributor's perspective , 2015, ICSE.

[18]  Arie van Deursen,et al.  Automated Detection of Test Fixture Strategies and Smells , 2013, 2013 IEEE Sixth International Conference on Software Testing, Verification and Validation.

[19]  Yann-Gaël Guéhéneuc,et al.  DECOR: A Method for the Specification and Detection of Code and Design Smells , 2010, IEEE Transactions on Software Engineering.

[20]  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.

[21]  Andy Zaidman,et al.  Does Refactoring of Test Smells Induce Fixing Flaky Tests? , 2017, 2017 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[22]  Francesca Arcelli Fontana,et al.  Inter-smell relations in industrial and open source systems: A replication and comparative analysis , 2015, 2015 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[23]  Foutse Khomh,et al.  A Bayesian Approach for the Detection of Code and Design Smells , 2009, 2009 Ninth International Conference on Quality Software.

[24]  Gabriele Bavota,et al.  Are test smells really harmful? An empirical study , 2014, Empirical Software Engineering.

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

[26]  Mauricio A. Saca Refactoring improving the design of existing code , 2017, 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII).

[27]  M.J. Munro,et al.  Product Metrics for Automatic Identification of "Bad Smell" Design Problems in Java Source-Code , 2005, 11th IEEE International Software Metrics Symposium (METRICS'05).

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

[29]  Brian Henderson-Sellers,et al.  Object-oriented metrics: measures of complexity , 1995 .

[30]  Lu Zhang,et al.  Eliminating harmful redundancy for testing-based fault localization using test suite reduction: an experimental study , 2005, 21st IEEE International Conference on Software Maintenance (ICSM'05).

[31]  Georgios Gousios,et al.  Oops, My Tests Broke the Build: An Explorative Analysis of Travis CI with GitHub , 2017, 2017 IEEE/ACM 14th International Conference on Mining Software Repositories (MSR).

[32]  Arie van Deursen,et al.  Strategies for avoiding text fixture smells during software evolution , 2013, 2013 10th Working Conference on Mining Software Repositories (MSR).

[33]  Stéphane Ducasse,et al.  Using history information to improve design flaws detection , 2004, Eighth European Conference on Software Maintenance and Reengineering, 2004. CSMR 2004. Proceedings..

[34]  Michael K. Buckland,et al.  Annual Review of Information Science and Technology , 2006, J. Documentation.

[35]  Gabriele Bavota,et al.  When and Why Your Code Starts to Smell Bad (and Whether the Smells Go Away) , 2015, IEEE Transactions on Software Engineering.

[36]  Mark Harman,et al.  Regression testing minimization, selection and prioritization: a survey , 2012, Softw. Test. Verification Reliab..

[37]  P. Jaccard,et al.  Etude comparative de la distribution florale dans une portion des Alpes et des Jura , 1901 .

[38]  Gemma Catolino,et al.  Ensemble techniques for software change prediction: A preliminary investigation , 2018, 2018 IEEE Workshop on Machine Learning Techniques for Software Quality Evaluation (MaLTeSQuE).

[39]  Arie van Deursen,et al.  Mining Software Repositories to Study Co-Evolution of Production & Test Code , 2008, 2008 1st International Conference on Software Testing, Verification, and Validation.

[40]  Andy Zaidman,et al.  Test Code Quality and Its Relation to Issue Handling Performance , 2014, IEEE Transactions on Software Engineering.

[41]  Per Runeson,et al.  A Qualitative Survey of Regression Testing Practices , 2010, PROFES.

[42]  Foutse Khomh,et al.  Numerical Signatures of Antipatterns: An Approach Based on B-Splines , 2010, 2010 14th European Conference on Software Maintenance and Reengineering.

[43]  Radu Marinescu,et al.  Detection strategies: metrics-based rules for detecting design flaws , 2004, 20th IEEE International Conference on Software Maintenance, 2004. Proceedings..

[44]  Andrea De Lucia,et al.  Enhancing change prediction models using developer-related factors , 2018, J. Syst. Softw..

[45]  Arie van Deursen,et al.  On the Interplay Between Software Testing and Evolution and its Effect on Program Comprehension , 2008, Software Evolution.

[46]  Andrea De Lucia,et al.  [Journal First] The Scent of a Smell: An Extensive Comparison Between Textual and Structural Smells , 2018, 2018 IEEE/ACM 40th International Conference on Software Engineering (ICSE).

[47]  Aiko Fallas Yamashita,et al.  Do code smells reflect important maintainability aspects? , 2012, 2012 28th IEEE International Conference on Software Maintenance (ICSM).

[48]  Gabriele Bavota,et al.  On the diffuseness and the impact on maintainability of code smells: a large scale empirical investigation , 2018, Empirical Software Engineering.

[49]  Andy Zaidman,et al.  On the Relation of Test Smells to Software Code Quality , 2018, 2018 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[50]  Gabriele Bavota,et al.  Mining Version Histories for Detecting Code Smells , 2015, IEEE Transactions on Software Engineering.

[51]  Eduardo Figueiredo,et al.  Understanding the longevity of code smells: preliminary results of an explanatory survey , 2011, WRT '11.

[52]  Amin Milani Fard,et al.  An empirical study of bugs in test code , 2015, 2015 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[53]  David Hovemeyer,et al.  Using Static Analysis to Find Bugs , 2008, IEEE Software.

[54]  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.

[55]  Michele Lanza,et al.  Object-Oriented Metrics in Practice - Using Software Metrics to Characterize, Evaluate, and Improve the Design of Object-Oriented Systems , 2006 .

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

[57]  Gabriele Bavota,et al.  Automating extract class refactoring: an improved method and its evaluation , 2013, Empirical Software Engineering.

[58]  Stéphane Ducasse,et al.  Semantic clustering: Identifying topics in source code , 2007, Inf. Softw. Technol..

[59]  Fabio Palomba,et al.  Textual Analysis for Code Smell Detection , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[60]  Andrea De Lucia,et al.  Automatic test case generation: what if test code quality matters? , 2016, ISSTA.

[61]  Gabriele Bavota,et al.  Methodbook: Recommending Move Method Refactorings via Relational Topic Models , 2014, IEEE Transactions on Software Engineering.

[62]  Andrea De Lucia,et al.  A textual-based technique for Smell Detection , 2016, 2016 IEEE 24th International Conference on Program Comprehension (ICPC).

[63]  Gabriele Bavota,et al.  Do They Really Smell Bad? A Study on Developers' Perception of Bad Code Smells , 2014, 2014 IEEE International Conference on Software Maintenance and Evolution.

[64]  Bashar Nuseibeh,et al.  Assessing the impact of bad smells using historical information , 2007, IWPSE '07.

[65]  Andy Zaidman,et al.  Evaluating the Lifespan of Code Smells using Software Repository Mining , 2012, 2012 16th European Conference on Software Maintenance and Reengineering.

[66]  Martin F. Porter,et al.  An algorithm for suffix stripping , 1997, Program.

[67]  Denys Poshyvanyk,et al.  The conceptual cohesion of classes , 2005, 21st IEEE International Conference on Software Maintenance (ICSM'05).

[68]  Gabriele Bavota,et al.  A large-scale empirical study on the lifecycle of code smell co-occurrences , 2018, Inf. Softw. Technol..