学习如何搜索:通过自适应函数选择生成有效的测试用例
Learning How to Search: Generating Effective Test Cases Through Adaptive Fitness Function Selection
摘要:
基于搜索的测试生成由来自一个或多个适应度函数的反馈指导,适应度函数是判断解决方案最优性的评分函数。选择信息丰富的适应度函数对于满足测试人员的目标至关重要。不幸的是,许多目标--比如强制被测类抛出异常,增加测试集的多样性,以及获得强突变覆盖--并没有有效的适应度函数公式。我们建议,满足这样的目标需要处理适应度函数识别作为一个次要的优化步骤。可以改变适应度函数的选择的自适应算法可以在整个生成过程中调整其选择,以基于测试套件的当前群体来最大化目标实现。为了验证这一假设,我们在EvoSuite单元测试生成框架中实现了两个强化学习算法,并使用这些算法动态设置生成过程中使用的适应度函数,以实现上述三个目标。我们已经评估了我们的框架,EvoSuiteFIT,一组Java案例的例子。EvoSuiteFIT技术实现了三个目标中的两个目标的显着改进,并且当进化的代数固定时,在第三个目标上显示出有限的改进。此外,对于三个目标中的两个,EvoSuiteFIT检测其他技术遗漏的故障。调整适应度函数的能力允许有效地产生更有效的测试套件的策略选择,并且检查这些选择提供了如何实现我们的测试目标的洞察力。我们发现,自适应功能的选择是一个强大的技术,适用于一个有效的适应功能时,还不存在实现测试目标。
英文摘要:
Search-based test generation is guided by feedback from one or more fitness functions - scoring functions that judge solution optimality. Choosing informative fitness functions is crucial to meeting the goals of a tester. Unfortunately, many goals - such as forcing the class-under-test to throw exceptions, increasing test suite diversity, and attaining Strong Mutation Coverage - do not have effective fitness function formulations. We propose that meeting such goals requires treating fitness function identification as a secondary optimization step. An adaptive algorithm that can vary the selection of fitness functions could adjust its selection throughout the generation process to maximize goal attainment, based on the current population of test suites. To test this hypothesis, we have implemented two reinforcement learning algorithms in the EvoSuite unit test generation framework, and used these algorithms to dynamically set the fitness functions used during generation for the three goals identified above. We have evaluated our framework, EvoSuiteFIT, on a set of Java case examples. EvoSuiteFIT techniques attain significant improvements for two of the three goals, and show limited improvements on the third when the number of generations of evolution is fixed. Additionally, for two of the three goals, EvoSuiteFIT detects faults missed by the other techniques. The ability to adjust fitness functions allows strategic choices that efficiently produce more effective test suites, and examining these choices offers insight into how to attain our testing goals. We find that adaptive fitness function selection is a powerful technique to apply when an effective fitness function does not already exist for achieving a testing goal.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。