Regression test case determination method and device, storage medium and electronic equipment

By constructing the objective function and determining the execution order of the regression test case set using multi-objective genetic algorithm and graph theory algorithm, the problem of poor quality and efficiency of regression test case selection is solved, and more efficient and even test coverage is achieved.

CN120448265APending Publication Date: 2025-08-08中国邮政储蓄银行股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510533073.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the prior art, the selection quality and efficiency of regression test cases are poor, and the coverage deviation between use cases and requirements is strong, and the randomness is large, resulting in poor regression test results.

Method used

By obtaining information such as the associated nodes, node coverage, number of historical defects, execution difficulty and importance of the associated module of the initial use case, the objective function is constructed, and the multi-objective genetic algorithm and graph theory algorithm are used to determine the execution order of the regression test case set to ensure the highest execution efficiency and coverage uniformity.

Benefits of technology

An efficient set of regression test cases is generated, which can better cover all aspects of the system, improve testing efficiency and accuracy, and reduce the coverage deviation between use cases and requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448265A_ABST
    Figure CN120448265A_ABST
Patent Text Reader

Abstract

The invention provides a regression test case determination method and device, a storage medium and electronic equipment, and the method comprises the steps: obtaining regression test information of a plurality of initial cases, each regression test information at least comprises an associated node, a node coverage degree, a historical defect number, an execution difficulty degree, an execution sequence and an importance degree of an associated module of the corresponding initial use case; constructing a target function according to regression test information of the initial use case; taking the highest execution efficiency and the highest coverage uniformity as targets, adopting a multi-target genetic algorithm to solve the target function to obtain a regression test case set, and adopting a graph theory algorithm to determine the execution sequence of each target test case in the regression test case set. According to the method, firstly, various attributes of test cases are defined and quantified, regression test cases are selected and sorted based on the attributes, an efficient regression test case set is generated, it is ensured that the test cases can fully cover all aspects of a system, and potential problems are better found and solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of software development, and in particular to a method for determining a regression test case, an apparatus for determining a regression test case, a computer-readable storage medium, and an electronic device. Background Art

[0002] Regression testing is a crucial step in software maintenance. It involves retesting existing code after modifications to ensure that the changes haven't introduced new bugs or caused errors elsewhere in the code. As an integral part of the software lifecycle, regression testing accounts for a significant portion of the overall testing workload, with multiple regression tests performed at every stage of software development. In rapid iterative development, the continuous release of new versions necessitates even more frequent regression testing. Extreme programming methodologies even require regression testing several times daily.

[0003] Existing techniques rely on manual selection of regression test case sets, which is highly dependent on the tester's individual abilities and experience, resulting in poor quality and efficiency in case selection. Furthermore, existing techniques only consider the program's coverage by regression test cases, a relatively single factor. Furthermore, when considering scenarios where multiple test cases cover the same node, they randomly retain one case, resulting in a high degree of randomness and potentially preventing the generation of a superior solution. Summary of the Invention

[0004] The main purpose of this application is to provide a method for determining regression test cases, a device for determining regression test cases, a computer-readable storage medium and an electronic device, so as to at least solve the problems in the prior art of poor quality and efficiency of use case selection, and coverage deviation and high randomness between use cases and requirements.

[0005] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a method for determining regression test cases is provided, comprising: obtaining regression test information of multiple initial use cases, each regression test information at least including the associated nodes, node coverage, number of historical defects, execution difficulty, execution order and importance of associated modules of the corresponding initial use case; constructing an objective function based on the regression test information of the initial use case; solving the objective function using a multi-objective genetic algorithm with the highest execution efficiency and the highest coverage uniformity as the goals to obtain a regression test case set, and determining the execution order of each target test case in the regression test case set using a graph theory algorithm, wherein all the target test cases in the regression test case set are part of the initial use cases.

[0006] Optionally, constructing an objective function based on the regression test information of all the initial use cases includes: constructing a first objective function based on the regression test information of the initial use case Wherein, b is the first weight value, c is the second weight value, d is the third weight value, e is the fourth weight value, B is the node coverage, C is the number of historical defects, D is the importance of the associated module, E is the execution difficulty, and S is the execution efficiency; based on the regression test information of the initial use case, the second objective function is constructed. Wherein, U is the coverage uniformity, p i represents the probability of a node being covered, p avg represents the average coverage probability of all nodes if and only if all nodes are covered once.

[0007] Optionally, with the highest execution efficiency and the highest coverage uniformity as the goals, a multi-objective genetic algorithm is used to solve the objective function to obtain a regression test case set, including: a first processing step, with the highest execution efficiency and the highest coverage uniformity as the goals, a multi-objective genetic algorithm is used to solve the objective function to obtain multiple initial test case sets, and all the initial test case sets are used as initial parent populations; a second processing step, a fast non-dominated sorting is performed on the parent population, and the current generation offspring population is obtained through the three basic operations of selection, crossover, and mutation of the genetic algorithm; a third processing step, the parent population and the current generation offspring population are merged to obtain a merged population, and a fast non-dominated sorting is performed on the merged population, and the crowding degree of the individuals in each non-dominated layer is calculated. Multiple individuals are selected to form a new parent population based on the non-dominated relationship of each individual in the merged population and the crowding degree of the individual, and each individual is one initial test case set; the second processing step and the third processing step are repeated until the iteration ends, and the finally obtained parent population is determined as the regression test case set.

[0008] Optionally, a fast non-dominated sort is performed on the merged population, and a crowding degree calculation is performed on the individuals in each non-dominated layer, including: stratifying the merged population by a non-dominated sorting algorithm, and classifying each of the initial test case sets into each layer in descending order of fitness according to the fitness of each of the initial test case sets, wherein the fitness of the initial test case set is inversely proportional to the layer to which it is classified; obtaining a crowding degree calculation formula The congestion degree of each of the initial test case sets is calculated according to the congestion degree calculation formula, where n d is the congestion of the initial test case set d, f m (i+1) is the objective function of the initial test case set after the initial test case set d, f m (i-1) is the objective function of the previous initial test case set of the initial test case set d, is the maximum value of the objective function of all the initial test case sets, is the minimum value of the objective function of all the initial test case sets.

[0009] Optionally, multiple individuals are selected to form a new parent population based on the non-dominated relationship of each individual in the merged population and the crowding degree of the individuals, including: determining the Pareto level of each initial test case set based on the non-dominated sorting of each individual in the merged population; placing the entire layer of population of the merged population into the parent population in order of the Pareto level from low to high, until all individuals in a certain layer cannot be placed in the parent population, and placing the individuals in this layer into the parent population in order from high to low according to the crowding degree, until the parent population is filled, to obtain the new parent population.

[0010] Optionally, a graph theory algorithm is used to determine the execution order of each target test case in the regression test case set, including: obtaining a to-be-sorted case from the unsorted target test cases, and determining the shared data id and initial execution order of the to-be-sorted case; determining whether the to-be-sorted case and all the target test cases have the same shared resources based on the shared data id of the to-be-sorted case, wherein, if the to-be-sorted case and all the target test cases do not have the same shared resources, inserting the to-be-sorted case into the current execution order to obtain the final execution order of the to-be-sorted case; if the to-be-sorted case and all the target test cases have the same shared resources, determining the id and current execution order of the sorted case using the shared resources; if the to-be-sorted case and the sorted case have the same shared resources, extracting the initial execution order of the to-be-sorted case, and inserting the to-be-sorted case according to the initial execution order of the to-be-sorted case to obtain the current execution order of the to-be-sorted case, and obtaining the final execution order after all the to-be-sorted case are arranged.

[0011] Optionally, regression test information of multiple initial use cases is obtained, including: based on microservice link tracing and precise testing technology, recording the mapping relationship between the initial use case and the node during the execution of the initial use case to obtain the corresponding associated nodes; determining the ratio of the number of associated nodes corresponding to the initial use case to the number of summary points as the node coverage of the initial use case; determining the cumulative number of defects when the initial use case is executed at a historical moment as the number of historical defects of the initial use case; determining the difficulty of executing the initial use case based on the execution information of the initial use case, and the execution information of the initial use case at least includes the data required for the execution of the initial use case and the execution time.

[0012] According to another aspect of the present application, a device for determining regression test cases is provided, comprising: an acquisition unit for acquiring regression test information of multiple initial test cases, each of the regression test information comprising at least associated nodes, node coverage, number of historical defects, execution difficulty, execution order, and importance of associated modules of the corresponding initial test case; a construction unit for constructing an objective function based on the regression test information of the initial test case; a solution unit for solving the objective function using a multi-objective genetic algorithm with the highest execution efficiency and the highest coverage uniformity as the goals, to obtain a regression test case set, and determining the execution order of each target test case in the regression test case set using a graph theory algorithm, wherein all the target test cases in the regression test case set are part of the initial test case.

[0013] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is run, the device where the computer-readable storage medium is located is controlled to execute any one of the methods for determining regression test cases.

[0014] According to another aspect of the present application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include a determination method for executing any one of the regression test cases.

[0015] Applying the technical solution of the present application, the above-mentioned method for determining regression test cases first obtains the regression test information of multiple initial use cases, each regression test information at least including the associated nodes, node coverage, number of historical defects, execution difficulty, execution order and importance of associated modules of the corresponding initial use case; then, constructs the objective function based on the regression test information of the initial use case; finally, with the highest execution efficiency and the highest coverage uniformity as the goals, a multi-objective genetic algorithm is used to solve the objective function to obtain a regression test case set, and a graph theory algorithm is used to determine the execution order of each target test case in the regression test case set. The method first defines and quantifies various attributes of the test case, and based on this, selects and sorts regression test cases to generate an efficient set of regression test cases, ensuring that the test cases can fully cover all aspects of the system, better discover and solve potential problems, and solve the problems of poor quality and efficiency of use case selection in the existing technology, and coverage deviation and strong randomness between use cases and requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings that constitute part of this application are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an improper limitation on this application. In the drawings:

[0017] Figure 1 A hardware structure block diagram of a mobile terminal according to a method for determining a regression test case to be executed provided in an embodiment of the present application is shown;

[0018] Figure 2 A schematic diagram of a process for determining a regression test case according to an embodiment of the present application is shown;

[0019] Figure 3 A schematic diagram of a process for screening a regression test case set according to an embodiment of the present application is shown;

[0020] Figure 4 A schematic diagram of a process flow for regression testing provided in accordance with an embodiment of the present application is shown;

[0021] Figure 5 A structural block diagram of a device for determining a regression test case provided according to an embodiment of the present application is shown.

[0022] The above drawings include the following reference numerals:

[0023] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. DETAILED DESCRIPTION

[0024] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0025] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the 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 in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0027] For ease of description, some nouns or terms involved in the embodiments of the present application are explained below:

[0028] Regression testing: Regression testing refers to retesting the old code after modifying it to confirm that the modification has not introduced new errors or caused errors in other codes.

[0029] Multi-objective optimization algorithm: makes multiple objectives as optimal as possible in a given area at the same time. The solution of multi-objective optimization is usually a set of equilibrium solutions.

[0030] Non-dominated Sorting Genetic Algorithm with Elite Strategy (NSGA-II): A multi-objective intelligent optimization algorithm that proposes a fast non-dominated sorting algorithm, introduces an elitist strategy, and uses crowding and crowding comparison operators to uniformly expand individuals in the quasi-Pareto domain to the entire Pareto domain, ensuring knowledge diversity.

[0031] Regression efficiency score: A comprehensive score of various attributes of the test case itself.

[0032] Coverage uniformity: A concept used to describe distribution characteristics. This solution uses coverage uniformity to measure the degree to which the regression use case covers each node of the system under test.

[0033] Use case execution prerequisites: a general term for the necessary conditions, data, and resources before use case execution.

[0034] Precision testing: Analyze code, program execution, test cases, and the relationships between these types of information using specific algorithms, technical means, and tools, and use accurate data to evaluate test results and product quality.

[0035] Link tracing: This technology tracks the entire process of a specific request as it passes between various parts of the system. In a microservices architecture, a task may pass through several service components with different functions. Tracing technology can help programmers clearly see this process, identify potential problem areas, and record key information such as processing time, latency, performance, and dependencies between components.

[0036] As introduced in the background technology, in the existing technology, on the one hand, in practice, it still mainly relies on manual selection, which is highly dependent on the personal ability and testing experience of the testers, and the quality and efficiency of use case selection are poor. On the other hand, in the process of reducing regression use cases, the existing technology uses maximizing requirement coverage as the objective function, while the relationship between use cases and requirements is a coarse-grained relationship. Coverage is affected by the granularity of requirements and the granularity of use cases. Uneven granularity or different granularity of use cases and requirements will lead to coverage deviation. In the sorting process, the execution order between use cases is not considered, so the resulting sorting is not necessarily the most efficient. That is, the existing technology only considers the coverage of the program by regression use cases, and the factors considered are relatively simple. And when considering the scenario where multiple use cases cover the same node, one use case is randomly retained, which is highly random and may not result in a dominant solution.

[0037] In order to solve the problems in the prior art of poor quality and efficiency of use case selection, coverage deviation between use cases and requirements, and high randomness, the embodiments of the present application provide a method for determining regression test cases, a device for determining regression test cases, a computer-readable storage medium, and an electronic device.

[0038] The technical solutions in the embodiments of the present invention will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present invention.

[0039] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure diagram of a mobile terminal according to a method for determining a regression test case according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1More or fewer components than shown, or with Figure 1 Different configurations shown.

[0040] The memory 104 can be used to store computer programs, such as software programs and modules of application software, such as the computer program corresponding to the method for determining regression test cases in the embodiments of the present invention. The processor 102 executes the computer programs stored in the memory 104 to execute various functional applications and data processing, thereby implementing the above-mentioned method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. The transmission device 106 is used to receive or transmit data via a network. Specific examples of such networks may include a wireless network provided by the mobile terminal's telecommunications provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0041] In this embodiment, a method for determining regression test cases running on a mobile terminal, a computer terminal, or a similar computing device is provided. It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0042] Figure 2 Flowchart of the method for determining regression test cases according to an embodiment of the present application. Figure 2 As shown, the method includes the following steps:

[0043] Step S201: Obtain regression test information of multiple initial use cases, where each regression test information includes at least associated nodes, node coverage, number of historical defects, execution difficulty, execution order, and importance of associated modules of the corresponding initial use case;

[0044] Among them, the associated nodes of the above-mentioned initial use case are the nodes (services, classes, methods) associated with the initial use case, which are obtained based on microservice link tracking and precise testing technology, according to the mapping relationship between the use case and the node recorded during the use case execution process.

[0045] The node coverage of an initial use case is defined as the number of nodes associated with that use case divided by the total number of nodes. Assuming the total number of nodes in the software is N, the coverage formula is A / N. Coverage at the service, class, and method levels is also considered here. The node coverage B of the initial use case has a value range of B∈[0,1].

[0046] The number of historical defects associated with the initial use case is the cumulative number of defects discovered across all rounds of the use case, normalized by the total number of defects. All rounds constitute the execution history, and the number of defects discovered for each round is recorded. The value range of the number of historical defects associated with the initial use case, C, is: C∈[0,1].

[0047] The importance of the module associated with the initial use case can be set based on empirical values, which is the importance of the tested module associated with the use case. The value range of the importance D of the module associated with the initial use case is: D∈[0,1].

[0048] The execution difficulty of the initial use case can be qualitatively judged based on factors such as the data required for the use case execution and the time consumed. The execution difficulty E of the initial use case has a value range of: E∈[0,1].

[0049] The initial use case execution order is defined as follows: if the use cases are executed in a specific order during the use case execution process, they can often share a set of conditions and data. Use cases that cannot share conditions and data are assigned an order of 0. Use cases that can share conditions and data are assigned an order of 1, 2, 3, and so on, based on the order in which they test the conditions and data.

[0050] Obtaining regression test information for multiple initial use cases includes the following steps:

[0051] Step S211: Based on microservice link tracing and precision testing technology, the mapping relationship between the initial use case and the node is recorded during the execution of the initial use case to obtain the corresponding associated node;

[0052] Step S2012: determining the ratio of the number of the associated nodes corresponding to the initial use case to the number of summary points as the node coverage of the initial use case;

[0053] Step S2013, determining the cumulative number of defects when the initial use case is executed at a historical moment as the historical number of defects of the initial use case;

[0054] Step S2014: determining the execution difficulty of the initial use case based on the execution information of the initial use case. The execution information of the initial use case at least includes the data required for the execution of the initial use case and the execution time consumed.

[0055] Specifically, regression test cases are streamlined and prioritized based on microservice link tracing and precision testing technology. These technologies provide the relationship between test cases and nodes (services, classes, and methods) of the system under test, indicating the degree of coverage of the test cases across the system under test. This introduces the concept of coverage uniformity to avoid inefficient regression testing caused by over-concentration of filtered regression cases on certain nodes and insufficient coverage of others.

[0056] Step S202: constructing an objective function based on the regression test information of the initial use case;

[0057] Specifically, regression test cases are streamlined and prioritized based on microservice link tracing and precision testing technology. These technologies provide the relationship between test cases and nodes (services, classes, and methods) of the system under test, indicating the degree of coverage of the test cases. Furthermore, regression efficiency scoring and coverage uniformity are introduced, and an automatic regression case screening algorithm is proposed. This allows for the focus on core test scenarios, optimized resource utilization, improved testing efficiency, and cost-effectiveness of agile testing.

[0058] According to the regression test information of all the above initial use cases, the objective function is constructed, including the following steps:

[0059] Step S2021: construct the first objective function based on the regression test information of the initial use case Wherein, b is the first weight value, c is the second weight value, d is the third weight value, e is the fourth weight value, B is the node coverage, C is the number of historical defects, D is the importance of the associated module, E is the execution difficulty, and S is the execution efficiency.

[0060] The first objective function is derived based on the definition that regression efficiency is positively correlated with node coverage, the number of historical defects, and module importance, and negatively correlated with difficulty. b, c, and d can be adjusted based on historical data.

[0061] Step S2022: Construct a second objective function based on the regression test information of the initial use case. Where U is the above coverage uniformity, p i represents the probability of a node being covered, p avg represents the average coverage probability of all nodes if and only if all nodes are covered once.

[0062] Specifically, the concept of regression use case efficiency scoring is introduced, which comprehensively considers various attributes of the use case and supports flexible configuration of the weights of various parameters, thereby reducing the dimension and simplifying the multi-objective optimization problem of regression use case screening.

[0063] Where U∈[0,1], coverage uniformity can be calculated from "A - the nodes (services, classes, methods) associated with the use case", which takes into account the overall coverage and coverage uniformity of the regression use case for the system under test. Ideally, the regression use case coverage of the system under test nodes is 100%, and the coverage uniformity is 1.

[0064] Step S203, with the highest execution efficiency and the highest coverage uniformity as the goals, a multi-objective genetic algorithm is used to solve the above objective function to obtain a regression test case set, and a graph theory algorithm is used to determine the execution order of each target test case in the above regression test case set. All the above target test cases in the above regression test case set are part of the above initial test cases.

[0065] Specifically, the objective function aims to maximize regression efficiency and coverage uniformity. A multi-objective genetic algorithm is used to generate a set of regression cases that meet these objectives. Since multiple solutions are possible for multi-objective optimization, the following steps are used to select a solution that meets the objectives as the regression case set.

[0066] Among them, with the highest execution efficiency and the highest coverage uniformity as the goal, a multi-objective genetic algorithm is used to solve the above objective function to obtain a regression test case set, including the following steps:

[0067] In the first processing step, a multi-objective genetic algorithm is used to solve the objective function with the goal of achieving the highest execution efficiency and the highest coverage uniformity, thereby obtaining multiple initial test case sets, and all of the initial test case sets are used as the initial parent population;

[0068] The second processing step is to perform a fast non-dominated sort on the parent population and obtain the current generation offspring population through the three basic operations of genetic algorithm: selection, crossover, and mutation;

[0069] In the third processing step, the parent population is merged with the current generation child population to obtain a merged population, and a fast non-dominated sort is performed on the merged population. At the same time, the crowding degree of the individuals in each non-dominated layer is calculated. Based on the non-dominated relationship of each individual in the merged population and the crowding degree of the individual, multiple individuals are selected to form a new parent population, and each individual constitutes one of the initial test case sets.

[0070] Repeat the second processing step and the third processing step until the iteration ends, and determine the parent population finally obtained as the regression test case set.

[0071] Specifically, compared to existing solutions, the regression efficiency scoring concept proposed in this solution reduces the dimensionality and simplifies the multi-objective optimization problem of selecting regression use cases. This solution is more comprehensive and flexible, adapting to differences in various parameters within and between use cases.

[0072] In some embodiments, the regression use case set is coded as shown in Table 1. Assuming that the full use case set has n use cases, according to binary coding, the number of possible regression use case sets for n use cases is 2 n ,The encoding examples are shown in Table 1.

[0073] Table 1

[0074] Use Case Number 1 2 3 ... n Use Case Set 1 0 1 0 ... 1 ... ... ... ... ... ... Use Case Set m 1 1 0 ... 0

[0075] The relationship between the professional terms in the algorithm and the problem to be solved by the present invention is as follows:

[0076] Gene: A flag indicating whether a use case is selected as a regression use case. If a use case is selected as a regression use case, it is coded as 1, otherwise it is coded as 0.

[0077] Individual: composed of genes, each individual corresponds to a set of regression use cases.

[0078] Population: It is composed of individuals and is divided into parent population and child population according to the order of iteration, that is, the collection of regression use case sets.

[0079] like Figure 3 As shown, the overall steps of the algorithm are as follows:

[0080] S301: Initialize the regression use case set, starting from 2 n From the set of possible regression use cases, M are randomly selected as the initial population of the algorithm with a size of M;

[0081] S302: Calculate the regression efficiency and uniformity for each regression case set, perform the first fast non-dominated sort on the case set, and obtain the parent population;

[0082] S303: Obtain the first generation of offspring population through the three basic operations of selection, crossover, and mutation of the genetic algorithm, that is, use the selection, crossover, and compilation operators to generate a new generation of subpopulations.

[0083] S304: merging the parent population and the offspring population;

[0084] S305: Calculate the regression efficiency and uniformity for each regression use case set, and perform fast non-dominated sorting on the use case sets based on the regression efficiency and uniformity;

[0085] S306: Calculate the crowding degree of each individual in the non-dominated layer, that is, calculate the crowding degree of the regression case set;

[0086] S307: Select appropriate individuals to form a new parent population based on the non-dominance relationship and the crowding degree of the individuals;

[0087] S308: Determine whether the iteration has ended. If so, output the regression case set. If not, repeat S303, S304, S305, S306, and S307. The parent population of the first cycle (iteration) is the initial population. The n intermediate cycles combine the parent population generated last time with the child population generated this time to generate a new parent population. The final cycle outputs the new parent population that meets the requirements.

[0088] Repeat the above steps S302, S303, S304, S305, S306, and S307 to generate a new offspring population through the basic operations of the genetic algorithm. This process is deduced in this way until the program termination condition is met. The program termination condition is to maximize the regression efficiency and coverage uniformity.

[0089] The fast non-dominated sorting is performed on the merged population, and the crowding degree of the individuals in each non-dominated layer is calculated, including the following steps:

[0090] Step S3051: stratify the merged population using a non-dominated sorting algorithm, and classify the initial test case sets into layers in descending order of fitness (regression efficiency and uniformity), wherein the fitness of the initial test case sets is inversely proportional to the layer to which they are assigned.

[0091] Step S3061: Obtain the congestion calculation formula The congestion degree of each of the above initial test case sets is calculated according to the above congestion degree calculation formula, where n d is the congestion of the initial test case set d, f m (i+1) is the objective function of the initial test case set after the initial test case set d, f m (i-1) is the objective function of the previous initial test case set d above, is the maximum value of the objective function of all the above initial test case sets, is the minimum value of the objective function of all the above initial test case sets.

[0092] Specifically, compared with existing solutions, this solution considers the uniformity of coverage in the regression use case screening stage and the order between use cases in the sorting stage, ensuring that the screening results are more efficient and the execution efficiency is better.

[0093] In some embodiments, a non-dominated sorting algorithm is used to stratify a population of size n. After stratification, the regression case set is classified into F1, F2, ... according to the fitness (number of dominated solutions, i.e., the number of other solutions that dominate the current solution) from high to low. The lower layers have high fitness, and F1 is the current optimal one. The specific process is as follows:

[0094] Step S30511: p is any regression case set, calculate the number n of regression case sets that dominate p p and the set S of regression cases dominated by p p ;

[0095] Step S30512: n p = 0 is put into the set F1;

[0096] Step S30513, traverse F1, take one regression case set i, parameter n i =0, S i The processing is as follows: traverse S i : Take one of the regression case sets l, calculate the parameters n1 and S1 / n1-1, if it is 0, then include it in the next level F2;

[0097] Step S30514: traverse F2 and use the same method as step 3 to obtain the regression use case set of the third level, and so on.

[0098] In some embodiments, after stratifying a population of size n using a non-dominated sorting algorithm, a crowding calculation is performed. In order to make the distribution of solutions in the target space more uniform, crowding is introduced. In order to obtain an estimate of the crowding of solutions around a specific solution in the population, we calculate the average distance between the two points on both sides of this point based on each objective function. First, the crowding of each regression test case set is determined, and then the objective function of each regression test case set is traversed, and the maximum and minimum values of the objective functions of all regression test case sets are calculated. The objective function of the regression test case set d before and after the non-dominated sort is calculated, where n d is the congestion of regression case set d, f m (i+1) is the objective function of the regression case set after the regression case set d, f m (i-1) is the objective function of the regression case set before the regression case set d, is the maximum value of the objective function of all regression case sets, The minimum value of the objective function for all regression case sets

[0099] The process of selecting multiple individuals to form a new parent population based on the non-dominance relationship of the individuals in the merged population and the crowding degree of the individuals comprises the following steps:

[0100] Step S3071, determining the Pareto rank of each of the initial test case sets according to the non-dominated sorting of each of the individuals in the merged population;

[0101] Step S3072: Place the entire layer of the merged population into the parent population according to the order of the Pareto level from low to high, until all individuals in a certain layer cannot be placed in the parent population. Place the individuals in that layer into the parent population in descending order of crowding until the parent population is full, thereby obtaining the new parent population.

[0102] Specifically, regression cases are sorted based on their execution priors. The order of cases is independent of their own quantitative attributes and changes with the regression case group. Sorting regression cases based on their execution priors can further improve execution efficiency while maintaining the same coverage, while also increasing the reuse of test data and test resources.

[0103] In some embodiments, the parent population C is first i With the offspring population D i Synthetic population R i , the method of generating the parent population is: according to the Pareto level obtained by non-dominated sorting, R i The entire layer population is placed into the parent population C i+1 Until all individuals in a certain layer cannot be put into the parent population C i+1 Specifically, the individuals in this layer are placed in C in descending order of crowding degree. i+1 In, until C i+1 Fill. This step ensures that the parent generation retains a set of regression test cases with a low non-dominated ordering level and high congestion. Next, the offspring generation is generated through crossover, mutation, and selection. Crossover uses uniform crossover, selecting 50% of the genes for crossover, ensuring that each parent generation has the same impact on the offspring.

[0104] The parent individuals are shown in Table 2:

[0105] Table 2

[0106] Use Case Number 1 2 3 4 5 6 7 8 Use Case Set i 0 1 0 1 1 0 0 0 Use Case Set 1 1 0 0 0 0 0 1

[0107] The offspring individuals after crossover are shown in Table 3 (odd-numbered individuals are exchanged):

[0108] Table 3

[0109] Use Case Number 1 2 3 4 5 6 7 8 Use Case Set i' 1 1 0 1 0 0 0 0 Use case set j' 0 1 0 0 1 0 0 1

[0110] The mutation uses a bit flip mutation, randomly selecting a gene and flipping its value (complementing):

[0111] The offspring individuals after crossover and mutation are shown in Table 4:

[0112] Table 4

[0113] Use Case Number 1 2 3 4 5 6 7 8 Use Case Set i' 1 1 0 1 0 0 0 1 Use case set j' 0 1 0 0 1 0 0 0

[0114] The selection is done using a tournament selection method where two individuals are randomly selected from the population and the one with the highest fitness score wins and is selected.

[0115] Among them, Figure 4 As shown in FIG, a graph theory algorithm is used to determine the execution order of each target test case in the above regression test case set, including the following steps:

[0116] Step S401: obtaining a to-be-sorted test case from the unsorted target test cases, and determining the shared data ID and initial execution order of the to-be-sorted test case;

[0117] Step S402: Determine, based on the shared data ID of the test case to be sorted, whether the test case to be sorted and all the target test cases have the same shared resources. If the test case to be sorted and all the target test cases do not have the same shared resources, insert the test case to be sorted into the current execution order to obtain the final execution order of the test case to be sorted.

[0118] Step S403: If the to-be-sorted test case and all the target test cases have the same shared resource, determine the IDs and current execution order of the sorted test cases using the shared resource;

[0119] Step S404, when the same shared resources exist in the above-mentioned use cases to be sorted and the sorted use cases, the initial execution order of the above-mentioned use cases to be sorted is extracted, and the above-mentioned use cases to be sorted are inserted according to the initial execution order of the above-mentioned use cases to be sorted, to obtain the current execution order of the above-mentioned use cases to be sorted, and after all the above-mentioned use cases to be sorted are arranged, the final execution order is obtained.

[0120] Specifically, compared with existing solutions, this solution sorts regression use cases based on the prior conditions of use case execution, with the aim of improving the reuse of test data and test resources and improving execution efficiency.

[0121] In some instances, graph theory algorithms are used to determine the optimal execution order. Regression cases may or may not have an execution order relationship, meaning they may share or have exclusive prior conditions. The data structure is defined as follows: each use case contains two pieces of information: [shared data id, execution order], which are used to arrange the execution order of the use case set. This is shown in Table 5:

[0122] Table 5

[0123] Use Case Number 1 2 ... k Shared data id 1 - ... 100 Execution order 10 - ... 2

[0124] The above-mentioned method for determining regression test cases of the present application first obtains regression test information of multiple initial use cases, and each regression test information includes at least the associated nodes, node coverage, number of historical defects, execution difficulty, execution order and importance of associated modules of the corresponding initial use case; then, constructs an objective function based on the regression test information of the initial use case; finally, with the highest execution efficiency and the highest coverage uniformity as the goals, a multi-objective genetic algorithm is used to solve the objective function to obtain a regression test case set, and a graph theory algorithm is used to determine the execution order of each target test case in the regression test case set. The method first defines and quantifies various attributes of the test case, and based on this, selects and sorts regression test cases to generate an efficient set of regression test cases, ensuring that the test cases can fully cover all aspects of the system, better discover and solve potential problems, and solve the problems of poor quality and efficiency of use case selection in the existing technology, and coverage deviation and strong randomness between use cases and requirements.

[0125] The above-mentioned method for automatic screening and sorting of regression test cases. In the regression test case screening method, the relationship between the test case and the nodes of the system under test (service, class, method) is obtained based on microservice link tracing or precise testing technology. On this basis, regression efficiency score and coverage uniformity are introduced. Combined with factors such as the number of historical defects associated with the use case, the importance of the module associated with the use case, the difficulty of the use case, and the execution time of the use case, a multi-objective dynamic programming algorithm is used to screen out regression use cases. In the use case sorting method, the order parameter between use cases is introduced to further optimize the use case execution rate under the given regression use case quality and efficiency.

[0126] The embodiments of the present application also provide a device for determining regression test cases. It should be noted that the device for determining regression test cases in the embodiments of the present application can be used to execute the method for determining regression test cases provided in the embodiments of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation methods, and the details that have been described will not be repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0127] The following introduces the device for determining regression test cases provided in an embodiment of the present application.

[0128] Figure 5 Schematic diagram of a device for determining a regression test case according to an embodiment of the present application. Figure 5As shown, the device includes an acquisition unit 10, a construction unit 20 and a solution unit 30, the acquisition unit 10 is used to obtain regression test information of multiple initial use cases, each of the above regression test information at least includes the associated nodes, node coverage, number of historical defects, execution difficulty, execution order and importance of associated modules of the corresponding initial use case; the construction unit 20 is used to construct an objective function according to the regression test information of the above initial use case; the solution unit 30 is used to solve the above objective function with the highest execution efficiency and the highest coverage uniformity as the goals, and obtain a regression test case set by using a multi-objective genetic algorithm, and determine the execution order of each target test case in the above regression test case set by using a graph theory algorithm, and all the above target test cases in the above regression test case set are part of the above initial use cases.

[0129] The above-mentioned regression test case determination device of the present application includes an acquisition unit, a construction unit and a solution unit. The acquisition unit is used to obtain the regression test information of multiple initial test cases, and each regression test information at least includes the associated nodes, node coverage, number of historical defects, execution difficulty, execution order and importance of associated modules of the corresponding initial test case; the construction unit is used to construct an objective function according to the regression test information of the initial test case; the solution unit is used to solve the objective function with the highest execution efficiency and the highest coverage uniformity as the goal, obtain a regression test case set, and use a graph theory algorithm to determine the execution order of each target test case in the regression test case set. The device first defines and quantifies various attributes of the test case, and based on this, selects and sorts regression test cases to generate a set of efficient regression test case sets, ensuring that the test cases can fully cover all aspects of the system, better discover and solve potential problems, and solve the problems of poor quality and efficiency of case selection in the existing technology, and coverage deviation and strong randomness between the use cases and requirements.

[0130] In some instances, the construction unit includes a first construction module and a second construction module, wherein the first construction module is used to construct a first objective function according to the regression test information of the initial use case. Among them, b is the first weight value, c is the second weight value, d is the third weight value, e is the fourth weight value, B is the node coverage, C is the number of historical defects, D is the importance of the associated module, E is the execution difficulty, and S is the execution efficiency. The second construction module is used to construct the second objective function based on the regression test information of the initial use case. Where U is the above coverage uniformity, p i represents the probability of a node being covered, p avg represents the average coverage probability of all nodes if and only if all nodes are covered once.

[0131] In some instances, the solution unit includes: a first processing module, which is used to solve the above-mentioned objective function using a multi-objective genetic algorithm with the highest execution efficiency and the highest coverage uniformity as the goals, obtain multiple initial test case sets, and use all of the above-mentioned initial test case sets as the initial parent population; a second processing module, which is used to perform fast non-dominated sorting on the parent population, and obtain the current generation offspring population through the three basic operations of selection, crossover, and mutation of the genetic algorithm; a third processing module, which is used to merge the parent population with the above-mentioned current generation offspring population to obtain a merged population, and perform fast non-dominated sorting on the above-mentioned merged population, and at the same time calculate the crowding degree of individuals in each non-dominated layer, and select multiple individuals to form a new parent population based on the non-dominated relationship of each of the above-mentioned individuals in the above-mentioned merged population and the crowding degree of the individuals, and each above-mentioned individual is one of the above-mentioned initial test case sets; an execution module, which is used to repeatedly execute the above-mentioned second processing step and the above-mentioned third processing step until the iteration is completed, and determine the above-mentioned parent population finally obtained as the above-mentioned regression test case set.

[0132] In some examples, the third processing module includes a stratification module and a first acquisition module, the stratification module is used to stratify the above-mentioned merged population by a non-dominated sorting algorithm, and according to the fitness of each of the above-mentioned initial test case sets, the initial test case sets are sequentially classified into different levels in descending order of fitness, wherein the fitness of the initial test case sets is inversely proportional to the level to which they are classified; the first acquisition module is used to obtain the congestion calculation formula The congestion degree of each of the above initial test case sets is calculated according to the above congestion degree calculation formula, where n d is the congestion of the initial test case set d, f m (i+1) is the objective function of the initial test case set after the initial test case set d, f m (i-1) is the objective function of the previous initial test case set d above, is the maximum value of the objective function of all the above initial test case sets, is the minimum value of the objective function of all the above initial test case sets.

[0133] In some instances, the third processing module includes a first determination module and a second determination module, the first determination module being used to determine the Pareto rank of each of the above-mentioned initial test case sets based on the non-dominated sorting of each of the above-mentioned individuals in the above-mentioned merged population; the second determination module being used to place the entire layer of population of the above-mentioned merged population into the above-mentioned parent population in order from low to high according to the above-mentioned Pareto rank, until all individuals of a certain layer cannot be placed in the above-mentioned parent population, and then placing the individuals of the layer into the above-mentioned parent population in order from high to low according to the crowding degree, until the above-mentioned parent population is filled, thereby obtaining the above-mentioned new parent population.

[0134] In some instances, the solution unit includes a second acquisition module, a third determination module, a fourth determination module and an extraction module, the second acquisition module is used to obtain a to-be-sorted case from the unsorted target test cases, and determine the shared data ID and initial execution order of the to-be-sorted case; the third determination module is used to determine whether the to-be-sorted case and all the target test cases have the same shared resources based on the shared data ID of the to-be-sorted case, wherein, in the case that the to-be-sorted case and all the target test cases do not have the same shared resources, the to-be-sorted case is inserted into the current execution order to obtain the final execution order of the to-be-sorted case; the fourth determination module is used to determine whether the to-be-sorted case and all the target test cases have the same shared resources based on the shared data ID of the to-be-sorted case. The module is used to determine whether the above-mentioned use cases to be sorted have the same shared resources as the sorted use cases when the above-mentioned use cases to be sorted have the same shared resources as all the above-mentioned target test cases, wherein, when the above-mentioned use cases to be sorted do not have the same shared resources as the sorted use cases, the above-mentioned use cases to be sorted are inserted into the current execution order to obtain the final execution order of the above-mentioned use cases to be sorted; the extraction module is used to extract the initial execution order of the above-mentioned use cases to be sorted when the above-mentioned use cases to be sorted have the same shared resources as the sorted use cases, and insert the above-mentioned use cases to be sorted according to the initial execution order of the above-mentioned use cases to be sorted to obtain the final execution order of the above-mentioned use cases to be sorted.

[0135] In some instances, the acquisition unit includes a fifth processing module, a fifth determination module, a sixth determination module and a seventh determination module. The fifth processing module is used to record the mapping relationship between the above-mentioned initial use case and the node during the execution of the above-mentioned initial use case based on microservice link tracking and precise testing technology, and obtain the corresponding above-mentioned associated nodes; the fifth determination module is used to determine the ratio of the number of the above-mentioned associated nodes corresponding to the above-mentioned initial use case to the number of summary points as the above-mentioned node coverage of the above-mentioned initial use case; the sixth determination module is used to determine the cumulative number of defects when the above-mentioned initial use case is executed at a historical moment as the historical number of defects of the above-mentioned initial use case; the seventh determination module is used to determine the difficulty of executing the above-mentioned initial use case based on the execution information of the above-mentioned initial use case, and the execution information of the above-mentioned initial use case at least includes the data required for the execution of the above-mentioned initial use case and the execution time.

[0136] The aforementioned regression test case determination apparatus includes a processor and a memory. The aforementioned acquisition unit and the like are stored as program units in the memory, and the processor executes the program units stored in the memory to implement the corresponding functions. The aforementioned modules are all located in the same processor; alternatively, the aforementioned modules may be located in different processors in any combination.

[0137] The processor contains a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and kernel parameters can be adjusted to address existing issues such as poor quality and efficiency of use case selection, discrepancies between use case and requirements, and high randomness.

[0138] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0139] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program. When the program is run, the device where the computer-readable storage medium is located is controlled to execute the method for determining the regression test case.

[0140] Specifically, the method for determining regression test cases includes:

[0141] Step S201: Obtain regression test information of multiple initial use cases, where each regression test information includes at least associated nodes, node coverage, number of historical defects, execution difficulty, execution order, and importance of associated modules of the corresponding initial use case;

[0142] Among them, the associated nodes of the above-mentioned initial use case are the nodes (services, classes, methods) associated with the initial use case, which are obtained based on microservice link tracking and precise testing technology, according to the mapping relationship between the use case and the node recorded during the use case execution process.

[0143] Step S202: constructing an objective function based on the regression test information of the initial use case;

[0144] Specifically, regression test cases are streamlined and prioritized based on microservice link tracing and precision testing technology. These technologies provide the relationship between test cases and nodes (services, classes, and methods) of the system under test, indicating the degree of coverage of the test cases. Furthermore, regression efficiency scoring and coverage uniformity are introduced, and an automatic regression case screening algorithm is proposed. This allows for the focus on core test scenarios, optimized resource utilization, improved testing efficiency, and cost-effectiveness of agile testing.

[0145] Step S203, with the highest execution efficiency and the highest coverage uniformity as the goals, a multi-objective genetic algorithm is used to solve the above objective function to obtain a regression test case set, and a graph theory algorithm is used to determine the execution order of each target test case in the above regression test case set. All the above target test cases in the above regression test case set are part of the above initial test cases.

[0146] Specifically, the objective function aims to maximize regression efficiency and coverage uniformity. A multi-objective genetic algorithm is used to generate a set of regression cases that meet these objectives. Since multiple solutions are possible for multi-objective optimization, the following steps are used to select a solution that meets the objectives as the regression case set.

[0147] An embodiment of the present invention provides a processor, which is used to run a program, wherein the method for determining the regression test case is executed when the program is running.

[0148] Specifically, the method for determining regression test cases includes:

[0149] Step S201: Obtain regression test information of multiple initial use cases, where each regression test information includes at least associated nodes, node coverage, number of historical defects, execution difficulty, execution order, and importance of associated modules of the corresponding initial use case;

[0150] Among them, the associated nodes of the above-mentioned initial use case are the nodes (services, classes, methods) associated with the initial use case, which are obtained based on microservice link tracking and precise testing technology, according to the mapping relationship between the use case and the node recorded during the use case execution process.

[0151] Step S202: constructing an objective function based on the regression test information of the initial use case;

[0152] Specifically, regression test cases are streamlined and prioritized based on microservice link tracing and precision testing technology. These technologies provide the relationship between test cases and nodes (services, classes, and methods) of the system under test, indicating the degree of coverage of the test cases. Furthermore, regression efficiency scoring and coverage uniformity are introduced, and an automatic regression case screening algorithm is proposed. This allows for the focus on core test scenarios, optimized resource utilization, improved testing efficiency, and cost-effectiveness of agile testing.

[0153] Step S203, with the highest execution efficiency and the highest coverage uniformity as the goals, a multi-objective genetic algorithm is used to solve the above objective function to obtain a regression test case set, and a graph theory algorithm is used to determine the execution order of each target test case in the above regression test case set. All the above target test cases in the above regression test case set are part of the above initial test cases.

[0154] Specifically, the objective function aims to maximize regression efficiency and coverage uniformity. A multi-objective genetic algorithm is used to generate a set of regression cases that meet these objectives. Since multiple solutions are possible for multi-objective optimization, the following steps are used to select a solution that meets the objectives as the regression case set.

[0155] An embodiment of the present invention provides a device, comprising a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, at least the following steps are performed:

[0156] Step S201: Obtain regression test information of multiple initial use cases, where each regression test information includes at least associated nodes, node coverage, number of historical defects, execution difficulty, execution order, and importance of associated modules of the corresponding initial use case;

[0157] Step S202: constructing an objective function based on the regression test information of the initial use case;

[0158] Step S203, with the highest execution efficiency and the highest coverage uniformity as the goals, a multi-objective genetic algorithm is used to solve the above objective function to obtain a regression test case set, and a graph theory algorithm is used to determine the execution order of each target test case in the above regression test case set. All the above target test cases in the above regression test case set are part of the above initial test cases.

[0159] The devices in this article can be servers, PCs, PADs, mobile phones, etc.

[0160] The present application also provides a computer program product, which, when executed on a data processing device, is adapted to execute a program for initializing at least the following method steps:

[0161] Step S201: Obtain regression test information of multiple initial use cases, where each regression test information includes at least associated nodes, node coverage, number of historical defects, execution difficulty, execution order, and importance of associated modules of the corresponding initial use case;

[0162] Step S202: constructing an objective function based on the regression test information of the initial use case;

[0163] Step S203, with the highest execution efficiency and the highest coverage uniformity as the goals, a multi-objective genetic algorithm is used to solve the above objective function to obtain a regression test case set, and a graph theory algorithm is used to determine the execution order of each target test case in the above regression test case set. All the above target test cases in the above regression test case set are part of the above initial test cases.

[0164] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, can be centralized on a single computing device, or can be distributed across a network of multiple computing devices. They can be implemented using program code executable by the computing device, and thus, can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described herein can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0165] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0166] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0167] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0168] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.

[0169] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0170] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0171] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0172] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0173] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:

[0174] 1) The method for determining the above-mentioned regression test cases of the present application first obtains the regression test information of multiple initial use cases, each regression test information at least includes the associated nodes, node coverage, number of historical defects, execution difficulty, execution order and importance of associated modules of the corresponding initial use case; then, constructs the objective function based on the regression test information of the initial use case; finally, with the highest execution efficiency and the highest coverage uniformity as the goals, a multi-objective genetic algorithm is used to solve the objective function to obtain a regression test case set, and a graph theory algorithm is used to determine the execution order of each target test case in the regression test case set. This method first defines and quantifies various attributes of the test case, and based on this, selects and sorts regression test cases to generate an efficient set of regression test cases, ensuring that the test cases can fully cover all aspects of the system, better discover and solve potential problems, and solve the problems of poor quality and efficiency of use case selection in the existing technology, and coverage deviation and strong randomness between use cases and requirements.

[0175] 2) The device for determining the above-mentioned regression test cases of the present application includes an acquisition unit, a construction unit and a solution unit. The acquisition unit is used to obtain the regression test information of multiple initial test cases, and each regression test information includes at least the associated nodes, node coverage, number of historical defects, execution difficulty, execution order and importance of associated modules of the corresponding initial test case; the construction unit is used to construct an objective function according to the regression test information of the initial test case; the solution unit is used to solve the objective function with the highest execution efficiency and the highest coverage uniformity as the goal, and obtain a regression test case set by using a multi-objective genetic algorithm, and determine the execution order of each target test case in the regression test case set by using a graph theory algorithm. The device first defines and quantifies various attributes of the test case, and based on this, selects and sorts regression test cases to generate a set of efficient regression test case sets, ensuring that the test cases can fully cover all aspects of the system, better discover and solve potential problems, and solve the problems of poor quality and efficiency of case selection in the existing technology, and coverage deviation and strong randomness between the use cases and requirements.

[0176] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.

Claims

1. A method for determining regression test cases, characterized in that: include: Obtain regression test information for a plurality of initial use cases, wherein each regression test information includes at least associated nodes, node coverage, number of historical defects, execution difficulty, execution order, and importance of associated modules of the corresponding initial use case; Constructing an objective function based on the regression test information of the initial use case; With the highest execution efficiency and the highest coverage uniformity as the goals, a multi-objective genetic algorithm is used to solve the objective function to obtain a regression test case set, and a graph theory algorithm is used to determine the execution order of each target test case in the regression test case set. All the target test cases in the regression test case set are part of the initial test cases.

2. The method according to claim 1, characterized in that Based on the regression test information of all the initial use cases, construct the objective function, including: According to the regression test information of the initial use case, the first objective function is constructed Wherein, b is the first weight value, c is the second weight value, d is the third weight value, e is the fourth weight value, B is the node coverage, C is the number of historical defects, D is the importance of the associated module, E is the execution difficulty, and S is the execution efficiency; According to the regression test information of the initial use case, the second objective function is constructed Wherein, U is the coverage uniformity, p i represents the probability of a node being covered, p avg represents the average coverage probability of all nodes if and only if all nodes are covered once.

3. The method according to claim 1, characterized in that With the highest execution efficiency and the highest coverage uniformity as the goal, a multi-objective genetic algorithm is used to solve the objective function to obtain a regression test case set, including: In a first processing step, a multi-objective genetic algorithm is used to solve the objective function with the goal of achieving the highest execution efficiency and the highest coverage uniformity, thereby obtaining a plurality of initial test case sets, and all of the initial test case sets are used as the initial parent population; The second processing step is to perform a fast non-dominated sort on the parent population and obtain the current generation offspring population through the three basic operations of genetic algorithm: selection, crossover, and mutation; The third processing step is to merge the parent population with the current generation population to obtain a merged population. and performing a fast non-dominated sort on the merged population, and calculating the crowding degree of the individuals in each non-dominated layer, and selecting multiple individuals to form a new parent population based on the non-dominated relationship of each individual in the merged population and the crowding degree of the individual, where each individual constitutes one of the initial test case sets; The second processing step and the third processing step are repeatedly performed until the iteration ends, and the finally obtained parent population is determined as the regression test case set.

4. The method according to claim 3, characterized in that Perform a fast non-dominated sort on the merged population and calculate the crowding degree of the individuals in each non-dominated layer, including: stratifying the merged population using a non-dominated sorting algorithm, and classifying the initial test case sets into layers in descending order of fitness according to the fitness of the initial test case sets, wherein the fitness of the initial test case sets is inversely proportional to the layer to which they are classified; Get the congestion calculation formula The congestion degree of each of the initial test case sets is calculated according to the congestion degree calculation formula, where n d is the congestion of the initial test case set d, f m (i+1) is the objective function of the next initial test case set of the initial test case set d, f m (i-1) is the objective function of the previous initial test case set of the initial test case set d, is the maximum value of the objective function of all the initial test case sets, is the minimum value of the objective function of all the initial test case sets.

5. The method according to claim 3, characterized in that Selecting multiple individuals to form a new parent population according to the non-dominance relationship of each individual in the merged population and the crowding degree of the individual, including: Determining the Pareto rank of each of the initial test case sets according to the non-dominated sorting of each of the individuals in the merged population; The entire layer of the merged population is placed into the parent population according to the order of the Pareto ranks from low to high, until all individuals in a certain layer can no longer be placed in the parent population, and the individuals in this layer are placed into the parent population in order from high to low according to the crowding degree, until the parent population is full, thereby obtaining the new parent population.

6. The method according to claim 1, characterized in that A graph theory algorithm is used to determine the execution order of each target test case in the regression test case set, including: Obtain a to-be-sorted test case from the unsorted target test cases, and determine the shared data ID and initial execution order of the to-be-sorted test case; Determining, based on the shared data ID of the use case to be sorted, whether the use case to be sorted and all the target test cases have the same shared resources, wherein, if the use case to be sorted and all the target test cases do not have the same shared resources, inserting the use case to be sorted into the current execution order to obtain the final execution order of the use case to be sorted; In the case where the to-be-sorted test case and all the target test cases have the same shared resource, determining the IDs and current execution order of the sorted test cases using the shared resource; In the case where the same shared resources exist in the use cases to be sorted and the sorted use cases, the initial execution order of the use cases to be sorted is extracted, and the use cases to be sorted are inserted according to the initial execution order of the use cases to be sorted to obtain the current execution order of the use cases to be sorted, and after all the use cases to be sorted are arranged, the final execution order is obtained.

7. The method according to claim 1, characterized in that Obtain regression test information for multiple initial use cases, including: Based on microservice link tracing and precise testing technology, the mapping relationship between the initial use case and the node is recorded during the execution of the initial use case to obtain the corresponding associated node; Determine the ratio of the number of associated nodes corresponding to the initial use case to the number of summary points as the node coverage of the initial use case; Determine the cumulative number of defects when the initial use case is executed at a historical moment as the historical number of defects of the initial use case; The execution difficulty of the initial use case is determined according to the execution information of the initial use case, where the execution information of the initial use case at least includes data required for the execution of the initial use case and the execution time consumed.

8. A device for determining regression test cases, characterized in that: include: an acquiring unit, configured to acquire regression test information of a plurality of initial use cases, wherein each regression test information includes at least associated nodes, node coverage, number of historical defects, execution difficulty, execution order, and importance of associated modules of the corresponding initial use case; A construction unit, configured to construct an objective function according to the regression test information of the initial use case; A solving unit is used to solve the objective function using a multi-objective genetic algorithm with the highest execution efficiency and the highest coverage uniformity as the goals, to obtain a regression test case set, and to determine the execution order of each target test case in the regression test case set using a graph theory algorithm, where all the target test cases in the regression test case set are part of the initial test cases.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for determining regression test cases according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a determination method for executing the regression test case according to any one of claims 1 to 7.