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

计算机工程 ›› 2008, Vol. 34 ›› Issue (6): 93-94. doi: 10.3969/j.issn.1000-3428.2008.06.034

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

基于PSO的软件结构测试数据自动生成方法

李爱国,张艳丽   

  1. (西安科技大学计算机系,西安 710054)
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2008-03-20 发布日期:2008-03-20

Automatic Generation Method of Test Data for SoftwareStructure Based on PSO

LI Ai-guo, ZHANG Yan-li   

  1. (Department of Computer Science, Xi’an University of Science and Technology, Xi’an 710054)
  • Received:1900-01-01 Revised:1900-01-01 Online:2008-03-20 Published:2008-03-20

摘要: 测试数据自动生成是软件测试过程中一个关键的问题。现有的结构测试数据自动生成,多采用基于遗传算法的方法。这些方法存在算法复杂、参数不易设置问题。该文提出一种基于粒子群算法的软件结构测试数据自动生成方法,以分支函数叠加法作为适应值函数。针对三角形判别程序的结构测试数据生成实验结果表明,与基于遗传算法的方法相比,可以更高效地生成测试数据,在粒子数目与种群个数相同的情况下,生成所需测试数据的迭代次数仅是遗传算法的1/16左右。

关键词: 结构测试, 测试数据, 粒子群优化, 遗传算法

Abstract: It is an important task to generate test data automatically within the software testing process. The previous approaches of generating structural test data are mostly based on variant Genetic Algorithms(GA). These approaches have two shortcomings: the algorithms are too complex to use, and the parameters of the algorithms are not easy to be set by users. A novel approach for generating structural test data based on Particle Swarm Optimizer(PSO) is proposed. The approach employs the summation of branch-function as fitness function of PSO. Two triangle discrimination programs are used to experiment. The experimental results show that the approach is more efficient than GA based approach: when the number of particles of PSO is equal to the size of GA, the mean number of iteration of proposed approach is about 1/16 as many as that of GA-based approach.

Key words: structural test, test data, Particle Swarm Optimizer(PSO), Genetic Algorithm(GA)

中图分类号: