arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2108.05663cs.SE
收藏

小规模:动态类型语言中的测试放大

Small-Amp: Test Amplification in a Dynamically Typed Language

Mehrdad Abdi, Henrique Rocha, Serge Demeyer, Alexandre Bergel

摘要:

一些测试放大工具使用额外的测试用例来扩展手动创建的测试套件,以增加代码覆盖率。该技术是有效的,在这个意义上,它建议强大的和可理解的测试用例,通常采用的软件工程师。不幸的是,目前的测试放大技术严重依赖于程序分析技术,这些技术从静态类型语言中的显式类型声明中受益匪浅。在动态类型语言中,这种类型声明是不可用的,因此测试放大还没有找到适合程序设计语言的方法,如Smalltalk,Python,Ruby和JavaScript。我们建议利用分析信息-容易获得的执行相关的测试套件-推断必要的类型信息创建特殊的测试输入与相应的断言。我们在从包含大约400种测试方法的Pharo生态系统中的13个成熟项目中选择的52个测试类上评估了这种方法。我们在52个测试类别中的28个(53%)中至少显示了杀死新突变体和突变覆盖率的改进。此外,这些生成的测试是人类可以理解的:提交的11个pull请求中有8个被合并到主代码库中(72%)。这些结果与最先进的测试方法相当,因此我们得出结论,测试放大对于动态类型语言是可行的。

英文摘要:

Some test amplification tools extend a manually created test suite with additional test cases to increase the code coverage. The technique is effective, in the sense that it suggests strong and understandable test cases, generally adopted by software engineers. Unfortunately, the current state-of-the-art for test amplification heavily relies on program analysis techniques which benefit a lot from explicit type declarations present in statically typed languages. In dynamically typed languages, such type declarations are not available and as a consequence test amplification has yet to find its way to programming languages like Smalltalk, Python, Ruby and Javascript. We propose to exploit profiling information --readily obtainable by executing the associated test suite-- to infer the necessary type information creating special test inputs with corresponding assertions. We evaluated this approach on 52 selected test classes from 13 mature projects in the Pharo ecosystem containing approximately 400 test methods. We show the improvement in killing new mutants and mutation coverage at least in 28 out of 52 test classes (53%). Moreover, these generated tests are understandable by humans: 8 out of 11 pull-requests submitted were merged into the main code base (72%). These results are comparable to the state-of-the-art, hence we conclude that test amplification is feasible for dynamically typed languages.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑