{"title":"Using Genetic Algorithms to Repair JUnit Test Cases","authors":"Yong Xu, Bo Huang, Guoqing Wu, Mengting Yuan","doi":"10.1109/APSEC.2014.51","DOIUrl":null,"url":null,"abstract":"JUnit test repair has been proposed as a way to alleviate the burden of maintaining the broken tests caused by evolving software. Existing techniques for JUnit test repair either focus on repairing failing assertions or fixing test case compilation errors rendered by evolving method declarations. The empirical work suggests that the synthesis of new method calls is often needed when repairing test cases in practice. In this work, we propose Test Fix, an approach to fix broken JUnit test cases by synthesizing new method calls. Test Fix reduces the synthesis to a search problem and uses a genetic algorithm to solve it. Evaluated on real world applications, preliminary experimental results show that Test Fix can repair broken tests with adding or deleting method calls. Evaluations on the performance of JUnit test repair technique using a genetic algorithm against a random search algorithm are also conducted. Experimental results indicate the clear superiority of genetic algorithms over random search algorithm.","PeriodicalId":380881,"journal":{"name":"2014 21st Asia-Pacific Software Engineering Conference","volume":"22 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2014-12-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"2","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2014 21st Asia-Pacific Software Engineering Conference","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/APSEC.2014.51","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 2
Abstract
JUnit test repair has been proposed as a way to alleviate the burden of maintaining the broken tests caused by evolving software. Existing techniques for JUnit test repair either focus on repairing failing assertions or fixing test case compilation errors rendered by evolving method declarations. The empirical work suggests that the synthesis of new method calls is often needed when repairing test cases in practice. In this work, we propose Test Fix, an approach to fix broken JUnit test cases by synthesizing new method calls. Test Fix reduces the synthesis to a search problem and uses a genetic algorithm to solve it. Evaluated on real world applications, preliminary experimental results show that Test Fix can repair broken tests with adding or deleting method calls. Evaluations on the performance of JUnit test repair technique using a genetic algorithm against a random search algorithm are also conducted. Experimental results indicate the clear superiority of genetic algorithms over random search algorithm.