Automated test-case generation by cloning

Mathias Landhäußer, W. Tichy
{"title":"Automated test-case generation by cloning","authors":"Mathias Landhäußer, W. Tichy","doi":"10.1109/IWAST.2012.6228995","DOIUrl":null,"url":null,"abstract":"Test cases are often similar. A preliminary study of eight open-source projects found that on average at least 8% of all test cases are clones; the maximum found was 42 %. The clones are not identical with their originals - identifiers of classes, methods, attributes and sometimes even order of statements and assertions differ. But the test cases reuse testing logic and are needed for testing. They serve a purpose and cannot be eliminated. We present an approach that generates useful test clones automatically, thereby eliminating some of the “grunt” work of testing. An important advantage over existing automated test case generators is that the clones include the test oracle. Hence, a human decision maker is often not needed to determine whether the output of a test is correct. The approach hinges on pairs of classes that provide analogous functionality, i.e., functions that are tested with the same logic. TestCloner transcribes tests involving analogous functions from one class to the other. Programmers merely need to indicate which methods are analogs. Automatic detection of analogs is currently under investigation. Preliminary results indicate a significant reduction in the number of “boilerplate” tests that need to be written by hand. The transcribed tests do detect defects and can provide hints about missing functionality.","PeriodicalId":389615,"journal":{"name":"2012 7th International Workshop on Automation of Software Test (AST)","volume":"8 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2012-06-02","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"12","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2012 7th International Workshop on Automation of Software Test (AST)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/IWAST.2012.6228995","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 12

Abstract

Test cases are often similar. A preliminary study of eight open-source projects found that on average at least 8% of all test cases are clones; the maximum found was 42 %. The clones are not identical with their originals - identifiers of classes, methods, attributes and sometimes even order of statements and assertions differ. But the test cases reuse testing logic and are needed for testing. They serve a purpose and cannot be eliminated. We present an approach that generates useful test clones automatically, thereby eliminating some of the “grunt” work of testing. An important advantage over existing automated test case generators is that the clones include the test oracle. Hence, a human decision maker is often not needed to determine whether the output of a test is correct. The approach hinges on pairs of classes that provide analogous functionality, i.e., functions that are tested with the same logic. TestCloner transcribes tests involving analogous functions from one class to the other. Programmers merely need to indicate which methods are analogs. Automatic detection of analogs is currently under investigation. Preliminary results indicate a significant reduction in the number of “boilerplate” tests that need to be written by hand. The transcribed tests do detect defects and can provide hints about missing functionality.
通过克隆自动生成测试用例
测试用例通常是相似的。对八个开源项目的初步研究发现,平均至少有8%的测试用例是克隆的;最高发现率为42%。克隆与它们的原始版本并不相同——类、方法、属性的标识符,有时甚至语句和断言的顺序都不同。但是测试用例重用测试逻辑,并且是测试所需要的。它们是有目的的,不能被消除。我们提出了一种自动生成有用的测试克隆的方法,从而消除了一些“单调”的测试工作。与现有的自动化测试用例生成器相比,一个重要的优势是克隆包含了测试oracle。因此,通常不需要人工决策者来确定测试的输出是否正确。该方法依赖于提供类似功能的类对,即使用相同逻辑测试的函数。TestCloner将涉及类似函数的测试从一个类转录到另一个类。程序员只需要指出哪些方法是类似的。目前正在研究类似物的自动检测。初步结果表明,需要手工编写的“样板”测试的数量显著减少。转录的测试确实可以检测缺陷,并且可以提供关于缺失功能的提示。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
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学术官方微信
小红书