Test case prioritization method based on multi-strategy grey wolf whale algorithm

By constructing a two-dimensional sequence population search space with dual optimization goals and an improved gray wolf whale mixing algorithm, the problems of low population diversity and poor global search capabilities are solved, and the efficiency and effectiveness of test case prioritization are achieved.

CN119537255BActive Publication Date: 2025-08-12JIANGXI UNIVERSITY OF FINANCE AND ECONOMICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510109084.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-08-12
Estimated Expiration
2045-01-23

AI Technical Summary

Technical Problem

In the existing test case priority sorting methods, there is low population diversity and poor global search ability, which is prone to falling into local optimality, affecting the effectiveness and efficiency of sorting.

Method used

The test case priority sorting method based on the multi-strategy gray wolf whale algorithm is adopted. By constructing a two-dimensional sequence population search space with dual optimization targets, population initialization is carried out by combining uniform distribution, pseudo-reverse learning and dynamic reverse learning strategies, and the convergence factors of the gray wolf and whale optimization algorithm are nonlinearized, random factors and mixed random factors are fused to generate Pareto optimal sequence set.

Benefits of technology

Improve population diversity, enhance global search capabilities, avoid falling into local optimality, quickly and effectively determine test cases priorities, and improve the effectiveness and efficiency of sorting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537255B_ABST
    Figure CN119537255B_ABST
Patent Text Reader

Abstract

The present invention provides a test case priority sorting method based on a multi-strategy gray wolf whale algorithm. The present invention adopts a method based on uniform distribution to initialize the population of a two-dimensional sequence population search space arranged according to the maximum value of a dual optimization objective to obtain an original test case sequence population. At the same time, a pseudo-reverse learning strategy and a dynamic reverse learning strategy are adopted to obtain a dynamic test case sequence population that is reverse to the original test case sequence population, which can improve population diversity and thus obtain a high-quality initial test case sequence population. 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 fuse the two algorithms. 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.
Need to check novelty before this filing date? Find Prior Art

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 method for accelerating software testing. However, existing TCP methods often overlook the balance between effectiveness and efficiency. Currently, swarm intelligence algorithms such as the Grey Wolf Optimization Algorithm and the Whale Optimization Algorithm have been widely applied to TCP problems to improve the effectiveness of prioritization.

[0003] However, 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 prioritization method based on a multi-strategy gray wolf whale algorithm to solve the problems of low population diversity, poor global search capability, and easy falling into local optimality in the existing technology, thereby improving 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;

[0006] In the population initialization module, dual optimization objectives are first established, including 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 objectives. A uniform distribution-based method is used to initialize 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. 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 the initial use case sequence population.

[0007] 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.

[0008] According to the test case prioritization method based on the multi-strategy gray wolf whale algorithm of the embodiment of the present invention, a uniform distribution-based method 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. 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, thereby 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 local optimality, thereby quickly and effectively determining the priority of test cases. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The above and / or additional aspects and advantages of the embodiments of the present invention will become apparent and readily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0010] Figure 1 is a schematic structural diagram of a test case prioritization system according to an embodiment of the present invention;

[0011] Figure 2 1 is a flow chart of a method for prioritizing test cases based on a multi-strategy grey wolf whale algorithm according to an embodiment of the present invention;

[0012] Figure 3 This is an example diagram of discretizing the use case sequence based on the asexual repair mechanism. DETAILED DESCRIPTION

[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 making creative efforts shall fall within the scope of protection of the present invention.

[0014] 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 prioritization system includes a population initialization module and an optimization ,sorting module.

[0015] See also Figure 2 , the method includes steps S1 to S2:

[0016] Step S1, in the population initialization module, first establish a dual optimization objective, which includes the average defect detection percentage and the 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 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 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 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 with fitness values greater than the threshold in the original use case sequence population and the dynamic use case sequence population to obtain the initial use case sequence population.

[0017] Since the existing method of initializing the population using a reverse learning strategy, the generated reverse population has low randomness, and the generation process is static and lacks adaptability. In addition, under a symmetric scope, the reverse learning strategy may fail, which will weaken the diversity of the population and increase 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 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 sequence individuals with higher fitness values in the original use case sequence population and the dynamic use case sequence population, so as to obtain a high-quality initial use case sequence population.

[0018] Among them, the average defect detection percentage APFDand effective execution time EET , which aims to balance the effectiveness and efficiency of sorting, thereby improving the overall test performance.

[0019] Specifically, the expressions for the average defect detection percentage and effective execution time are:

[0020] ;

[0021] ;

[0022] 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 the i The time required to execute a test case, Indicates the number of test cases executed when the maximum statement coverage is first reached;

[0023] 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. At the same time, the convergence speed of the algorithm is accelerated, thereby better applying 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 Each test case sequence is considered 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.

[0024] After obtaining a two-dimensional sequence population search space arranged according to the maximum values of the dual optimization objectives, population initialization is required. To avoid the problem of the initial population generated by random methods being concentrated in a single area or dispersed in areas far from the optimal value, which causes the algorithm to fall into a local optimum, the present invention, on the one hand, uses a uniform distribution-based method 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. On the other hand, a method combining a dynamic reverse learning strategy with a pseudo-reverse learning strategy is proposed for population initialization to improve the diversity of the initial population.

[0025] Because the positions of individuals in the population can only take integer values, rounding is required during position initialization. Specifically, a uniform distribution-based method is used to initialize the population in 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:

[0026] ;

[0027] ;

[0028] 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.

[0029] The present invention is tested using several test cases below:

[0030] 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 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 , and then the first use case sequence individual can be generated 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.

[0031] Then, to increase the diversity of the initial population, a pseudo-reverse learning strategy is combined with a dynamic reverse learning strategy to optimize the original population, resulting in a dynamic test case sequence population that is the reverse of the original test case sequence population. The pseudo-reverse learning strategy addresses the failure of reverse learning under symmetric scopes, while the dynamic reverse learning strategy uses a dynamic reverse operator to adaptively learn reverse points in the search space. Combining these two methods transforms the search space into an asymmetric structure, enhancing the randomness of generating reverse individuals. This improvement enhances the exploration and development capabilities of the Gray Wolf Whale hybrid algorithm and speeds up its convergence, enabling it to more effectively find test case sequences with better overall performance.

[0032] 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:

[0033] ;

[0034] ;

[0035] ;

[0036] in, Indicates the i The first j The test case sequence number corresponding to the reverse position obtained by the reverse learning strategy is Indicates the i The first j The test case sequence number corresponding to the pseudo-reverse position obtained by the pseudo-reverse learning strategy is Indicates the 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.

[0037] The first use case sequence individual generated above OP 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].

[0038] 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 use 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, .

[0039] After obtaining the original use case sequence population and the dynamic 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 the initial use case sequence population.

[0040] Step S2: 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 fuse the gray wolf optimization algorithm and the whale optimization algorithm to obtain a 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 a Pareto optimal sequence set to determine the test case priority.

[0041] It is necessary to improve and blend the Gray Wolf Optimization Algorithm and the Whale Optimization Algorithm to more effectively search for optimal solutions within the initial population of use case sequences. This invention removes the control factors in the Gray Wolf Optimization Algorithm and the Whale Optimization Algorithm to better blend the Gray Wolf and Whale algorithms and ensure the basic performance of both algorithms. Furthermore, this invention implements nonlinearization on the convergence factors of both algorithms to balance local and global search and improve algorithm performance. Finally, the Gray Wolf and Whale hybrid algorithm is used to search and evaluate the initial population of use case sequences, generating a Pareto-optimal set of sequences.

[0042] To address 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 sequence 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:

[0043] ;

[0044] ;

[0045] in, Indicates the t The position vector of the wolf or whale at the iteration, Indicates the t +1 The position vector of the wolf or whale at iteration 1, Indicates the 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 first t The sequence individuals that are updated sequentially at the iteration As the first t The best order of use cases for the iteration As the first t +1 Sequence individuals used for sequential updates at iteration 1.

[0046] 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 local optimality 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:

[0047] ;

[0048] 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.

[0049] Compared with the original algorithm, at the beginning of the iteration, the convergence factor The changes will be slow at first and then fast. The case of >1 accounts for a large proportion of the iteration number, which enhances the global search ability of the algorithm and is conducive to finding the optimal sequence in the search space; in the later stage 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.

[0050] After improving the common control parameters of the Grey Wolf and Whale algorithms, it is also necessary to adjust the random factor of the Whale optimization algorithm. Adjust and optimize. In the whale optimization algorithm, It is an important parameter to guide 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 uses 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:

[0051] ;

[0052] ;

[0053] 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 iterations.

[0054] In addition, a judgment condition of the gray wolf optimization algorithm is added in the exploration phase to improve the whale search mechanism. Finally, the gray wolf-whale hybrid algorithm is obtained, which satisfies the following formula:

[0055] When condition 1 is met, ;

[0056] When condition 2 is met, ;

[0057] When condition three is met, ;

[0058] When condition four is met, ;

[0059] Among them, condition one is: ,and ,and ,and ,and ;

[0060] Condition 2 is: ,and ,and ,and ,and ;

[0061] Condition three is: ,and ;

[0062] Condition 4 is a condition in addition to Conditions 1, 2 and 3;

[0063] in, Represents the random factor of the whale optimization algorithm, represents the mixed random factor, Indicates in t The position of the whale individuals randomly selected in the iteration, b Represents the parameters that control the shape of the whale's spiral attack, lis a random number in the interval [-1,1], 、 、 Respectively represent the selected wolf one, wolf two, and wolf three in the first 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.

[0064] Compared with the original whale optimization algorithm, at the beginning of the 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 sequence). 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, The proportion of conditions >1 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). This slows down the convergence speed in the later stage, improves the local exploration ability of the algorithm in the later stage, and is conducive to further exploring better solutions around the current optimal solution.

[0065] In addition, during the search process, the gray wolf whale hybrid algorithm iteratively updates and evaluates the positions of individuals in the population, which actually adjusts the order of the test cases, thereby optimizing the execution order of the test cases. Because each test case 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, 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:

[0066] Step 1: Update the sequence population using 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.

[0067] Step 2: Use the parent sequence to check the boundary values and duplicate values of the current sequence, and replace the use case sequence numbers that exceed the parent sequence number boundary and are repeated with irrelevant values in the current sequence to obtain a compliant sequence;

[0068] Step 3: Compare the compliant sequence with the parent sequence, and replace the case numbers in the parent sequence that are identical to the compliant sequence with irrelevant values to obtain a non-redundant parent sequence.

[0069] 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 child sequence, which is the optimal sequence of one iteration.

[0070] 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, the boundary value and repeated value of the current sequence are checked. 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 combined to generate the repaired offspring sequence. X i ( t + 1) = [1, 4, 2, 3, 5].

[0071] 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.

[0072] According to the above-mentioned test case priority sorting method based on the multi-strategy gray wolf whale algorithm, a uniform distribution-based method 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. 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, thereby 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 new 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 local optimality, thereby quickly and effectively determining the priority of test cases.

[0073] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.

[0074] While 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 invention, and that the scope of the 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, dual optimization objectives are first established, including 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 objectives. A uniform distribution-based method is used to initialize 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. 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 the 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. A random factor judgment condition and a hybrid random factor are added to fuse the Gray Wolf Optimization Algorithm with 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. The expressions for the 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 the 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 of each column.

2. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 1 is characterized in that: Using a uniform distribution-based method, the two-dimensional sequence population search space arranged according to the maximum value of the dual optimization objectives is initialized to obtain the original use case sequence population, satisfying the following formula: ; ; 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.

3. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 2 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 formula is satisfied: ; ; ; in, Indicates the i The first j The test case sequence number corresponding to the reverse position obtained by the reverse learning strategy is Indicates the i The first j The test case sequence number corresponding to the pseudo-reverse position obtained by the pseudo-reverse learning strategy is Indicates the 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.

4. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 3 is characterized in that: After removing the control factors in the Grey Wolf Optimization Algorithm and the Whale Optimization Algorithm, the following formula is obtained: ; ; in, Indicates the t The position vector of the wolf or whale at the iteration, Indicates the t +1 The position vector of the wolf or whale at iteration 1, Indicates the 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 first t The sequence individuals that are updated sequentially at the iteration As the first t The best order of use cases for the iteration As the first t +1 Sequence individuals used for sequential updates at iteration 1.

5. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 4 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.

6. The test case prioritization method based on the multi-strategy gray wolf whale algorithm according to claim 5 is characterized in that: A new random factor judgment condition and a hybrid random factor are added to fuse the Grey Wolf Optimization Algorithm with the Whale Optimization Algorithm. In the process of obtaining the Grey 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 factors, For the t The random mixing factor for the iteration; When condition 1 is met, ; When condition 2 is met, ; When condition three is met, ; When condition four 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 Conditions 1, 2 and 3; in, Represents the random factor of the whale optimization algorithm, represents the mixed random factor, Indicates in t The position of the whale individuals 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 represent the selected wolf one, wolf two, and wolf three in the first 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.

7. 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 using 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 values and duplicate values of the current sequence, and use irrelevant values to replace the use case sequence numbers in the current sequence that exceed the parent sequence number boundary and are repeated 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, the irrelevant values in the compliant sequence are filled to obtain the repaired child sequence, which is the optimal sequence of one iteration.

Citation Information

Patent Citations

  • Whale DNA sequence optimization method based on harmony search (HS)

    AU2020103826A4

  • MEC-based car networking task unloading and resource allocation method under information age constraint

    CN116321299A