作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2013, Vol. 39 ›› Issue (1): 49-53. doi: 10.3969/j.issn.1000-3428.2013.01.010

• 软件技术与数据库 • 上一篇    下一篇

基于退火遗传算法的单元测试方法

赵慧娟,孙文辉   

  1. (北京交通大学计算机与信息技术学院,北京 100044)
  • 收稿日期:2011-07-07 修回日期:2011-09-05 出版日期:2013-01-15 发布日期:2013-01-13
  • 作者简介:赵慧娟(1987-),女,硕士研究生,主研方向:软件自动化测试;孙文辉,副教授

Unit Test Method Based on Annealing Genetic Algorithm

ZHAO Hui-juan, SUN Wen-hui   

  1. (College of Computer and Information Technology, Beijing Jiaotong University, Beijing 100044, China)
  • Received:2011-07-07 Revised:2011-09-05 Online:2013-01-15 Published:2013-01-13

摘要: 为提高单元测试的效率,提出一种基于退火遗传算法的自动化单元测试方法。将遗传算子与进化代数进行关联,使其更快收敛于最优解。采用基于分支距离的方法构造适应值函数,根据代码转换功能,将判定结点处的代码转换为平行结构、将分支距离量化为[0, 1]之间的数。实验结果表明,该方法能以更短的时间获得更高的代码覆盖率。

关键词: 软件测试, 参数化单元测试, 遗传算法, 模拟退火算法, 遗传算子, 适应值函数

Abstract: In order to improve the test efficiency, this paper proposes a unit test method based on annealing Genetic Algorithm(GA). It makes the genetic operators associate to the evolution generation, thus it can lead to faster convergence to the optimal solution. When constructing the fitness function, it uses the method based on the branch distance. It makes the decision node into parallel structure by using the code conversion function. At last, every branch distance can be quantized to the number between zero and one. Experimental result proves that the algorithm can use shorter time to achieve higher code coverage.

Key words: software test, parameterized unit test, Genetic Algorithm(GA), Simulated Annealing(SA) algorithm, genetic operator, fitness function

中图分类号: