{"title":"消除急切测试气味的自动重构方法","authors":"Adriano Pizzini, S. Reinehr, A. Malucelli","doi":"10.1145/3571473.3571478","DOIUrl":null,"url":null,"abstract":"Unit tests are artifacts generated during the development process to identify software errors early. Unit tests can be affected by Test Smells (TS), which are defined as poorly designed tests due to bad programming practices implemented in unit test code. Problems caused by TS negatively impact the efficiency of developers and the understanding and maintenance of unit tests. Reducing the problems caused by TS can occur through refactoring activities. Despite the existence of studies that seek to identify the occurrence of TS in unit tests and proposals for semi-automatic refactoring, there are no studies related to the automatic removal of TS from the test repository. In this context, this study presents a method for automatic TS removal called Eager Test, which occurs when a test verifies more than one method of the code. The proposed method was evaluated through experiments, comparing the original version of a unit tests repository with its automatically refactored version. The results are promising, showing an Eager Test removal rate of 99,4% of unit tests in the repository without causing test errors or test fails. However, there was an increase in test execution time and of lines of code, resulting from the quantity of tests that were extracted. The proposed method supports improving the quality of unit tests and reduces the effort required by developers to remove Eager Test.","PeriodicalId":440784,"journal":{"name":"Proceedings of the XXI Brazilian Symposium on Software Quality","volume":"35 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-11-07","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Automatic Refactoring Method to Remove Eager Test Smell\",\"authors\":\"Adriano Pizzini, S. Reinehr, A. Malucelli\",\"doi\":\"10.1145/3571473.3571478\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Unit tests are artifacts generated during the development process to identify software errors early. Unit tests can be affected by Test Smells (TS), which are defined as poorly designed tests due to bad programming practices implemented in unit test code. Problems caused by TS negatively impact the efficiency of developers and the understanding and maintenance of unit tests. Reducing the problems caused by TS can occur through refactoring activities. Despite the existence of studies that seek to identify the occurrence of TS in unit tests and proposals for semi-automatic refactoring, there are no studies related to the automatic removal of TS from the test repository. In this context, this study presents a method for automatic TS removal called Eager Test, which occurs when a test verifies more than one method of the code. The proposed method was evaluated through experiments, comparing the original version of a unit tests repository with its automatically refactored version. The results are promising, showing an Eager Test removal rate of 99,4% of unit tests in the repository without causing test errors or test fails. However, there was an increase in test execution time and of lines of code, resulting from the quantity of tests that were extracted. The proposed method supports improving the quality of unit tests and reduces the effort required by developers to remove Eager Test.\",\"PeriodicalId\":440784,\"journal\":{\"name\":\"Proceedings of the XXI Brazilian Symposium on Software Quality\",\"volume\":\"35 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2022-11-07\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Proceedings of the XXI Brazilian Symposium on Software Quality\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/3571473.3571478\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the XXI Brazilian Symposium on Software Quality","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3571473.3571478","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
Automatic Refactoring Method to Remove Eager Test Smell
Unit tests are artifacts generated during the development process to identify software errors early. Unit tests can be affected by Test Smells (TS), which are defined as poorly designed tests due to bad programming practices implemented in unit test code. Problems caused by TS negatively impact the efficiency of developers and the understanding and maintenance of unit tests. Reducing the problems caused by TS can occur through refactoring activities. Despite the existence of studies that seek to identify the occurrence of TS in unit tests and proposals for semi-automatic refactoring, there are no studies related to the automatic removal of TS from the test repository. In this context, this study presents a method for automatic TS removal called Eager Test, which occurs when a test verifies more than one method of the code. The proposed method was evaluated through experiments, comparing the original version of a unit tests repository with its automatically refactored version. The results are promising, showing an Eager Test removal rate of 99,4% of unit tests in the repository without causing test errors or test fails. However, there was an increase in test execution time and of lines of code, resulting from the quantity of tests that were extracted. The proposed method supports improving the quality of unit tests and reduces the effort required by developers to remove Eager Test.