Paper—Post-Refactoring Recovery of Unit Tests: An Automated Approach Post-Refactoring Recovery of Unit Tests: An Automated Approach https://doi.org/10.3991/ijim.v17i08.38785 Abdallah Qusef 1 , Sharefa Murad 2 , Najeh Alsalhi 3,4() , Eman Shudayfat 5 1 Princess Sumaya University for Technology, Amman, Jordan 2 Middle East University, Amman, Jordan 3 Humanities and Social Sciences Research Center, Ajman University, Ajman, UAE 4 Deanship of Research and Graduate Studies (DRG), Ajman University, Ajman, UAE 5 Department of Creative media, Luminus Technical University College, Amman, Jordan n.alsalhi@ajman.ac.ae Abstract—In application development lifecycle, specifically in test-driven development, refactoring plays a crucial role in sustaining ease. However, in- spite of bringing ease, refactoring does not ensure the desired behaviour of code after it is applied. Because refactoring tends to worsen the alignments between source code and its corresponding units. One significant solution to the afore- mentioned issue is the technique called unit testing. As unit testing enable the developers to confidently apply refactoring while avoiding undesired code be- haviour. Unit testing provides effective preventive measures for avoiding bugs by providing immediate feedback, thus assisting to mitigate the fear of change. In this work, we present a tool called GreenRefPlus which efficiently enables the developers to maintain the veracity of code after the process of refactoring is applied. The proposed tool provides automatic recovery for the unit tests after the code is refactored. In this work, we consider Java as our target programming lan- guage and we focus on five various types of refactoring, which include Rename Method, Extract Method, Move Method, Parameter Addition and Parameter Re- moval. Our experiments indicate that the proposed tool GreenRefPlus enables us to consistently refactor the code and apply unit tests. The results presented in our work reveal that the proposed tool assists developers in saving approximately 43% of the total time required to manually recover from broken unit tests. Keywords—unit tests, GreenRefPlus, code refactoring, automatic recovery, JUnit, eclipse plug-in, Agile eXtreme Programming, test-driven development 1 Introduction The process of refactoring has a huge impact on software development lifecycle be- cause it provides the necessary techniques for improving the internal structure of source code, while keeping the desirable output. There are various refactoring opportunities in any source code governed by few factors. First, the modifications required for the im- provement in quality; and second, modifying or reorganizing the code in such as way that its output is preserved [1]. According to the author in [2], refactoring is defined as: iJIM ‒ Vol. 17, No. 08, 2023 39