Test amplification is a novel technique which extends 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 contain- ing approximately 400 test methods. We show the improvement in killing new mutants and mutation coverage in 33 out of 52 test classes (63%). Moreover, these generated tests are understandable by humans: 10 out of 13 pull-requests submitted were merged into the main code base (76%). These results are comparable to the state-of-the-art, hence we conclude that test amplification is feasible for dynamically typed languages.
翻译:测试放大是一种创新技术,它扩展了人工制作的测试套件,增加了测试案例,从而扩大了代码覆盖范围。该技术是有效的,因为它表明软件工程师普遍采用强力和易懂的测试案例。不幸的是,目前测试放大的先进技术在很大程度上依赖于程序分析技术,这些技术在很大程度上得益于静态类型语言中的明确类型声明。在动态类型语言中,这种类型声明是不存在的,因此,测试扩增尚未找到它去编程语言的方法,如Smalltalk、Python、Ruby和Javascrip。我们提议利用剖析信息――通过执行相关的测试套件可以容易地获得――来推断必要的类型信息,通过相应的描述生成特殊测试投入。我们从13个成熟项目中选择的52个测试类别评估了这一方法,包含大约400种测试方法。我们显示了在53个测试类别(63%)中杀死新变异体和突变异体覆盖范围的改进情况。此外,这些测试为人类所理解的:13个拉普请求中有10个被合并成主要代码基(76 %),这些结果可以与动态测试类型相比较。