电子学报 ›› 2016, Vol. 44 ›› Issue (9): 2254-2261.DOI: 10.3969/j.issn.0372-2112.2016.09.034

• 学术论文 • 上一篇    下一篇

基于路径自动分割的测试数据生成方法

廖伟志1,2   

  1. 1. 嘉兴学院数理与信息工程学院, 浙江嘉兴 314001;
    2. 广西混杂计算与集成电路设计分析重点实验室, 广西南宁 530006
  • 收稿日期:2014-10-10 修回日期:2015-03-26 出版日期:2016-09-25 发布日期:2016-09-25
  • 作者简介:廖伟志 男,1974年生于广西凤山,教授,博士,主要研究方向:软件测试、智能计算.E-mail:weizhiliao2002@aliyun.com
  • 基金资助:

    国家自然科学基金(No.61163012);广西高校科研资助项目(No.2013ZD040);广西混杂计算与集成电路设计分析重点实验室开放基金课题(No.2012HCIC01)

Test Data Generation Based on Automatic Division of Path

LIAO Wei-zhi1,2   

  1. 1. College of Mathematics Physics and Information Engineering, Jiaxing University, Jiaxing, Zhejiang 314001, China;
    2. Guangxi Key laboratory of Hybrid Computation and IC Design Analysis, Nanning, Guangxi 530006, China
  • Received:2014-10-10 Revised:2015-03-26 Online:2016-09-25 Published:2016-09-25

摘要:

为了提高路径覆盖测试数据生成效率,研究了路径自动分割方法并结合人工鱼群算法提出了一种路径覆盖测试数据生成方法.首先在分析变量与节点关系、变量与路径关系的基础上提出了路径分割的自动判定及分离算法,实现了变量对子路径有无影响的自动判定;其次引入Levy飞行策略和共轭梯度法对人工鱼群算法进行了改进;然后结合路径分离的结果和改进的人工鱼群算法实现路径覆盖测试数据的生成.在利用人工鱼生成测试数据的过程中,判断是否有人工鱼穿越分离的子路径.如果有,则记录人工鱼中穿越子路径相应的分量并在人工鱼的觅食、聚群及追尾等行为中固定这些分量,从而使得搜索空间不断减少.最后将提出的方法实现程序的测试数据生成,并与相关方法进行了比较.实验结果表明,本文方法在时间开销、成功率及算法稳定性等方面均具有优越性.

关键词: 软件测试, 路径分割, 测试数据, 路径覆盖, 人工鱼群算法

Abstract:

In order to improve the efficiency of test data generation for path coverage,a method for generating test data was proposed,which was based on automatic division of path and artificial fish-swarm (AFS) algorithm.Firstly,the relations between variables and nodes,and between variables and paths,were analyzed.Based on the analysis an algorithm for automatic division of path was presented,which can automatically judge the impact of variables on sub-paths.Secondly,an improved AFS algorithm was developed based on Levy flying and conjugate gradient.By making use of the result of path division and the improved AFS algorithm,a new method for searching test data was proposed.If there exist sub paths that the fish pass through in the process of using AFS to generate test data,the corresponding component of these fish were fixed,so that search space were reduced.Finally,the proposed method was applied to the test data generation of programs.It is shown that our method outperforms the related methods in running time,success rate and stability.

Key words: software testing, path division, test data, path coverage, artificial fish-swarm algorithm

中图分类号: