Mutation testing is an effective technique for assessing the effectiveness of test suites by systematically injecting artificial faults into programs. However, existing mutation testing techniques fall short in capturing many types of common faults in dynamically typed languages like Python. In this paper, we introduce a novel set of seven mutation operators that are inspired by prevalent anti-patterns in Python programs, designed to complement the existing general-purpose operators and broaden the spectrum of simulated faults. We propose a mutation testing technique that utilizes a hybrid of static and dynamic analyses to mutate Python programs based on these operators while minimizing equivalent mutants. We implement our approach in a tool called PyTation and evaluate it on 13 open-source Python applications. Our results show that PyTation generates mutants that complement those from general-purpose tools, exhibiting distinct behaviour under test execution and uncovering inadequacies in high-coverage test suites. We further demonstrate that PyTation produces a high proportion of unique mutants, a low cross-kill rate, and a low test overlap ratio relative to baseline tools, highlighting its novel fault model. PyTation also incurs few equivalent mutants, aided by dynamic analysis heuristics.
翻译:变异测试是一种通过系统地向程序中注入人工故障来评估测试套件有效性的有效技术。然而,现有的变异测试技术在捕获像Python这样的动态类型语言中的许多常见故障类型方面存在不足。本文中,我们引入了一套新颖的七种变异算子,其灵感来源于Python程序中普遍存在的反模式,旨在补充现有的通用算子并拓宽模拟故障的频谱。我们提出了一种变异测试技术,该技术利用静态和动态分析的混合,基于这些算子对Python程序进行变异,同时最小化等价变异体。我们在一个名为PyTation的工具中实现了我们的方法,并在13个开源Python应用程序上对其进行了评估。我们的结果表明,PyTation生成的变异体补充了通用工具生成的变异体,在测试执行下表现出不同的行为,并揭示了高覆盖率测试套件中的不足。我们进一步证明,相对于基线工具,PyTation产生了高比例的独特变异体、低的交叉杀死率和低的测试重叠率,突显了其新颖的故障模型。在动态分析启发式方法的辅助下,PyTation也产生了很少的等价变异体。