| In recent years,incorrect output caused by software quality has led to safety accidents in applications such as deep learning parameters and autonomous driving.Software testing is an important method to improve software quality.With the improvement of the requirements for the rapidity and correctness of software logical path test case generation,the design of test cases becomes particularly important.The traditional manual generation of test cases that meet test requirements is lengthy and prone to errors.Using intelligent search algorithms to solve the most optimization problems is a popular method for test case generation recently.Applying it to test case generation has also been proven to be an effective method,but its efficiency is not high.This paper proposes a test case generation method based on branch evolution theory to solve the problems of low efficiency in existing test case generation methods.The main work is as follows:(1)Based on the traditional search algorithm framework,this article first draws a program flow diagram and a control flow diagram through dynamic and static analysis of the program.The basic path set is obtained through the control flow diagram.The basic path set is detected for unreachable paths,and the unreachable paths are deleted.The remaining paths are used as the basic path set of the program under test.Two new definitions are proposed,namely,node complexity and target path distance.The average node complexity is obtained by calculating the node complexity of all nodes in the basic path set,and the basic path set is sorted based on the average node complexity to determine the priority of the tested path execution;Calculate the reachability of a branch to a node based on the calculated node complexity,that is,the branch complexity,and apply this branch complexity to the construction of a fitness function;Calculate the target path distance between the current path and the target path in the basic path set.After the algorithm has generated test cases that meet the termination conditions,guide the current path to cover the remaining paths in the basic path set based on the target path distance,improving the efficiency of test case generation.(2)Then,aiming at the deficiency of imbalance in the accumulation and generation of individuals in the algorithm population,this paper designs a population distribution equilibrium operator and a population proportion equilibrium operator,which obtain the internal equilibrium and external equilibrium of individuals in the population through the dispersion degree of individuals in the population and surrounding individuals,and solve the imbalance in the generation of individuals in the population;The problem of mismatches between the size of individuals generated by the population and the size of the population itself is solved through the population proportional equilibrium operator.The introduction of the population distribution equilibrium operator and the population proportion equilibrium operator ensures the consistency of the generation of individuals in the population,and ensures the stability of individuals in the population.Finally,in the experimental part,a comparative evaluation was conducted between the test case generation method presented in the current study and the generation method proposed in this article in terms of the average algorithm evaluation times,the average running time,and the success rate.Experimental data verified that compared with the branch balance test case generation method and the basic search algorithm,the running time of the method was reduced by 0.004 s and 0.0007 s respectively,and the evaluation times were reduced by 1934.8 and 14521.2 times,respectively. |