Directed Search Based on Improved Whale Optimization Algorithm for Test Case Prioritization

Bin Yang, Huilai Li, Ying Xing, Fuping Zeng, Chengdong Qian, Youzhi Shen, Jiongbo WangInternational Journal of Computers Communications & Control 2023

Abstract

With the advent of the information age, the iterative speed of software update is gradually accelerating which makes software development severely limited by software testing. Test case prioritization is an effective way to accelerate software testing progress. With the introduction of heuristic algorithm to this task, the processing efficiency of test cases has been greatly improved. However, to overcome the shortcomings of slow convergence speed and easy fall into local optimum, the improved whale optimization algorithm is proposed for test case prioritization. Firstly, a model called n-dimensional directed search space is established for the swarm intelligence algorithm. Secondly, the enhanced whale optimization algorithm is applied to test case prioritization while the backtracking behavior is conducted for individuals when hitting the wall. In addition, a separate storage space for Pareto second optimization is also designed to filter the optimal solutions of the multi-objective tasks. Finally, both single-objective and multi-objective optimization experiments are carried out for open source projects and real-world projects, respectively. The results show that the improved whale optimization algorithm using n-dimensional directed search space is more conducive to the decisions of test case prioritization with fast convergence speed.

Introduction

In modern software development, rapid iteration cycles demand frequent regression testing to ensure that new code changes do not introduce regressions. As software systems grow in complexity, the size of test suites often becomes a bottleneck, making exhaustive testing prohibitively expensive. Test Case Prioritization (TCP) is a critical strategy used to reorder test cases so that those with the highest fault detection capability or code coverage are executed first.

Mathematically, TCP is an NP-hard problem. While nature-inspired "swarm intelligence" algorithms have been applied to search these vast solution spaces, they often struggle with slow convergence or becoming trapped in local optima. This paper introduces the Reinforced Exploration Mechanism Whale Optimization Algorithm (REM-WOA), which utilizes a novel search space modeling technique to overcome these limitations.

Methodology

The proposed REM-WOA framework introduces several innovations to the standard Whale Optimization Algorithm to make it suitable for the discrete and complex nature of test case sequences.

n-Dimensional Directed Search Space

Rather than searching through a simple list of permutations, the researchers map test case sequences into a structured n-dimensional grid. Each position in this grid represents a unique, random arrangement of the test suite. This transformation allows the algorithm to treat the discrete prioritization problem as a search through a continuous-like geometric space.

Mapping test case sequences into an n-dimensional search space grid.

Search Space Preprocessing and Sorting

To provide the "whales" (search agents) with a direction to follow, the search space undergoes a preprocessing phase. The grid is sorted based on objective values, such as the Average Percentage of Test point Coverage (APTC) or Effective Execution Time (EET). By sorting the grid, the researchers create a mathematical "trend" or gradient. This ensures that adjacent points in the search space have related fitness values, allowing the algorithm to follow a "scent" toward the global optimum.

Preprocessing the search space by sorting grid elements to create a searchable trend.

Reinforced Exploration Mechanisms

To further improve performance, REM-WOA includes:

  • Backtracking Mechanism: When search agents reach the boundaries of the grid, they are redirected back into the search space rather than getting stuck at the edges.
  • Convergence Adaptive Weighting: This dynamically adjusts the search intensity, speeding up the process as the algorithm nears a potential solution.
  • Pareto Optimization: For multi-objective scenarios (e.g., maximizing coverage while minimizing time), a dedicated storage space filters for the most balanced, non-dominated solutions.

Experimental Evaluation

The algorithm was evaluated using two primary datasets:

  1. Siemens Open-Source Programs: A standard benchmark including programs like Grep and Flex, ranging from hundreds to tens of thousands of lines of code.
  2. Real-World Project: A gateway protocol project developed by Phytium Technology Co., providing a practical testbed for the algorithm's industrial utility.

Key Results and Discussion

The experimental results indicate that REM-WOA significantly outperforms traditional heuristics like the Artificial Fish School Algorithm (AFSA) and the Immune Algorithm (IA).

  • Superior Coverage: On the Siemens datasets, REM-WOA consistently achieved higher APTC scores, meaning it identifies critical test cases earlier in the execution cycle.
  • Stability and Reliability: Through the use of violin plots, the researchers demonstrated that REM-WOA has lower variance than its competitors, consistently finding high-quality solutions across multiple runs.
  • Efficiency in Practice: In the Phytium gateway project, the algorithm's median results for both coverage and execution time were superior to existing methods, with a more concentrated distribution of optimal results.

Conclusion

By mapping test case sequences into a directed, preprocessed search space, the REM-WOA provides a more efficient and reliable path for test case prioritization. The combination of trend-based mapping and reinforced exploration allows the algorithm to converge faster and avoid the local optima that plague standard swarm intelligence methods. Future work will focus on integrating these heuristic approaches with deterministic algorithms to further reduce the computational overhead of large-scale industrial testing.

Summary updated

BibTeX
@article{yang2023directed,
  author = {Bin Yang and Huilai Li and Ying Xing and Fuping Zeng and Chengdong Qian and Youzhi Shen and Jiongbo Wang},
  title = {{Directed Search Based on Improved Whale Optimization Algorithm for Test Case Prioritization}},
  journal = {International Journal of Computers Communications \& Control},
  year = {2023},
  doi = {10.15837/ijccc.2023.2.5049},
}
Figure