Generating Refactoring Proposals to Remove Clones from Automated System Tests

Automated system tests often have many clones, which make them complex to understand and costly to maintain. Unfortunately, removing clones is challenging as there are numerous possibilities of how to refactor them to reuse components such as subroutines. Additionally, clones often overlap partly which makes it particularly difficult to decide which parts to extract. If done wrongly, reuse potential is not leveraged optimally and structures between tests and reuse components will become unnecessarily complex. We present a method to support test engineers in extracting overlapping clones. Using grammar inference algorithms, we generate a refactoring proposal that demonstrates test engineers how overlapping clones can be extracted. Furthermore, we visualize the generated refactoring proposal to make it easily understandable for test engineers. An industrial case study demonstrates that our approach helps test engineers to gain information of the reuse potential of test suites and guides them to perform refactorings.

[1]  Elmar Jürgens,et al.  Can clone detection support test comprehension? , 2012, 2012 20th IEEE International Conference on Program Comprehension (ICPC).

[2]  A. Orso,et al.  Retesting software during development and maintenance , 2008, 2008 Frontiers of Software Maintenance.

[3]  Gabriele Bavota,et al.  An empirical analysis of the distribution of unit test smells and their impact on software maintenance , 2012, 2012 28th IEEE International Conference on Software Maintenance (ICSM).

[4]  Antonia Bertolino,et al.  Software Testing Research: Achievements, Challenges, Dreams , 2007, Future of Software Engineering (FOSE '07).

[5]  Jens Grabowski,et al.  Quality assurance for TTCN‐3 test specifications , 2008, Softw. Test. Verification Reliab..

[6]  Chien-Hung Liu,et al.  A test case refactoring approach for pattern-based software development , 2011, Software Quality Journal.

[7]  Boris Beizer,et al.  Software testing techniques (2. ed.) , 1990 .

[8]  Elmar Jürgens,et al.  CloneDetective - A workbench for clone detection research , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[9]  Tom Mens,et al.  A survey of software refactoring , 2004, IEEE Transactions on Software Engineering.

[10]  Serge Demeyer,et al.  Exploring the composition of unit test suites , 2008, 2008 23rd IEEE/ACM International Conference on Automated Software Engineering - Workshops.

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

[12]  Craig G. Nevill-Manning,et al.  Inferring Sequential Structure , 1996 .

[13]  Tathagat Varma,et al.  Automated software testing: introduction, management and performance , 2000, SOEN.

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

[15]  Filippo Lanubile,et al.  Inspecting Automated Test Code: A Preliminary Study , 2007, XP.

[16]  Maximilian Junker,et al.  Using edge bundle views for clone visualization , 2012, 2012 6th International Workshop on Software Clones (IWSC).

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

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

[19]  Maximilian Junker,et al.  Hunting for smells in natural language tests , 2013, 2013 35th International Conference on Software Engineering (ICSE).

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

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

[22]  Sigrid Eldh Software Testing Techniques , 2007 .

[23]  Woei-Kae Chen,et al.  GUI Test Script Organization with Component Abstraction , 2008, 2008 Second International Conference on Secure System Integration and Reliability Improvement.

[24]  D. M. Hutton,et al.  Software Test Automation: Effective Use of Test Execution Tools , 2000 .

[25]  Helmut Neukirchen,et al.  Utilising Code Smells to Detect Quality Problems in TTCN-3 Test Suites , 2007, TestCom/FATES.

[26]  Mary Jean Harrold,et al.  Testing: a roadmap , 2000, ICSE '00.

[27]  Ian H. Witten,et al.  Identifying Hierarchical Structure in Sequences: A linear-time algorithm , 1997, J. Artif. Intell. Res..

[28]  Jens Grabowski,et al.  Refactoring and Metrics for TTCN-3 Test Suites , 2006, SAM.

[29]  Woei-Kae Chen,et al.  Bad Smells and Refactoring Methods for GUI Test Scripts , 2012, 2012 13th ACIS International Conference on Software Engineering, Artificial Intelligence, Networking and Parallel/Distributed Computing.

[30]  Mark Blackburn,et al.  Why Model-Based Test Automation is Different and What You Should Know to Get Started , 2004 .

[31]  Glenford J. Myers,et al.  Art of Software Testing , 1979 .

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

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

[34]  Eduardo Martins Guerra,et al.  Refactoring Test Code Safely , 2007, International Conference on Software Engineering Advances (ICSEA 2007).