arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2001.04221cs.SE
收藏

使用调用站点信息生成类级集成测试

Generating Class-Level Integration Tests Using Call Site Information

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

摘要:

基于搜索的方法已经在文献中被用于自动化创建单元测试用例的过程。然而,相关的工作已经表明,生成的具有高代码覆盖率的单元测试可能是无效的,即,它们可能不会检测到所有故障或杀死所有注入的突变体。在本文中,我们提出了CLING,一个集成级的测试用例生成方法,利用一对类,调用者和被调用者,通过方法调用相互作用。特别是,CLING生成集成级测试用例,最大化耦合分支准则(CBC)。耦合分支是一对分支,包含调用者的分支和被调用者的分支,这样执行前者的集成测试也会执行后者。CBC是一种新的集成级覆盖标准,用于度量测试套件执行调用者和被调用者类之间交互的程度。我们实现了CLING,并对来自五个不同开源Java项目的140对类进行了评估。我们的研究结果表明:(1)CLING生成的测试集具有高CBC覆盖率,这要归功于将测试集生成定义为多目标问题,其中每对分支都是独立的目标;(2)这样生成的测试集触发不同的类交互,平均可以杀死7.7%(最多50%)在单位水平上生成的测试未检测到的突变体;(3)CLING可以检测到由于对被调用类的使用的错误假设而导致的集成错误。(对于我们的主题系统为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.

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

↑