引用本文:姜淑娟,王令赛,薛猛,张艳梅,于巧,姚慧冉.基于模式组合的粒子群优化测试用例生成方法.软件学报,2016,27(4):785-801
【打印本页】   【下载PDF全文】   查看/发表评论  【EndNote】   【RefMan】   【BibTex】
←前一篇|后一篇→ 过刊浏览    高级检索
本文已被:浏览 5419次   下载 9131 本文二维码信息
码上扫一扫!
分享到: 微信 更多
基于模式组合的粒子群优化测试用例生成方法
姜淑娟1,2, 王令赛1, 薛猛1, 张艳梅1,3, 于巧1, 姚慧冉1
1.中国矿业大学 计算机科学与技术学院, 江苏 徐州 221116;2.广西可信软件重点实验室(桂林电子科技大学), 广西 桂林 541004;3.计算机软件新技术国家重点实验室(南京大学), 江苏 南京 210023
摘要:
适应度函数的设计在基于搜索的测试用例生成技术中占据重要的位置,然而在某些特殊的程序中,如存在嵌套、非结构性跳转或因return,break等语句跳出循环的程序,已有的适应度函数无法评价到所有的分支.目前的方法是修改程序的源代码,以使每个分支得到评价.但修改源代码不但可能影响程序的原有结构、引入错误,而且很难实现自动化.针对这一问题,提出一种基于模式组合的粒子群优化测试用例生成方法.首先,将分支条件定义为"模式",即,一类具有相同特征且能提高适应度值的个体集合,并改变其分支函数的插桩方式,可解决分支条件不完全评价的问题;然后,设计一种新的交叉算子,寻找到所有使模式的分支函数值最小的个体,将这些个体中含有模式的部分通过交叉算子组合到一个个体上,既可防止模式在进化过程中被破坏,又可因多种模式的组合而提高个体的适应度值;最后,使用局部搜索策略对种群中的最优个体进行搜索,提高粒子群优化算法的局部搜索精度,进一步提高测试用例生成效率.为了评价该方法的有效性,基于一组基准程序和开源程序进行实验.实验结果表明:对于含有模式的程序,该测试用例生成方法与已有方法相比,在覆盖率和平均进化代数上均有明显优势.
关键词:  测试用例生成  粒子群优化算法  交叉算子  局部搜索策略
DOI:10.13328/j.cnki.jos.004966
分类号:
基金项目:国家自然科学基金(61502497);广西可信软件重点实验室研究课题(kx201530);南京大学计算机软件新技术国家重点实验室基金(KFKT2014B19)
Test Case Generation Based on Combination of Schema Using Particle Swarm Optimization
JIANG Shu-Juan1,2, WANG Ling-Sai1, XUE Meng1, ZHANG Yan-Mei1,3, YU Qiao1, YAO Hui-Ran1
1.School of Computer Science and Technology, China University of Mining and Technology, Xuzhou 221116, China;2.Guangxi Key Laboratory of Trusted Software(Guilin University of Electronic Technology), Guilin 541004, China;3.State Key Laboratory for Novel Software Technology(Nanjing University), Nanjing 210023, China
Abstract:
The design of fitness function plays one of most important roles in search based test data generation. While in some special program structures, such as nested structure, unstructured jump statements, and return/break statements, the existing fitness functions can't evaluate all the branches. The currently used approaches are to change the source program so that the branches can be evaluated completely. Changing source program might not only affect the program structure and result in errors, but also be hard to implement automatically. To solve the problem, this paper presents an approach of test case generation based on combination of schema using particle swarm optimization. First, a definition called "schema" is presented for all the branches which are able to improve the fitness value, and the branch function of the schema is obtained, solving the problem of partial evaluation. Then, a crossover is designed to place search on all the individuals which have the minimum value of branch function of the schema. The crossover views each schema as a whole and combines all the schemata into a single individual, as a result the crossover can not only prevent schemata destroyed in the process of evolution, but also improve the fitness value of individuals because of the combination. Furthermore, a local search strategy is used for the best particle in each generation in the process of test case generation. Experiments on some benchmark programs and open source programs are performed. The experimental results show that the proposed approach has obvious advantages in average coverage and generations comparing with other methods.
Key words:  test case generation  particle swarm optimization algorithm  crossover operator  local search strategy

引用本文:
【打印本页】   【下载PDF全文】   查看/发表评论  【EndNote】   【RefMan】   【BibTex】
←前一篇|后一篇→ 过刊浏览    高级检索
本文已被:浏览次   下载  
分享到: 微信 更多
摘要:
关键词:  
DOI:
分类号:
基金项目:
Abstract:
Key words: