用断言指纹识别测试重构候选者

Z. Fang, Patrick Lam
{"title":"用断言指纹识别测试重构候选者","authors":"Z. Fang, Patrick Lam","doi":"10.1145/2807426.2807437","DOIUrl":null,"url":null,"abstract":"Test cases constitute around 30% of the codebase of a number of large software systems. Poor design of test suites hinders test comprehension and maintenance. Developers often copy-paste existing tests and reproduce both boilerplate and essential environment setup code as well as assertions. Test case refactoring would be valuable for developers aiming to control technical debt arising due to copy-pasted test cases. In the context of test code, identifying candidates for refactoring requires tedious manual effort. In this work, we specifically tailor static analysis techniques for test analysis. We present a novel technique, assertion fingerprints, for finding similar test cases based on the set of assertion calls in test methods. Assertion fingerprints encode the control flow around the ordered set of assertions in methods. We have implemented similar test case detection using assertion fingerprints and applied it to 10 test suites for open-source Java programs. We provide an empirical study and a qualitative analysis of our results. Assertion fingerprints enable the discovery of tests that exhibit strong structural similarities and are amenable to refactoring. Our technique delivers an overall 75% true positive rate on our benchmarks and reports that 40% of the benchmark test methods are potentially refactorable.","PeriodicalId":104024,"journal":{"name":"Proceedings of the Principles and Practices of Programming on The Java Platform","volume":"65 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2015-09-08","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"4","resultStr":"{\"title\":\"Identifying Test Refactoring Candidates with Assertion Fingerprints\",\"authors\":\"Z. Fang, Patrick Lam\",\"doi\":\"10.1145/2807426.2807437\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Test cases constitute around 30% of the codebase of a number of large software systems. Poor design of test suites hinders test comprehension and maintenance. Developers often copy-paste existing tests and reproduce both boilerplate and essential environment setup code as well as assertions. Test case refactoring would be valuable for developers aiming to control technical debt arising due to copy-pasted test cases. In the context of test code, identifying candidates for refactoring requires tedious manual effort. In this work, we specifically tailor static analysis techniques for test analysis. We present a novel technique, assertion fingerprints, for finding similar test cases based on the set of assertion calls in test methods. Assertion fingerprints encode the control flow around the ordered set of assertions in methods. We have implemented similar test case detection using assertion fingerprints and applied it to 10 test suites for open-source Java programs. We provide an empirical study and a qualitative analysis of our results. Assertion fingerprints enable the discovery of tests that exhibit strong structural similarities and are amenable to refactoring. Our technique delivers an overall 75% true positive rate on our benchmarks and reports that 40% of the benchmark test methods are potentially refactorable.\",\"PeriodicalId\":104024,\"journal\":{\"name\":\"Proceedings of the Principles and Practices of Programming on The Java Platform\",\"volume\":\"65 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2015-09-08\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"4\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Proceedings of the Principles and Practices of Programming on The Java Platform\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/2807426.2807437\",\"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 Principles and Practices of Programming on The Java Platform","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2807426.2807437","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 4

摘要

在许多大型软件系统中,测试用例大约占代码库的30%。糟糕的测试套件设计阻碍了对测试的理解和维护。开发人员经常复制粘贴现有的测试,并重新生成样板和必要的环境设置代码以及断言。测试用例重构对于旨在控制由于复制粘贴测试用例而产生的技术债务的开发人员来说是有价值的。在测试代码的上下文中,确定重构的候选代码需要繁琐的手工工作。在这项工作中,我们专门为测试分析定制静态分析技术。我们提出了一种新的技术,断言指纹,用于根据测试方法中的断言调用集找到相似的测试用例。断言指纹对方法中有序断言集周围的控制流进行编码。我们已经使用断言指纹实现了类似的测试用例检测,并将其应用于10个开源Java程序的测试套件。我们对结果进行了实证研究和定性分析。断言指纹可以发现显示出强烈结构相似性并易于重构的测试。我们的技术在基准测试中提供了75%的真实阳性率,并报告40%的基准测试方法是潜在可重构的。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Identifying Test Refactoring Candidates with Assertion Fingerprints
Test cases constitute around 30% of the codebase of a number of large software systems. Poor design of test suites hinders test comprehension and maintenance. Developers often copy-paste existing tests and reproduce both boilerplate and essential environment setup code as well as assertions. Test case refactoring would be valuable for developers aiming to control technical debt arising due to copy-pasted test cases. In the context of test code, identifying candidates for refactoring requires tedious manual effort. In this work, we specifically tailor static analysis techniques for test analysis. We present a novel technique, assertion fingerprints, for finding similar test cases based on the set of assertion calls in test methods. Assertion fingerprints encode the control flow around the ordered set of assertions in methods. We have implemented similar test case detection using assertion fingerprints and applied it to 10 test suites for open-source Java programs. We provide an empirical study and a qualitative analysis of our results. Assertion fingerprints enable the discovery of tests that exhibit strong structural similarities and are amenable to refactoring. Our technique delivers an overall 75% true positive rate on our benchmarks and reports that 40% of the benchmark test methods are potentially refactorable.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信