Graph-based seed object synthesis for search-based unit testing

Graph-based seed object synthesis for search-based unit testing
复制标题

DOI:
10.1145/3468264.3468619
复制
发表时间:
2021-08
期刊:
Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering
影响因子:
--
通讯作者:
Yun Lin;You Sheng Ong;Jun Sun;G. Fraser;J. Dong
Yun Lin;You Sheng Ong;Jun Sun;G. Fraser;J. Dong
中科院分区:
其他
文献类型:
--
作者:
Yun Lin;You Sheng Ong;Jun Sun;G. Fraser;J. Dong

文献摘要

被引文献

相似文献

基于搜索的软件测试(SBST)使用搜索算法生成测试,该搜索算法由测量测试用例离实现覆盖目标有多远的度量指导。SBST的有效性在很大程度上取决于由这些测量和搜索算子决定的适应度景观的连续性和单调性。不幸的是,当被测函数接受对象输入时,适应度景观是具有挑战性的,因为经典测量很难为构造合法的对象输入提供指导。为了克服这个问题,我们提出了测试种子,即,测试代码框架的合法对象,使使用经典的测量。给定被测函数中的目标分支,我们首先静态分析该函数以构建对象构造图,该对象构造图捕获目标方法的操作数与其相关对象输入的状态之间的关系。基于图,我们合成测试模板代码,其中每个“槽”是搜索算法的突变点。这种方法可以与现有的SBST算法无缝集成,我们在EvoSuite上实现了EvoObj。我们的实验表明,EvoObj优于EvoSuite的统计意义上的2750方法超过103个开源Java项目,使用国家的最先进的SBST算法。
Search-based software testing (SBST) generates tests using search algorithms guided by measurements gauging how far a test case is away from exercising a coverage goal. The effectiveness of SBST largely depends on the continuity and monotonicity of the fitness landscape decided by these measurements and the search operators. Unfortunately, the fitness landscape is challenging when the function under test takes object inputs, as classical measurement hardly provide guidance for constructing legitimate object inputs. To overcome this problem, we propose test seeds, i.e., test code skeletons of legitimate objects which enable the use of classical measurements. Given a target branch in a function under test, we first statically analyze the function to build an object construction graph that captures the relation between the operands of the target method and the states of their relevant object inputs. Based on the graph, we synthesize test template code where each "slot" is a mutation point for the search algorithm. This approach can be seamlessly integrated with existing SBST algorithms, and we implemented EvoObj on top of EvoSuite. Our experiments show that EvoObj outperforms EvoSuite with statistical significance on 2750 methods over 103 open source Java projects using state-of-the-art SBST algorithms.