计算机工程与应用 ›› 2007, Vol. 43 ›› Issue (12): 97-99.

• 产品、研发、测试 • 上一篇    下一篇

基于蚁群算法的软件测试数据自动生成

傅博   

  1. 中国空空导弹研究院、北京航空航天大学
  • 收稿日期:2006-05-09 修回日期:1900-01-01 出版日期:2007-04-20 发布日期:2007-04-20
  • 通讯作者: 傅博

Automated Software Test Data Generation Based on Ant Colony Algorithm

  • Received:2006-05-09 Revised:1900-01-01 Online:2007-04-20 Published:2007-04-20

摘要: 软件测试数据自动生成问题是软件测试中的难点之一,需要人们不断研究新的方法解决.本文提出了一种基于蚁群算法的测试数据自动生成方法.该方法采用位串形式编码,实现了被测程序输入空间到蚂蚁路径网络的映射模型.根据程序插装函数定义的路径信息素轨迹强度,蚂蚁进行群体协作搜索最佳路径,生成测试数据.在基本蚁群算法基础上,通过引入变异算子和自适应挥发系数,提高了蚂蚁路径的多样性,克服了早熟停滞的缺陷.和模拟退火遗传算法进行了对比实验研究,实验结果表明了该方法的可行性,生成测试数据的效率优于模拟退火遗传算法.

关键词: 软件测试, 蚁群算法, 遗传算法, 测试数据自动生成

Abstract: The automated test data generation is one of the difficult problems in software testing. New approaches are continually needed to solve the problem. This study proposes a kind of automatic test data generation method based on ant colony algorithm. By using bit coding, a model from input domain of the software under test to ant paths of the ant colony algorithm is established. Pheromone trails of the paths depend on branch functions of program instrumentation. According to the pheromone trails, ants cooperate to find the best path to generate software test data. To improve ant path diversity and decrease the degrees of the precocity and stagnation, a mutation operator and an adaptive pheromone evaporation gene are applied. Comparative experiments are performed between ant colony algorithm and simulated annealing genetic algorithm (SAGA). Experimental results indicate that ant colony algorithm outperforms SAGA in efficiency of the test data generation.

Key words: software testing, ant colony algorithm, genetic algorithm, automatic test data generation