论文标题

使用呼叫网站信息生成类级集成测试

Generating Class-Level Integration Tests Using Call Site Information

论文作者

Derakhshanfar, Pouria, Devroey, Xavier, Panichella, Annibale, Zaidman, Andy, van Deursen, Arie

论文摘要

文献中已经使用了基于搜索的方法来自动创建单元测试案例的过程。但是,相关工作表明,具有高码覆盖率的产生的单位测试可能是无效的,即,它们可能无法检测到所有故障或杀死所有注射突变体。在本文中,我们提出了Cling,这是一种集成级测试案例生成方法,该方法利用了一对班级,呼叫者和callee的方式,通过方法调用相互交互。尤其是,固定生成集成级测试用例,以最大化耦合分支标准(CBC)。耦合的分支是包含呼叫者分支和Callee分支的分支对,因此行使前者的集成测试也可以行使后者。 CBC是一种新颖的集成级覆盖标准,可测量测试套件在呼叫者及其Callee类之间进行相互作用的程度。我们实施了坚持,并通过五个不同的开源Java项目的140对课程评估了方法。我们的结果表明,(1)克林生成具有高CBC覆盖率的测试套件,这要归功于测试套件的定义是一个多目标问题,其中每个分支是一个独立的目标; (2)这种生成的套房会触发不同的类互动,平均可以杀死7.7%(最多50%)突变体,这些突变体未通过单位水平生成的测试检测到; (3)固定可以检测出关于使用自动生成的单位级测试套件时未被发现的Callee类使用的错误假设(32)的假设(32)。

Search-based approaches have been used in the literature to automate the process of creating unit test cases. However, related work has shown that generated unit-tests with high code coverage could be ineffective, i.e., they may not detect all faults or kill all injected mutants. In this paper, we propose CLING, an integration-level test case generation approach that exploits how a pair of classes, the caller and the callee, interact with each other through method calls. In particular, CLING generates integration-level test cases that maximize the Coupled Branches Criterion (CBC). Coupled branches are pairs of branches containing a branch of the caller and a branch of the callee such that an integration test that exercises the former also exercises the latter. CBC is a novel integration-level coverage criterion, measuring the degree to which a test suite exercises the interactions between a caller and its callee classes. We implemented CLING and evaluated the approach on 140 pairs of classes from five different open-source Java projects. Our results show that (1) CLING generates test suites with high CBC coverage, thanks to the definition of the test suite generation as a many-objectives problem where each couple of branches is an independent objective; (2) such generated suites trigger different class interactions and can kill on average 7.7% (with a maximum of 50%) of mutants that are not detected by tests generated at the unit level; (3) CLING can detect integration faults coming from wrong assumptions about the usage of the callee class (32 for our subject systems) that remain undetected when using automatically generated unit-level test suites.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源