针对遗传算法在多路径测试用例自动生成中的不足,提出基于退火遗传算法的生成方法。对遗传算法的适应度函数进行优化设计,以满足多路径测试用例生成。同时在算法中引入路径存储机制,从而增强测试用例自动生成的功效。在提高算法的局部搜索能力方面,对遗传算法的两点交叉算子进行改进,并引入模拟退火算法到变异操作。三角形判断程序的测试用例生成实验结果,验证了该方法的有效性。
Aiming at the shortage of test case generator based on genetic algorithm,this paper proposed multiple paths test case generator based on annealing genetic algorithm. Designed the fitness function and introduced storage paths mechanism to synthesize multiple test data to cover multiple target paths. Improved crossover of genetic algorithm,and applied simulated annealing to the mutation,in order to improve the efficiency of the algorithm. Moreover,implemented the generator to the triangle classifier program. Experimental results show that the test data generator is efficient and effective.