Test case priority ranking method based on multi-strategy whale grey wolf algorithm
By introducing a multi-strategy gray wolf whale algorithm in the priority sorting of test cases, the problems of low population diversity and poor global search capabilities in the existing technology are solved, and more efficient test case priority sorting is achieved.
Patent Information
- Application Number
- CN202510109084.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2045-01-23
AI Technical Summary
The existing test case priority sorting method based on group intelligence algorithm has problems such as low population diversity, poor global search ability, and easy to fall into local optimality, which affects the effectiveness and efficiency of sorting.
A test case priority sorting method based on multi-strategy gray wolf whale algorithm is proposed. By setting dual optimization targets in the population initialization module, using a uniform distribution method and a pseudo-reverse learning strategy to initialize populations, and removing control factors, nonlinear convergence factors, fusing random factors and mixed random factors in the optimization sorting module, the gray wolf whale mixing algorithm is obtained, which is used to optimize the test case sequence.
Improve population diversity, enhance global search capabilities, avoid falling into local optimal problems, thereby quickly and effectively determining the priority of test cases.
Smart Images

Figure CN119537255A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software testing, and in particular to a test case priority sorting method based on a multi-strategy grey wolf whale algorithm. Background Art
[0002] Test Case Prioritization (TCP) is an effective way to speed up software testing. However, existing TCP methods usually ignore the balance between effectiveness and efficiency of sorting. Currently, swarm intelligence algorithms such as the Grey Wolf Optimization Algorithm and the Whale Optimization Algorithm have been widely used in TCP problems to improve the effectiveness of sorting.
[0003] However, the existing TCP methods based on swarm intelligence algorithms mostly adopt a single optimization method and rarely integrate the advantages of multiple algorithms. They have common defects such as low population diversity, poor global search ability, and easy to fall into local optimality, which will have an adverse impact on the effectiveness and efficiency of sorting. Summary of the invention
[0004] To this end, an embodiment of the present invention proposes a test case priority sorting method based on a multi-strategy gray wolf whale algorithm to solve the problems of low population diversity, poor global search capability, and easy to fall into local optimality in the prior art, and to improve the effectiveness and efficiency of sorting.
[0005] A test case prioritization method based on a multi-strategy grey wolf whale algorithm according to an embodiment of the present invention is applied to a test case prioritization system, wherein the test case prioritization system includes a population initialization module and an optimization sorting module; In the population initialization module, a dual optimization objective is first established, which includes the average defect detection percentage and the effective execution time. Then, a two-dimensional sequence population search space is constructed and initialized based on the dual optimization objective maximum method, thereby obtaining a two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objective. A uniform distribution-based method is used to initialize the population of the two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objective to obtain the original use case sequence population. At the same time, a pseudo-reverse learning strategy and a dynamic reverse learning strategy are used to obtain a dynamic use case sequence population that is reverse to the original use case sequence population. Sequence individuals with fitness values greater than a threshold in the original use case sequence population and the dynamic use case sequence population are retained to obtain an initial use case sequence population. In the optimization sorting module, the control factors in the gray wolf optimization algorithm and the whale optimization algorithm are first removed. In addition, the convergence factors of the gray wolf optimization algorithm and the whale optimization algorithm are nonlinearized. Then a random factor judgment condition and a mixed random factor are added to merge the gray wolf optimization algorithm and the whale optimization algorithm to obtain the gray wolf-whale hybrid algorithm. Finally, the gray wolf-whale hybrid algorithm is used to search and evaluate the initial use case sequence population to generate the Pareto optimal sequence set to determine the test case priority.
[0006] According to the test case priority sorting method based on the multi-strategy gray wolf whale algorithm of the embodiment of the present invention, a method based on uniform distribution is adopted to initialize the population of the two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objectives to obtain the original use case sequence population, and at the same time, a pseudo-reverse learning strategy and a dynamic reverse learning strategy are adopted to obtain a dynamic use case sequence population that is reverse to the original use case sequence population, which can improve the population diversity, and then obtain a high-quality initial use case sequence population, and improve the solution accuracy and speed of the whale optimization algorithm. The present invention removes common redundant parameters to ensure the basic performance of the two priority algorithms, nonlinearizes the convergence factor, and can balance the global search and local search capabilities. A random factor judgment condition and a mixed random factor are added to merge the two algorithms, so that the gray wolf whale hybrid algorithm can be well used for TCP. Compared with a single algorithm, the present invention can enhance the global search capability and avoid falling into the local optimum, thereby quickly and effectively determining the priority of the test case. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] The above and / or additional aspects and advantages of the embodiments of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which: Figure 1 is a schematic diagram of the structure of a test case prioritization system according to an embodiment of the present invention; Figure 2 It is a flowchart of a test case priority sorting method based on a multi-strategy grey wolf whale algorithm according to an embodiment of the present invention; Figure 3 This is an example diagram of discretizing the use case sequence based on the asexual repair mechanism. DETAILED DESCRIPTION
[0008] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0009] The embodiment of the present invention proposes a test case prioritization method based on a multi-strategy gray wolf whale algorithm, which is applied to a test case prioritization system. Figure 1 , the test case priority sorting system includes a population initialization module and an optimization sorting module.
[0010] See also Figure 2 , the method comprises steps S1 to S2: Step S1, in the population initialization module, first establish a dual optimization objective, the dual optimization objective includes an average defect detection percentage and an effective execution time, then construct a two-dimensional sequence population search space, and initialize the two-dimensional sequence population search space based on the dual optimization objective maximum value method, thereby obtaining a two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objectives; adopt a uniform distribution-based method to initialize the population of the two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objectives to obtain an original use case sequence population, and simultaneously adopt a pseudo-reverse learning strategy and a dynamic reverse learning strategy to obtain a dynamic use case sequence population that is reverse to the original use case sequence population, retain the sequence individuals whose fitness values are greater than a threshold in the original use case sequence population and the dynamic use case sequence population, so as to obtain an initial use case sequence population.
[0011] Due to the existing method of initializing the population using the reverse learning strategy, the generated reverse population has low randomness, and the generation process is static and lacks adaptability. In addition, under the symmetric scope, the reverse learning strategy may fail, which will weaken the diversity of the population, thereby increasing the risk of the algorithm falling into a local optimum. The present invention sets two optimization goals and uses a maximum method based on dual optimization goals to initialize the two-dimensional use case sequence search space. In addition, in order to enhance the randomness and diversity of the initial population, improve the solution accuracy and convergence speed of the whale algorithm, and thus improve the effectiveness and efficiency of the test case sorting, the original use case sequence population is obtained based on the uniform distribution method, and a dynamic pseudo-reverse learning strategy is designed to generate a dynamic use case sequence population that is reverse to the original population, retaining the original use case sequence population and the dynamic use case sequence population. Individuals with higher fitness values in the sequence population are retained to obtain a high-quality initial use case sequence population.
[0012] Among them, the average defect detection percentage APFD and effective execution time EET , which aims to balance the effectiveness and efficiency of sorting, thereby improving the overall test performance.
[0013] Specifically, the expressions for the average defect detection percentage and effective execution time are: ; ; in, APFDis the average defect detection percentage, M Indicates the number of statements in the program, N Indicates the number of test cases, TF 1. TF 2. TF M They represent the first time the first defect, the second defect, and the M The position of the test case with the defect in the sequence, EFT is the effective execution time, ET i Indicates i The time required to execute a test case. Indicates the number of test cases executed when the maximum statement coverage is first reached; After establishing the dual optimization objectives, a two-dimensional sequence population search space is constructed and initialized using a dual optimization objective maximum method. The purpose is to bind the test case sequence to the position in the search space and establish an association between each sequence individual in the search space to solve the problem that the gray wolf and whale optimization algorithms can only process numerical data and cannot directly identify test case information, while accelerating the convergence speed of the algorithm, so as to better apply the gray wolf optimization algorithm and the whale optimization algorithm to TCP. Specifically, the present invention is for N Test cases are randomly generated P possible use case sequences, that is, the initial population size is P , and each test case sequence is regarded as a population individual in the search space. The test case number in each sequence is mapped to the position of the population individual in different dimensions. Based on the dual optimization objectives, these population individuals are arranged into a matrix to form a two-dimensional global search space. Then, it is initialized using the dual optimization objective maximum method. For the optimization objective APFD , rearrange the matrix according to the maximum value of each row; for the optimization objective EFT , rearranged according to the maximum value of each column. Finally, a two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objectives is obtained.
[0014] After obtaining the two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objectives, the population needs to be initialized. In order to avoid the problem that the initial population generated by the random method is concentrated in one area or dispersed in an area far away from the optimal value, thereby causing the algorithm to fall into the local optimum, the present invention, on the one hand, uses a method based on uniform distribution to generate the original use case sequence population to ensure that the generated original use case sequence individuals are as evenly distributed as possible in the search space, and on the other hand, proposes a method of combining a dynamic reverse learning strategy with a pseudo-reverse learning strategy to initialize the population to improve the diversity of the initial population.
[0015] Because the positions of individuals in the population can only take integer values, rounding is required in the position initialization. Specifically, a method based on uniform distribution is used to initialize the population of the two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objectives. In the process of obtaining the original case sequence population, the following formula is satisfied: ; ; in, RTC Indicates the rearranged sequence numbers 1 to N A list of integers consisting of the use cases of , Indicates that the test cases are randomly arranged. TC Indicates sequence number 1 to N A list of integers consisting of the use cases of , Expressed as i The first j The test case number corresponding to the position, Indicates rounding operation. express RTC The i elements, Represents the operation of generating random numbers.
[0016] The present invention is tested using several test cases below: If a sequence includes 5 test cases, then the test case integer list TC =[1, 2, 3, 4, 5], N =5, TC 1=1, TC 2=2, TC 3=3, TC 4=4, TC 5=5, TC 1. TC 2. TC 3. TC 4. TC 5 are TC The first, second, third, fourth, and fifth elements in randperm The function will TC The order of the test cases in is randomly arranged. RTC It may become [2,3, 1, 4, 5], then RTC 1=2, RTC 2=3, RTC 3=1, RTC 4=4, RTC 5=5, RTC 1. RTC 2. RTC 3. RTC 4. RTC 5 are RTC The first, second, third, fourth, and fifth elements in the first use case sequence individual OP 1 may be =[3, 5, 1, 4, 2], then OP 1,1 =3, OP 1,2 =5, OP 1,3 =1, OP 1,4 =4, OP 1,5 =2.
[0017] Then, in order to improve the diversity of the initial population, the pseudo-reverse learning strategy and the dynamic reverse learning strategy are combined to optimize the original population and obtain a dynamic use case sequence population that is reverse to the original use case sequence population. The pseudo-reverse learning strategy solves the problem that reverse learning fails under symmetric scopes, while the dynamic reverse learning strategy realizes adaptive learning of reverse points in the search space through a dynamic reverse operator. After combining these two methods, the search space is transformed into an asymmetric structure, thereby enhancing the randomness of generating opposite individuals. This improvement improves the exploration and development capabilities of the gray wolf whale hybrid algorithm, while also improving the convergence speed of the algorithm, enabling it to more effectively find test case sequences with better overall performance.
[0018] Specifically, in the process of using the pseudo-reverse learning strategy and the dynamic reverse learning strategy to obtain a dynamic use case sequence population that is reverse to the original use case sequence population, the following formula is satisfied: ; ; ; in, Indicates i The first j The test case sequence number corresponding to the reverse position obtained by the reverse learning strategy is Indicates i The first j The test case sequence number corresponding to the pseudo-reverse position obtained by the pseudo-reverse learning strategy is Indicates i The first j The test case sequence number corresponding to the dynamic pseudo-reverse position obtained by the dynamic pseudo-reverse learning strategy is and is a random number.
[0019] Take the first use case sequence individual generated above OP Take 1 as an example, OP 1=[3, 5, 1, 4, 2], the individuals generated by the reverse learning strategy are =[3, 1, 5, 2, 4].
[0020] In addition, in order to avoid the failure of the dynamic pseudo-learning strategy during implementation, it is necessary to check the boundaries of the individual positions of each test case sequence in the initial population. When the position update exceeds the upper and lower bounds, a test case is randomly selected. Specifically, when or hour, .
[0021] After obtaining the original use case sequence population and the dynamic use case sequence population, the sequence individuals whose fitness values are greater than a threshold in the original use case sequence population and the dynamic use case sequence population are retained to obtain the initial use case sequence population.
[0022] Step S2, in the optimization sorting module, first remove the control factors in the gray wolf optimization algorithm and the whale optimization algorithm. In addition, implement nonlinearization on the convergence factors of the gray wolf optimization algorithm and the whale optimization algorithm, and then add a random factor judgment condition and a mixed random factor to merge the gray wolf optimization algorithm with the whale optimization algorithm to obtain a gray wolf-whale hybrid algorithm. Finally, use the gray wolf-whale hybrid algorithm to search and evaluate the initial use case sequence population to generate a Pareto optimal sequence set to determine the test case priority.
[0023] It is necessary to improve and mix the gray wolf optimization algorithm and the whale optimization algorithm to more effectively search for the optimal solution in the initial use case sequence population. The present invention removes the control factors in the gray wolf optimization algorithm and the whale optimization algorithm to better mix the gray wolf and whale algorithms to ensure the basic performance of the two algorithms. In addition, the present invention implements nonlinearization on the convergence factors of the two algorithms to take into account local and global searches and improve algorithm performance. Finally, the gray wolf-whale hybrid algorithm is used to search and evaluate the initial use case sequence population to generate a Pareto optimal sequence set.
[0024] In order to deal with the TCP problem and ensure the basic performance of the whale optimization algorithm and the gray wolf optimization algorithm, the present invention removes the control factors in the two algorithms. Both algorithms will surround the prey and update the individual positions. In the TCP based on the swarm intelligence algorithm, each individual expresses the execution order of the test cases, and the individual position is the serial number of these test cases. Therefore, updating the individual position is to adjust the execution order of the test cases. Specifically, after removing the control factors in the gray wolf optimization algorithm and the whale optimization algorithm, the following formula is obtained: ; ; in, Indicates t The position vector of the wolf or whale at the iteration, Indicates t +1 The position vector of the wolf or whale at iteration 1, Indicates t The position vector of the prey at the iteration, is the coefficient vector, is the convergence factor vector, is a random vector in the interval [0, 1]; and As the t The sequence individuals that are updated sequentially at the iteration are As the t The best order of use cases for the iteration As the t +1 sequence individuals for sequential update at iteration.
[0025] Both the whale optimization algorithm and the gray wolf optimization algorithm include global search and local search in the iterative process. Strong global search capabilities can maintain the diversity of the population, while local search capabilities can ensure the accuracy of the algorithm search. Only by coordinating global and local searches can the possibility of the algorithm falling into the local optimum be reduced and the convergence performance be improved. The transformation of the global search and development capabilities of the whale optimization algorithm and the gray wolf optimization algorithm depends on the convergence factor. Although the convergence factor decreases linearly with the number of iterations, the changes in the gray wolf and whale populations are nonlinear during the convergence process, so the linearly decreasing convergence factor cannot fully reflect the actual search process. That is, this linear reduction method cannot achieve a balance between global search and local search. Based on this, the present invention implements nonlinearization on the convergence factors of the gray wolf optimization algorithm and the whale optimization algorithm, and obtains the following formula: ; in, represents the convergence factor, and represent the initial and final values of the convergence factor, respectively. T represents the maximum number of iterations, is the nonlinear adjustment coefficient.
[0026] Compared with the original algorithm, in the early stage of iteration, the convergence factor The changes will be slow at first and then fast. >1 accounts for a large proportion of the iterations, which enhances the global search capability of the algorithm and is conducive to finding the optimal sequence in the search space; in the later stages of the iteration, The changes will be fast at first and then slow. The proportion of cases >1 is small, which improves the local exploration ability of the algorithm and is conducive to further exploration around the current optimal solution.
[0027] After improving the common control parameters of the Gray Wolf and Whale algorithms, it is also necessary to optimize the random factors of the Whale algorithm. Adjust and optimize. In the whale optimization algorithm, is an important parameter guiding the movement of whales. Add a mixed random factor based on , in order to integrate the gray wolf algorithm into the whale algorithm, and choose between the gray wolf hunting mechanism and the whale spiral model with a probability of 50% during the optimization process to update the individual position. In addition, the present invention adopts the Tent chaos function as the random factor judgment condition to update the random factor of the whale optimization algorithm and mixed random factors , as follows: ; ; in, For the t +1 iteration of the whale optimization algorithm random factor, For the t The random factor of the whale optimization algorithm for the iteration, For the t +1 iteration of mixing random factor, For the t The random mixing factor for the iteration.
[0028] In addition, a judgment condition of the gray wolf optimization algorithm is added in the exploration phase to improve the whale search mechanism. Finally, a gray wolf-whale hybrid algorithm is obtained, which satisfies the following formula: When condition 1 is met, ; When condition 2 is met, ; When condition three is met, ; When condition 4 is met, ; Among them, condition one is: ,and ,and ,and ,and ; Condition 2 is: ,and ,and ,and ,and ; Condition three is: ,and ; Condition 4 is a condition in addition to Condition 1, Condition 2 and Condition 3; in, Represents the random factor of the whale optimization algorithm, represents the mixed random factor, Indicated in t The position of the individual whales randomly selected in the iteration, b represents the parameters that control the shape of the whale's spiral attack. l is a random number in the interval [-1,1], , , Respectively indicate the selected wolf one, wolf two, and wolf three in the t The position vector at the iteration, , , It can be calculated by the formula obtained by removing the control factors in the gray wolf optimization algorithm and the whale optimization algorithm. represents the coefficient vector corresponding to wolf one, represents the coefficient vector corresponding to Wolf 2, represents the coefficient vector corresponding to wolf three.
[0029] Compared with the original whale optimization algorithm, in the early stage of iteration, as mentioned above >1 condition accounts for a large proportion of the iteration process. At this time, the whale random search mechanism or the gray wolf hunting mechanism may be used for global search, or the whale spiral attack mechanism may be used for local search to update the individual position (use case order). This increases the probability of global search in the early stage, enhances the global exploration ability of the algorithm, and helps to improve the solution efficiency; in the later stage of the iteration, >1 The proportion of conditions is small. At this time, the algorithm may implement local search through the whale encirclement mechanism or the gray wolf hunting mechanism to update the individual position (use case order), which slows down the convergence speed in the later stage and improves the local exploration ability of the later algorithm, which is conducive to further exploring better solutions around the current optimal solution.
[0030] In addition, during the search process, the gray wolf whale hybrid algorithm iteratively updates and evaluates the position of the population individuals, which actually adjusts the arrangement order of the test cases, thereby optimizing the execution order of the test cases. Because each test case sequence number in the test case sequence is an integer, the position of the population individual can only take an integer value. However, since the gray wolf whale hybrid algorithm is applicable to continuous values, and there will be situations where repeated positions are generated. In order to better solve the TCP problem, in this embodiment, in the process of searching and evaluating the initial use case sequence population using the gray wolf whale hybrid algorithm, an asexual repair mechanism is introduced to discretize the use case sequence. The specific process is: Step 1: Update the sequence population through the gray wolf-whale hybrid algorithm. For a single sequence individual, round the value of each position to an integer to obtain the current sequence. Step 2: Use the parent sequence to check the boundary value and repeated value of the current sequence, and use irrelevant values to replace the case sequence numbers in the current sequence that exceed the parent sequence number boundary and are repeated to obtain a compliant sequence; Step 3: Compare the compliant sequence with the paternal sequence, and replace the case numbers in the paternal sequence that are the same as the compliant sequence with irrelevant values to obtain a non-redundant paternal sequence; Step 4: Fill in the irrelevant values in the compliant sequence according to the order of the use cases in the non-redundant parent sequence to obtain the repaired offspring sequence, which is the optimal sequence for one iteration.
[0031] by Figure 3 As an example, assume that the parent sequence is X l = [9.36, 4.46, 2.34, 2.12, 6.57], rounded to get the current sequence X l = [9, 4, 2, 2, 7]. First, check the boundary value and repeated value of the current sequence. X l = [*, 4, 2, *, *], * indicates irrelevant value, then X i ( t )and X l After removing duplicate values, a non-redundant parent sequence [1, *, 3, *, 5] is generated. Finally, the non-redundant parent sequence and the compliant sequence are used together to generate the repaired offspring sequence. X i ( t + 1) = [1, 4, 2, 3, 5].
[0032] After multiple iterations, when the maximum number of iterations is reached, the gray wolf-whale hybrid algorithm stops searching and ends the updating and evaluation of the population. Finally, a Pareto optimal sequence set is generated to determine the test case priority.
[0033] According to the test case priority sorting method based on the multi-strategy gray wolf whale algorithm, a uniform distribution-based method is used to initialize the population of the two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objectives to obtain the original use case sequence population. At the same time, a pseudo-reverse learning strategy and a dynamic reverse learning strategy are used to obtain a dynamic use case sequence population that is reverse to the original use case sequence population, which can improve the population diversity, thereby obtaining a high-quality initial use case sequence population, and improving the solution accuracy and speed of the whale optimization algorithm. The present invention removes common redundant parameters to ensure the basic performance of the two priority algorithms, nonlinearizes the convergence factor, and can balance the global search and local search capabilities. A random factor judgment condition and a mixed random factor are added to merge the two algorithms, so that the gray wolf whale hybrid algorithm can be well used for TCP. Compared with a single algorithm, the present invention can enhance the global search capability and avoid falling into the local optimum, thereby quickly and effectively determining the priority of the test case.
[0034] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0035] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A test case prioritization method based on a multi-strategy grey wolf whale algorithm, characterized in that: Applied to a test case prioritization system, the test case prioritization system includes a population initialization module and an optimization sorting module; In the population initialization module, a dual optimization objective is first established, which includes the average defect detection percentage and the effective execution time. Then, a two-dimensional sequence population search space is constructed and initialized based on the dual optimization objective maximum method, thereby obtaining a two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objective. A uniform distribution-based method is used to initialize the population of the two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objective to obtain the original use case sequence population. At the same time, a pseudo-reverse learning strategy and a dynamic reverse learning strategy are used to obtain a dynamic use case sequence population that is reverse to the original use case sequence population. Sequence individuals with fitness values greater than a threshold in the original use case sequence population and the dynamic use case sequence population are retained to obtain an initial use case sequence population. In the optimization sorting module, the control factors in the gray wolf optimization algorithm and the whale optimization algorithm are first removed. In addition, the convergence factors of the gray wolf optimization algorithm and the whale optimization algorithm are nonlinearized. Then a random factor judgment condition and a mixed random factor are added to merge the gray wolf optimization algorithm and the whale optimization algorithm to obtain the gray wolf-whale hybrid algorithm. Finally, the gray wolf-whale hybrid algorithm is used to search and evaluate the initial use case sequence population to generate the Pareto optimal sequence set to determine the test case priority.
2. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 1 is characterized in that: The expressions for average defect detection percentage and effective execution time are: ; ; in, APFD is the average defect detection percentage, M Indicates the number of statements in the program, N Indicates the number of test cases, TF 1. TF 2. TF M They represent the first time the first defect, the second defect, and the M The position of the test case with the defect in the sequence, EFT is the effective execution time, ET i Indicates i The time required to execute a test case. Indicates the number of test cases executed when the maximum statement coverage is first reached; For optimization goals APFD , rearrange the matrix according to the maximum value of each row; for the optimization objective EFT , rearrange according to the maximum value in each column.
3. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 2 is characterized in that: The uniform distribution-based method is used to initialize the population of the two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objectives. In the process of obtaining the original use case sequence population, the following formula is satisfied: ; ; in, RTC Indicates the rearranged sequence numbers 1 to N A list of integers consisting of the use cases of , Indicates that the test cases are randomly arranged. TC Indicates sequence number 1 to N A list of integers consisting of the use cases of , Expressed as i The first j The test case number corresponding to the position, Indicates rounding operation. express RTC The i elements, Represents the operation of generating random numbers.
4. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 3 is characterized in that: In the process of using the pseudo-reverse learning strategy and the dynamic reverse learning strategy to obtain a dynamic use case sequence population that is reverse to the original use case sequence population, the following equation is satisfied: ; ; ; in, Indicates i The first j The test case sequence number corresponding to the reverse position obtained by the reverse learning strategy is Indicates i The first j The test case sequence number corresponding to the pseudo-reverse position obtained by the pseudo-reverse learning strategy is Indicates i The first j The test case sequence number corresponding to the dynamic pseudo-reverse position obtained by the dynamic pseudo-reverse learning strategy is and is a random number.
5. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 4 is characterized in that: After removing the control factors in the gray wolf optimization algorithm and the whale optimization algorithm, the following formula is obtained: ; ; in, Indicates t The position vector of the wolf or whale at the iteration, Indicates t +1 The position vector of the wolf or whale at iteration 1, Indicates t The position vector of the prey at the iteration, is the coefficient vector, is the convergence factor vector, is a random vector in the interval [0, 1]; and As the t The sequence individuals that are updated sequentially at the iteration are As the t The best order of use cases for the iteration As the t +1 Sequence individuals for sequential update at iteration 1.
6. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 5 is characterized in that: After implementing nonlinearization on the convergence factors of the gray wolf optimization algorithm and the whale optimization algorithm, the following formula is obtained: ; in, represents the convergence factor, and represent the initial and final values of the convergence factor, respectively. T represents the maximum number of iterations, is the nonlinear adjustment coefficient.
7. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 6 is characterized in that: Add a random factor judgment condition and a mixed random factor to merge the gray wolf optimization algorithm with the whale optimization algorithm. In the process of obtaining the gray wolf-whale hybrid algorithm, the following formula is satisfied: ; ; in, For the t +1 iteration of the whale optimization algorithm random factor, For the t The random factor of the whale optimization algorithm for the iteration, For the t +1 iteration of mixing random factor, For the t The mixing random factor for the iteration; When condition 1 is met, ; When condition 2 is met, ; When condition three is met, ; When condition 4 is met, ; Among them, condition one is: ,and ,and ,and ,and ; Condition 2 is: ,and ,and ,and ,and ; Condition three is: ,and ; Condition 4 is a condition in addition to Condition 1, Condition 2 and Condition 3; in, Represents the random factor of the whale optimization algorithm, represents the mixed random factor, Indicated in t The position of the individual whales randomly selected in the iteration, b represents the parameters that control the shape of the whale's spiral attack. l is a random number in the interval [-1, 1], , , Respectively indicate the selected wolf one, wolf two, and wolf three in the t The position vector at the iteration, represents the coefficient vector corresponding to wolf one, represents the coefficient vector corresponding to Wolf 2, represents the coefficient vector corresponding to wolf three.
8. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 1 is characterized in that: In the process of searching and evaluating the initial use case sequence population using the gray wolf-whale hybrid algorithm, an asexual repair mechanism is introduced to discretize the use case sequence. The specific process is as follows: Update the sequence population through the gray wolf-whale hybrid algorithm. For a single sequence individual, round the value of each position to an integer to obtain the current sequence. Use the parent sequence to check the boundary value and repeated value of the current sequence, and use irrelevant values to replace the case sequence numbers that exceed the parent sequence number boundary and are repeated in the current sequence to obtain a compliant sequence; Compare the compliance sequence with the parent sequence, and replace the case numbers in the parent sequence that are the same as the compliance sequence with irrelevant values to obtain a non-redundant parent sequence; According to the order of use cases in the non-redundant parent sequence, irrelevant values in the compliant sequence are filled to obtain the repaired child sequence, which is the optimal sequence for one iteration.
Citation Information
Patent Citations
Fuch mapping-based hybrid improved grey wolf optimization algorithm
CN110276437A
Active power distribution network optimization reconstruction method based on improved suburb wolf optimization algorithm
CN111463778A
Method and device for locating and sizing electric vehicle charging station based on improved hybrid algorithm
CN115438879A
MEC-based car networking task unloading and resource allocation method under information age constraint
CN116321299A
Grey wolf algorithm hybrid optimization method based on reverse learning strategy
CN116341605A