首页 | 本学科首页   官方微博 | 高级检索  
     

基于模式组合的粒子群优化测试用例生成方法
引用本文:姜淑娟,王令赛,薛猛,张艳梅,于巧,姚慧冉.基于模式组合的粒子群优化测试用例生成方法[J].软件学报,2016,27(4):785-801.
作者姓名:姜淑娟  王令赛  薛猛  张艳梅  于巧  姚慧冉
作者单位:中国矿业大学 计算机科学与技术学院,江苏 徐州 221116;桂林电子科技大学广西可信软件重点实验室, 广西 桂林 541004,中国矿业大学 计算机科学与技术学院,江苏 徐州 221116,中国矿业大学 计算机科学与技术学院,江苏 徐州 221116,中国矿业大学 计算机科学与技术学院,江苏 徐州 221116;计算机软件新技术国家重点实验室(南京大学), 江苏 南京 210023,中国矿业大学 计算机科学与技术学院,江苏 徐州 221116,中国矿业大学 计算机科学与技术学院,江苏 徐州 221116
基金项目:国家自然科学基金(61502497); 广西可信软件重点实验室研究课题资助(kx201530); 南京大学计算机软件新技术国家重点实验室基金项目(KFKT2014B19)
摘    要:适应度函数的设计在基于搜索的测试用例生成技术中占据重要的位置,然而在某些特殊的程序中,如存在嵌套、非结构性跳转或因return,break等语句跳出循环的程序,已有的适应度函数无法评价到所有的分支.目前的方法是修改程序的源代码,以使每个分支得到评价.但修改源代码不但可能影响程序的原有结构、引入错误,而且很难实现自动化.针对这一问题,提出一种基于模式组合的粒子群优化测试用例生成方法.首先,将分支条件定义为"模式",即,一类具有相同特征且能提高适应度值的个体集合,并改变其分支函数的插桩方式,可解决分支条件不完全评价的问题;然后,设计一种新的交叉算子,寻找到所有使模式的分支函数值最小的个体,将这些个体中含有模式的部分通过交叉算子组合到一个个体上,既可防止模式在进化过程中被破坏,又可因多种模式的组合而提高个体的适应度值;最后,使用局部搜索策略对种群中的最优个体进行搜索,提高粒子群优化算法的局部搜索精度,进一步提高测试用例生成效率.为了评价该方法的有效性,基于一组基准程序和开源程序进行实验.实验结果表明:对于含有模式的程序,该测试用例生成方法与已有方法相比,在覆盖率和平均进化代数上均有明显优势.

关 键 词:测试用例生成  粒子群优化算法  交叉算子  局部搜索策略
收稿时间:2015/7/26 0:00:00
修稿时间:2015/10/20 0:00:00

Test Case Generation Based on Combination of Schema Using Particle Swarm Optimization
JIANG Shu-Juan,WANG Ling-Sai,XUE Meng,ZHANG Yan-Mei,YU Qiao and YAO Hui-Ran.Test Case Generation Based on Combination of Schema Using Particle Swarm Optimization[J].Journal of Software,2016,27(4):785-801.
Authors:JIANG Shu-Juan  WANG Ling-Sai  XUE Meng  ZHANG Yan-Mei  YU Qiao and YAO Hui-Ran
Affiliation:School of Computer Science and Technology, China University of Mining and Technology, Xuzhou 221116, China;Guangxi Key Laboratory of Trusted Software(Guilin University of Electronic Technology), Guilin 541004, China,School of Computer Science and Technology, China University of Mining and Technology, Xuzhou 221116, China,School of Computer Science and Technology, China University of Mining and Technology, Xuzhou 221116, China,School of Computer Science and Technology, China University of Mining and Technology, Xuzhou 221116, China;State Key Laboratory for Novel Software Technology(Nanjing University), Nanjing 210023, China,School of Computer Science and Technology, China University of Mining and Technology, Xuzhou 221116, China and School of Computer Science and Technology, China University of Mining and Technology, Xuzhou 221116, 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.
Keywords:test case generation  particle swarm optimization algorithm  crossover operator  local search strategy
本文献已被 CNKI 等数据库收录!
点击此处可从《软件学报》浏览原始摘要信息
点击此处可从《软件学报》下载全文
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号