Software testing is a widespread validation means of software quality assurance in industry. Intelligent optimization algorithms have been proved to be an effective way of automatic test data generation. Firefly algorithm has received extensive attention and been widely used to solve optimization problems because of less parameters and simple implement. To overcome slow convergence rate and low accuracy of the firefly algorithm, a novel firefly algorithm with deep learning is proposed to generate structural test data. Initially, the population is divided into male subgroup and female subgroup. Following the randomly attracted model, each male firefly will be attracted by another randomly selected female firefly to focus on global search in whole space. Each female firefly implements local search under the leadership of the general center firefly, constructed based on historical experience with deep learning. At the final period of searching, chaos search is conducted near the best firefly to improve search accuracy. Simulation results show that the proposed algorithm can achieve better performance in terms of success coverage rate, coverage time, and diversity of solutions.
Software testing identifies potential errors and defects in software. A crucial component of software testing is integration testing, and the generation of class integration test orders (CITOs) is a critical topic in integration testing. The research shows that search-based algorithms can solve this problem effectively. As a novel search-based algorithm, the sparrow search algorithm (SSA) is good at finding the optimal to optimization problems, but it has drawbacks like weak population variety later on and the tendency to easily fall into the local optimum. To overcome its shortcomings, a modified sparrow search algorithm (MSSA) is developed and applied to the CITO generation issue. The algorithm is initialized with a good point set strategy, which distributes the sparrows evenly in the solution space. Then, the discoverer learning strategy of Brownian motion is introduced and the Levy flight is utilized to renew the positions of the followers, which balances the global search and local search of the algorithm. Finally, the optimal solution is subjected to random wandering to increase the probability of the algorithm jumping out of the local optimum. Using the overall stubbing complexity as a fitness function to evaluate different class test sequences, experiments are conducted on open-source Java systems, and the experimental results demonstrate that the MSSA generates test orders with lower stubbing cost in a shorter time than other novel intelligent algorithms. The superiority of the proposed algorithm is verified by five evaluation indexes: the overall stubbing complexity, attribute complexity, method complexity, convergence speed, and running time. The MSSA has shown significant advantages over the BSSA in all aspects. Among the nine systems, the total overall stubbing complexity of the MSSA is 13.776% lower than that of the BSSA. Total time is reduced by 23.814 s.
Software quality can be effectively ensured by software testing. The creation of test data is a key component of software testing automation. One unresolved issue is how to automatically create test data sets for the data flow coverage criterion. Search-based software testing (SBST) is a technique that employs meta-heuristic search algorithms to generate test data. In this paper, a method of automatic test data generation for data flow coverage criterion based on the enhanced snow ablation optimizer (ESAO) is proposed. First, the snow ablation optimizer (SAO) is enhanced to improve the efficiency of the algorithm through the Latin hypercube sampling (LHS) initialization strategy and warming strategy. Second, the construction of the fitness function is considered in terms of both definition node and use node. Third, the data flow-based test cases are automatically generated based on the ESAO. This method of generating test cases that cover all definition-use pairs (DUPs) improves the efficiency and coverage of test case generation, and thus improves the efficiency of software testing.