An Automatic Refactoring Framework for Replacing Test-Production Inheritance by Mocking Mechanism
Fri 27 Aug 2021 07:00 - 07:10 - Analytics & Software Evolution—Refactoring Chair(s): Venera Arnaoudova, Alexander Chatzigeorgiou
Unit testing focuses on verifying the functions of individual units of a software system. It is challenging due to the high inter-dependencies among software units. Developers address this by mocking-replacing the dependency by a "faked" object. Despite the existence of powerful, dedicated mocking frameworks, developers often turn to a "hand-rolled" approach-inheritance. That is, they create a subclass of the dependent class and mock its behavior through method overriding. However, this requires tedious implementation and compromises the design quality of unit tests. This work contributes a fully automated refactoring framework to identify and replace the usage of inheritance by using Mockito-a well received mocking framework. Our approach is built upon the empirical experience from five open source projects that use inheritance for mocking. We evaluate our approach on four other projects. Results show that our framework is efficient, generally applicable to new datasets, mostly preserves test case behaviors in detecting defects (in the form of mutants), and decouples test code from production code. The qualitative evaluation by experienced developers suggests that the auto-refactoring solutions generated by our framework improve the quality of the unit test cases in various aspects, such as making test conditions more explicit, as well as improved cohesion, readability, understandability, and maintainability with test cases.
Thu 26 AugDisplayed time zone: Athens change
19:00 - 20:00 | Analytics & Software Evolution—RefactoringResearch Papers / Journal First / Industry Papers +12h Chair(s): Gabriele Bavota Università della Svizzera italiana (USI), Venera Arnaoudova Washington State University | ||
19:00 10mPaper | An Automatic Refactoring Framework for Replacing Test-Production Inheritance by Mocking Mechanism Research Papers Xiao Wang Stevens Institute of Technology, Lu Xiao Stevens Institute of Technology, Tingting Yu University of Cincinnati, Anne Woepse Analytical Graphics, Sunny Wong Analytical Graphics DOI | ||
19:10 10mPaper | RePOR: Mimicking humans on refactoring tasks. Are we there yet? Journal First Rodrigo Morales Concordia University, Foutse Khomh Polytechnique Montréal, Giuliano Antoniol Polytechnique Montréal | ||
19:20 10mPaper | One Thousand and One Stories: A Large-Scale Survey of Software Refactoring Industry Papers Yaroslav Golubev JetBrains Research, Zarina Kurbatova JetBrains Research, Eman Abdullah AlOmar Rochester Institute of Technology, Timofey Bryksin JetBrains Research; HSE University, Mohamed Wiem Mkaouer Rochester Institute of Technology DOI Pre-print | ||
19:30 30mLive Q&A | Q&A (Analytics & Software Evolution—Refactoring) Research Papers |
Fri 27 AugDisplayed time zone: Athens change
07:00 - 08:00 | Analytics & Software Evolution—RefactoringJournal First / Industry Papers / Research Papers Chair(s): Venera Arnaoudova Washington State University, Alexander Chatzigeorgiou University of Macedonia | ||
07:00 10mPaper | An Automatic Refactoring Framework for Replacing Test-Production Inheritance by Mocking Mechanism Research Papers Xiao Wang Stevens Institute of Technology, Lu Xiao Stevens Institute of Technology, Tingting Yu University of Cincinnati, Anne Woepse Analytical Graphics, Sunny Wong Analytical Graphics DOI | ||
07:10 10mPaper | RePOR: Mimicking humans on refactoring tasks. Are we there yet? Journal First Rodrigo Morales Concordia University, Foutse Khomh Polytechnique Montréal, Giuliano Antoniol Polytechnique Montréal | ||
07:20 10mPaper | One Thousand and One Stories: A Large-Scale Survey of Software Refactoring Industry Papers Yaroslav Golubev JetBrains Research, Zarina Kurbatova JetBrains Research, Eman Abdullah AlOmar Rochester Institute of Technology, Timofey Bryksin JetBrains Research; HSE University, Mohamed Wiem Mkaouer Rochester Institute of Technology DOI Pre-print | ||
07:30 30mLive Q&A | Q&A (Analytics & Software Evolution—Refactoring) Research Papers |