Automatic and Efficient Test Case Generation with High-Diversity and Global-Search Particle Swarm Optimization

Yuchen Zhao, Haitao Yuan, Jingyao Li, Ziyue Zheng, Jing Bi, Jia Zhang, MengChu Zhou2025

Abstract

Recent years have witnessed the wide application of computer software in automation and intelligent production, and the demand for generating high-diversity software test cases is increasing. At present, the main software test case generation methods adopt the Monte Carlo method or use expert knowledge, which requires high computing power and time cost. How to efficiently generate test cases with high statement coverage has become a challenging engineering problem. In this work, the statement coverage is used to evaluate the contribution of test cases, and a single objective optimization problem with parameter constraints is proposed. To realize it, an optimization algorithm combining particle swarm optimization (PSO), genetic algorithm (GA), and simulated annealing (SA) is used to generate test cases with high statement coverage. In the optimization framework, each particle represents a candidate test case, encoded as a vector of input parameters corresponding to the code under testing. These position vectors are directly mapped to executable test inputs, and the fitness of each particle is evaluated by the statement coverage achieved upon execution. The test cases generated using the proposed hybrid algorithm achieve a statement coverage of up to 98 %. It has been successfully applied to several core components in industrial software to demonstrate its strong generalization.
BibTeX
@misc{zhao2025automatic,
  author = {Yuchen Zhao and Haitao Yuan and Jingyao Li and Ziyue Zheng and Jing Bi and Jia Zhang and MengChu Zhou},
  title = {{Automatic and Efficient Test Case Generation with High-Diversity and Global-Search Particle Swarm Optimization}},
  year = {2025},
  doi = {10.1109/icnsc66229.2025.00083},
}

Loading related content...

Figure