计算机工程与应用 ›› 2010, Vol. 46 ›› Issue (27): 32-35.DOI: 10.3778/j.issn.1002-8331.2010.27.008

• 博士论坛 • 上一篇    下一篇

多路径测试数据自动生成方法及应用

曹 洋,胡春华,陈少波,李路明   

  1. 清华大学 航天航空学院,人机与环境工程研究所,北京 100084
  • 收稿日期:2010-04-28 修回日期:2010-08-09 出版日期:2010-09-21 发布日期:2010-09-21
  • 通讯作者: 曹 洋

Automatic test data generation for multiple paths and its applications

CAO Yang,HU Chun-hua,CHEN Shao-bo,LI Lu-ming   

  1. Institute of Man-Machine & Environment Engineering,School of Aerospace,Tsinghua University,Beijing 100084,China
  • Received:2010-04-28 Revised:2010-08-09 Online:2010-09-21 Published:2010-09-21
  • Contact: CAO Yang

摘要: 以程序结构测试自动生成为研究背景,提出了一种重叠路径结构用以描述程序路径,并以此为基础设计了一种多路径测试数据生成适应值算法,实现了一次搜索完成多条路径的测试数据生成。算法通过目标路径间共享遗传算法产生的中间个体减少单一路径搜索始于随机产生的无序个体的初期迭代,从而加快搜索收敛的速度。应用于常用的基准程序和取自实际项目的程序,该算法与典型的分支谓词距离算法相比平均消耗时间缩短了70.6%。

关键词: 软件测试, 测试数据生成, 多路径, 遗传算法

Abstract: The study researches automatic test data generation for structure testing.A structure of overlapped path is proposed to describe paths of a program,and a fitness function for multiple paths test data generation is constructed with it based on genetic algorithm(GA).The function can drive GA to search the test data for all the target paths within one run.The search decreases the initial repetitive iterations with random individuals and speeds up the convergence,because target paths share the data generated by GA.Applied to the benchmark program and some realistic programs,the function reduces the time consumption in search by 70.6% compared with the typical predicate distance algorithm on average.

Key words: software testing, test data generation, multiple paths, genetic algorithm

中图分类号: