Test case scheduling methods, devices, computer equipment, and storage media

By constructing a test case network and splitting it into test case sets with different structures, and combining the total execution time and invocation strategy, the problem of low efficiency in test case management and scheduling in cloud computing is solved, and more efficient test case execution is achieved.

CN119576781BActive Publication Date: 2026-05-26CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CLOUD TECH CO LTD
Filing Date
2024-11-26
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In cloud computing environments, the management and scheduling efficiency of test cases is insufficient, especially when a large number of test cases have similar dependencies. The server takes a long time to execute the test cases, resulting in low testing efficiency.

Method used

By constructing a use case network, the use case network is divided into a dependency-free set, a use case tree set, and a use case graph set based on the number of root use cases and dependent use cases. The total execution time of each use case set is determined, and execution machines are allocated according to the total execution time. Different invocation strategies are used to schedule the use case sets.

Benefits of technology

It improved the execution efficiency of test cases, reduced test time, optimized the allocation and utilization of computing resources, and enhanced test efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119576781B_ABST
    Figure CN119576781B_ABST
Patent Text Reader

Abstract

This application relates to a test case scheduling method, apparatus, computer device, and storage medium, belonging to the field of cloud computing testing technology. The method includes: obtaining the dependencies between multiple test cases; constructing a test case network based on the dependencies; splitting the test case network based on the root test case and the number of dependent test cases for each test case, obtaining at least two types of test case sets: a test case set without dependencies, a test case tree set, and a test case graph set; the test cases in the test case tree set constitute a first test case tree, and the test cases in the test case graph set constitute a second test case tree; determining the total execution time corresponding to the test cases in each test case set; and determining the execution machine allocated to each test case set based on the total execution time; scheduling the test cases in each test case set according to the corresponding execution machine and the calling strategy corresponding to the test case set; wherein different test case sets correspond to different calling strategies. This method can improve the testing efficiency of test cases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing testing, and in particular to a test case scheduling method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] With the development of cloud computing, many enterprises have the need to migrate their businesses to the cloud. Before migrating to the cloud, test engineers need to conduct full testing of the test cases to be migrated, including functional testing, performance testing, security testing, negative testing, long-term stability testing, and other multi-dimensional testing. Test cases often have dependencies; one test case depends on multiple test cases, and the test case is depended on by other test cases, thus forming a complex network structure.

[0003] As application scenarios increase and test cases grow, managing and scheduling test cases becomes increasingly difficult when many test cases have similar dependencies. Related technologies can perform tests sequentially within corresponding data structures based on the dependencies between test cases. However, with a large number of test cases, the number of execution machines and computing power are limited, and the testing time on each machine is long, resulting in insufficient testing efficiency. Summary of the Invention

[0004] Therefore, it is necessary to provide a test case scheduling method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve testing efficiency in response to the above-mentioned technical problems.

[0005] Firstly, this application provides a test case scheduling method. The method includes:

[0006] Obtain the dependencies between multiple use cases, and construct a use case network based on the dependencies;

[0007] Based on the number of root use cases and dependent use cases of each use case in the use case network, the use case network is split to obtain at least two types of use case sets: a use case set without dependencies, a use case tree set, and a use case graph set. The use cases in the use case set without dependencies have 0 dependent use cases. The use cases in the use case tree set constitute a first use case tree, in which the number of dependent use cases of each use case in the first use case tree set is greater than 0 and the number of root use cases is 1. The use cases in the use case graph set constitute a second use case tree, in which the number of use case dependencies of each use case in the second use case tree set is greater than 0 and the number of root use cases is greater than or equal to 2.

[0008] Determine the total execution time for each use case in each use case set, and based on the total execution time, determine the execution machine allocated to each use case set;

[0009] For each use case set, the use cases in the use case set are scheduled through the corresponding execution machine and the invocation strategy corresponding to the use case set; wherein, different use case sets correspond to different invocation strategies.

[0010] In one embodiment, the use case network is split based on the number of root use cases and dependent use cases of each use case, resulting in at least two types of use case sets: a use case set without dependencies, a use case tree set, and a use case graph set, including:

[0011] Traverse each use case in the use case network to determine the number of root use cases and dependent use cases corresponding to each use case;

[0012] Each use case that satisfies the first judgment condition is determined to be a use case set with no dependencies; the first judgment condition is that the number of dependent use cases of a use case is 0, and the root use case is itself;

[0013] Multiple first use case trees formed by the use cases that satisfy the second judgment condition are identified as a use case tree set; the second judgment condition is that the number of dependent use cases of a use case is greater than 0, and the root use case is a use case that is not itself; wherein, the root use case of each use case in the same first use case tree is the same.

[0014] Multiple second use case trees formed by the use cases that satisfy the third judgment condition are identified as use case graphs; the third judgment condition is that the number of use case dependencies of a use case is greater than 0, and the root use case contains at least two use cases.

[0015] In one embodiment, determining the total execution time corresponding to each use case in each use case set, and determining the execution machine allocated to each use case set based on the total execution time, includes:

[0016] The sum of the execution times of each use case contained in the use case dependency set, use case tree set, and use case graph set in the use case network is determined as the total execution time corresponding to each use case set;

[0017] Based on the proportion of the total execution time of each use case set to the total execution time corresponding to the use case network, the multiple execution machines to be allocated are proportionally distributed to obtain the execution machines allocated to each use case set.

[0018] In one embodiment, the second use case tree in the use case graph includes a root use case tree and a common use case tree; the method further includes:

[0019] For the use case graph, the common root use case of each use case is determined by traversing the use cases of the second use case tree; the common root use case is used to represent the root node of the common use case tree from which the branch to which the use case belongs;

[0020] Based on the common root use case of each use case and the dependencies, the second use case tree is split to obtain the root use case tree and the common use case tree.

[0021] In the root use case tree, each use case corresponds to a root use case, which is one use case; in the common use case tree, each use case corresponds to a root use case, which contains at least two use cases.

[0022] In one embodiment, the invocation strategy for the use case dependency set includes the shortest execution time invocation strategy, the invocation strategy for the use case tree set includes the longest dependent duration priority traversal strategy, and the invocation strategy for the use case graph set includes the common use case dependency priority traversal strategy.

[0023] The step of scheduling use cases in each use case set using the corresponding execution machine and the invocation strategy corresponding to the use case set includes:

[0024] For a set of test cases without dependencies, for each execution machine corresponding to the set of test cases without dependencies, the test cases in the set of test cases without dependencies are assigned to the execution machine with the shortest current execution time, until all test cases in the set of test cases without dependencies are completed.

[0025] For a set of use case trees, the first use case trees are assigned to the execution machines corresponding to the set of use case trees in order of their execution time, until all the first use case trees in the set of use case trees have been executed.

[0026] Wherein, when the execution machine corresponding to the test case tree set executes a branch node of the first test case tree, it executes the remaining branches of the first test case tree in the order of the execution time of the remaining branch nodes; the execution time of the remaining branch node is the sum of the dependent test case of the remaining branch node and the execution time of the remaining branch node.

[0027] For a use case graph set, the root use case tree corresponding to the second use case tree in the use case graph set is executed first, followed by the common use case tree corresponding to the second use case tree;

[0028] Specifically, for the root use case tree and the common use case tree, when the execution machine corresponding to the use case graph reaches the branch node of the second use case tree, it executes the branches inside the second use case tree in the order of the number of common root use cases of the remaining branch nodes.

[0029] In one embodiment, the method further includes:

[0030] For a set of use case trees, if the execution machine corresponding to the set of use case trees is idle, the first use case tree is pruned according to the execution time order of the remaining branch nodes of the first use case tree currently being executed on the non-idle execution machine, resulting in multiple pruned branch trees.

[0031] The branch tree is executed using an idle execution machine.

[0032] In one embodiment, the method further includes:

[0033] For the use case graph, if the execution machine corresponding to the use case graph is idle, the second use case tree is pruned according to the order of the number of common root use cases of each remaining branch node of the second use case tree being executed in the non-idle execution machine, and the order of the execution time of each remaining branch node, to obtain multiple pruned branch trees.

[0034] The branch tree is executed using an idle execution machine.

[0035] Secondly, this application also provides a test case scheduling device. The device includes:

[0036] The network construction module is used to obtain the dependencies between multiple use cases and construct a use case network based on the dependencies;

[0037] The network splitting module is used to split the use case network based on the number of root use cases and dependent use cases of each use case in the use case network, to obtain at least two types of use case sets: a use case set without dependencies, a use case tree set, and a use case graph set. The use cases in the use case set without dependencies have 0 dependent use cases. The use cases in the use case tree set constitute a first use case tree, where the number of dependent use cases of each use case in the first use case tree is greater than 0 and the number of root use cases is 1. The use cases in the use case graph set constitute a second use case tree, where the number of use case dependencies of each use case in the second use case tree is greater than 0 and the number of root use cases is greater than or equal to 2.

[0038] The machine allocation module is used to determine the total execution time corresponding to the test cases in each test case set, and to determine the execution machine allocated to each test case set based on the total execution time.

[0039] The test case scheduling module is used to schedule test cases in a test case set according to the corresponding execution machine and the invocation strategy corresponding to the test case set; wherein, different test case sets correspond to different invocation strategies.

[0040] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method described in the first aspect.

[0041] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the method described in the first aspect.

[0042] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the method as described in the first aspect.

[0043] The aforementioned test case scheduling method, apparatus, computer equipment, storage medium, and computer program product construct a test case network based on the dependencies between test cases. The test case network is then split using the root test case and the number of dependent test cases for each test case, resulting in at least two types of test case sets: a dependency-free set, a test case tree set, and a test case graph set. The dependency-free set has zero dependent test case data. The test case tree set contains a first test case tree composed of multiple test cases, with a greater than zero number of dependent test cases and one root test case. The test case graph set contains a second test case tree composed of multiple test cases, with a greater than zero number of dependent test cases and at least two root test cases. Next, the total execution time for each test case set is determined, and the corresponding execution machine for each test case set is determined based on the total execution time. For each test case set, test cases can be scheduled using the execution machine and the corresponding invocation strategy. Because the test case network is split into test case sets with different structures, a complex test case network is split into multiple test case sets containing simpler structures. Furthermore, based on the total execution time corresponding to each test case set, execution machines are allocated to the test case sets, which can reasonably allocate computing resources and improve execution efficiency. Finally, the test cases of each test case set are executed in a targeted manner through the invocation strategy. It can also optimize execution efficiency based on the data structure of different test case sets, thereby reducing the test time of the test case network and improving the testing efficiency of the test cases. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0045] Figure 1 This is a diagram illustrating the application environment of the test case scheduling method in one embodiment.

[0046] Figure 2 This is a flowchart illustrating a test case scheduling method in one embodiment;

[0047] Figure 3This is a schematic diagram of a use case network in one embodiment;

[0048] Figure 4 This is a schematic diagram of use case network classification in one embodiment;

[0049] Figure 5 This is a schematic diagram of the root use case tree and the common use case tree in a use case diagram of one embodiment;

[0050] Figure 6 This is a schematic diagram of a use case diagram divided into a root use case tree and a common use case tree in one embodiment;

[0051] Figure 7 This is a flowchart illustrating use case dependency management in one embodiment;

[0052] Figure 8 This is a schematic diagram of use case tree pruning in one embodiment;

[0053] Figure 9 This is a structural block diagram of a test case scheduling device in one embodiment;

[0054] Figure 10 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0055] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0056] The test case scheduling method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on a cloud or other network server. Server 104 can obtain multiple test cases provided by terminal 102 and establish a test case network based on the dependencies between the test cases. Server 104 splits the test case network using the root test case and the dependent test case data of each test case, obtaining at least two types of test case sets: a dependency-free test case set, a test case tree set, and a test case graph set. Server 104 can calculate the total execution time corresponding to the dependency-free test case set, the test case tree set, and the test case graph set respectively, and determine the execution machine corresponding to each test case set based on the total execution time. For different test case sets, the server can select the corresponding invocation strategy through the execution machine to schedule each test case in the test case set, thereby completing the scheduling of the test case network.

[0057] The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, and tablets. The server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0058] In one exemplary embodiment, such as Figure 2 As shown, a test case scheduling method is provided, which can be applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps S202 to S208. Wherein:

[0059] Step S202: Obtain the dependencies between multiple use cases and construct a use case network based on the dependencies.

[0060] In this context, dependency relationships are used to represent the execution relationships between use cases. For example, the execution relationship can be that use case B must be executed before use case A can be executed, and use case A must be executed before use case C can be executed.

[0061] Specifically, the server can obtain the dependencies between use cases, and use the use cases as nodes and the dependencies as edges to determine the use case network. Each use case can be represented in the use case network by a number. The use case network can be a partially connected network, and it can contain multiple individual use case nodes, as well as use case trees and use case graphs composed of multiple use cases.

[0062] Step S204: Based on the number of root use cases and dependent use cases of each use case in the use case network, split the use case network to obtain at least two types of use case sets: the use case set without dependencies, the use case tree set, and the use case graph set.

[0063] In this system, the number of dependent test cases in the test case without dependencies is 0. The test cases in the test case tree set constitute the first test case tree, where the number of dependent test cases for each test case in the first test case tree is greater than 0 and the number of root test cases is 1. The test cases in the test case graph set constitute the second test case tree, where the number of test case dependencies for each test case in the second test case tree is greater than 0 and the number of root test cases is greater than or equal to 2. The number of dependent test cases indicates the number of dependent test cases that need to be executed before the current test case can be executed.

[0064] Specifically, the server can traverse the test case network to determine the root test case and the amount of dependent test case data corresponding to each test case based on dependencies. The server can determine that a test case with zero dependent test cases is the root test case. The server can determine that a test case with more than zero dependent test cases and one root test case is included in the first test case tree. The server can determine that a test case with more than zero dependent test cases and two or more root test cases is included in the second test case tree. Based on the number of root test cases and dependent test cases for each test case, different test cases can be distinguished, and multiple test cases that can be split into the same data structure can be determined through dependencies between test cases, thus completing the splitting of the test case network and obtaining at least two of the following: a test case set without dependencies, a test case tree set, and a test case graph set. The test case set without dependencies contains at least one root test case, the test case tree set contains at least one first test case tree, and the test case graph set contains at least one second test case tree.

[0065] Step S206: Determine the total execution time for each use case in each use case set, and based on the total execution time, determine the execution machine allocated to each use case set.

[0066] The execution machine can provide computing power and is used to execute each use case in the use case set.

[0067] Specifically, for each use case set, the server can obtain the execution time of each use case in the set, sum the execution times of all use cases in the set, and determine this as the total execution time. The server can then allocate corresponding execution machines to each use case set based on its total execution time. Generally, the longer the total execution time, the more execution machines are allocated.

[0068] Step S208: For each use case set, schedule the use cases in the use case set according to the corresponding execution machine and the invocation strategy corresponding to the use case set.

[0069] Different use case sets correspond to different invocation strategies.

[0070] Specifically, the server can send the invocation strategy of each use case set to the execution machine corresponding to that use case set. The execution machine can schedule each use case in the use case set, the first use case tree, or the second use case tree through the invocation strategy, thereby optimizing the execution order of the use cases, optimizing the execution order of each use case in the first use case tree, and optimizing the execution order of each use case in the second use case tree.

[0071] In the above test case scheduling method, a test case network is constructed based on the dependencies between test cases. The test case network is then split using the root test case and the number of dependent test cases for each test case, resulting in at least two types of test case sets: a dependency-free set, a test case tree set, and a test case graph set. The dependency-free set contains 0 dependent test cases. The test case tree set contains a first test case tree composed of multiple test cases, with a greater than 0 number of dependent test cases and 1 root test case. The test case graph set contains a second test case tree composed of multiple test cases, with a greater than 0 number of dependent test cases and 2 or more root test cases. Next, the total execution time for each test case set is determined, and the corresponding execution machine for each test case set is determined based on the total execution time. For each test case set, test cases can be scheduled using the execution machine and the corresponding invocation strategy. Because the test case network is split into test case sets with different structures, a complex test case network is split into multiple test case sets containing simpler structures. Furthermore, based on the total execution time corresponding to each test case set, execution machines are allocated to the test case sets, which can reasonably allocate computing resources and improve execution efficiency. Finally, the test cases of each test case set are executed in a targeted manner through the invocation strategy. It can also optimize execution efficiency based on the data structure of different test case sets, thereby reducing the test time of the test case network and improving the testing efficiency of the test cases.

[0072] In an exemplary embodiment, the specific implementation process of the step "based on the number of root use cases and dependent use cases of each use case in the use case network, split the use case network to obtain at least two types of use case sets: a use case set without dependencies, a use case tree set, and a use case graph set" includes:

[0073] Traverse the use case network to determine the root use case and the number of dependent use cases for each use case; determine the use cases that satisfy the first judgment condition as the use case set without dependencies; determine the multiple first use case trees formed by the use cases that satisfy the second judgment condition as the use case tree set; wherein, the root use cases of the use cases in the same first use case tree are the same; determine the multiple second use case trees formed by the use cases that satisfy the third judgment condition as the use case graph set.

[0074] The first criterion is that the number of dependent test cases for a test case is 0, and the root test case is itself. The second criterion is that the number of dependent test cases for a test case is greater than 0, and the root test case is a test case that is not itself. The third criterion is that the number of test case dependencies for a test case is greater than 0, and the root test case contains at least two test cases.

[0075] Specifically, the server can traverse multiple use cases in the use case network to determine the root use case and the number of dependent use cases for each use case. The server can determine whether each use case satisfies a first, second, and third condition. If the first condition is met, the use case is determined to be in the use case dependency-free set and added to it. If the second condition is met, the use case is determined to be a component of either the first or second use case tree. If the third condition is met, the use case is determined to be a component of the second use case tree. After traversing all use cases, the condition satisfied by each use case can be determined. Based on this, the server can find multiple use cases that satisfy the same condition according to the dependencies between use cases and determine the corresponding use case tree. Then, based on the number of root use cases corresponding to each use case tree, it determines whether it is the first or second use case tree. After splitting all use cases in the use case graph, the following can be obtained: the use case dependency-free set composed of each root use case, the use case tree set composed of each first use case tree, and the use case graph set composed of each second use case tree.

[0076] In this embodiment, by using the root use case of the use case, the root use case of the use case tree, and the number of dependent use cases of each use case, the use case network can be split into a set of use cases without dependencies, a set of use case trees, and a set of use case graphs. This allows for the rapid determination of each use case set in the use case graph and improves the efficiency of use case graph splitting.

[0077] In an exemplary embodiment, the specific implementation process of the step "determining the total execution time corresponding to the use cases in each use case set, and determining the execution machine allocated to each use case set based on the total execution time" includes:

[0078] The total execution time of each use case contained in the use case network's dependency-free set, use case tree set, and use case graph set is determined as the total execution time corresponding to each use case set. Based on the proportion of the total execution time of each use case set to the total execution time corresponding to the use case network, the multiple execution machines to be allocated are proportionally allocated to obtain the execution machines allocated to each use case set.

[0079] Specifically, for each use case set, the server determines the sum of the execution times of all use cases contained in the use case dependency-free set within the use case network, and uses this as the total execution time corresponding to the use case dependency-free set. The server determines the sum of the execution times of all use cases contained in the first use case trees within the use case tree set, and uses this as the total execution time corresponding to the use case tree set. The server determines the sum of the execution times of all use cases contained in the second use case trees within the use case graph set, and uses this as the total execution time corresponding to the use case graph set. The server can sum the total execution times of the use case dependency-free sets, the use case tree sets, and the use case graph sets to obtain the total execution time of the use case network. The server then determines the percentage of the total execution time of the use case dependency-free sets, the percentage of the total execution time of the use case tree sets, and the percentage of the total execution time of the use case graph sets within the total execution time of the use case network. The server multiplies the number of allocable execution machines by the corresponding percentages to obtain the number of execution machines allocated to the use case dependency-free sets, the number of execution machines allocated to the use case tree sets, and the number of execution machines allocated to the use case graph sets. Finally, the execution machines assigned to each use case set are obtained. Generally speaking, the execution machines have the same computing power.

[0080] In this embodiment, by using the proportion of the total execution time corresponding to the use case dependency set, use case tree set, and use case graph set, a corresponding number of execution machines can be allocated, which can optimize the actual execution time of the execution machines and improve the scheduling efficiency of the use case network.

[0081] In an exemplary embodiment, the second use case tree in the use case graph includes a root use case tree and a common use case tree, and the method further includes:

[0082] For the use case graph, the common root use case of each use case is determined by traversing the use cases of the second use case tree; based on the common root use case of each use case and the dependencies, the second use case tree is split to obtain the root use case tree and the common use case tree.

[0083] Among them, the common root use case is used to represent the root node of the common use case tree from which the use case belongs; the root use case corresponding to each use case in the root use case tree is a use case; the root use case corresponding to each use case in the common use case tree contains at least two use cases.

[0084] Specifically, for each second use case tree in the use case graph, the server can determine the common root use case corresponding to the use cases in the second use case tree during the traversal of the second use case tree. For example, when the server traverses to the point where the root use case of use case A is 1, and the root use case of the next use case B of use case A also includes other root use cases 2 besides root use case 1, the other root use cases 2 are added to the common root use case of use case A. Here, use case B is a node in the common use case tree. Based on this, the server can determine the common root use case of each use case in the second use case tree. If the number of common root use cases of two directly connected use cases is different, the two use cases can be split to obtain two subtrees in the second use case tree. Through the root use cases corresponding to the two subtrees, it can be determined whether the subtree is a common root use case tree or a root use case tree. The number of root use cases for each use case in the common root use case tree is at least two. The number of root use cases for each use case in the root use case tree is one.

[0085] In this embodiment, by traversing the use cases of the second use case tree in the use case graph and defining the common root use case of the use cases, the second use case tree can be split into multiple subtrees. Based on the number of root use cases corresponding to each subtree, the subtree can be determined as either a root use case tree or a common use case tree. This allows for accurate splitting of the second use case tree and reduces its complexity.

[0086] In an exemplary embodiment, the invocation strategy for the use case dependency-free set includes the shortest execution time invocation strategy, the invocation strategy for the use case tree set includes the longest dependent duration priority traversal strategy, and the invocation strategy for the use case graph set includes the common use case dependency priority traversal strategy. The specific implementation process of the step "for each use case set, schedule the use cases in the use case set according to the corresponding execution machine and the invocation strategy corresponding to the use case set" includes:

[0087] For test cases without dependencies, for each execution machine corresponding to the test cases without dependencies, the test cases in the test cases without dependencies are assigned to the execution machine with the shortest current execution time, until all test cases in the test cases without dependencies have been executed.

[0088] Specifically, for the invocation strategy corresponding to the dependency-free test case set, the server can sort the test cases in the dependency-free test case set according to their execution time, and prioritize assigning test cases with longer execution times to execution machines. During execution, execution machines may be idle after completing their test cases. If idle execution machines exist, the server can determine the current execution time of each idle execution machine and prioritize assigning the next test case to the execution machine with the shortest execution time, so that the current execution times of each execution machine are as close as possible. Once all test cases in the dependency-free test case set have been executed, no more test cases are assigned to execution machines. The above execution process can be defined as the shortest execution time invocation strategy.

[0089] For each set of test cases, the first test cases are assigned to the execution machine corresponding to the set of test cases according to the order of their execution times, until all the first test cases in the set have been executed.

[0090] When the execution machine corresponding to the test case tree set reaches the branch node of the first test case tree, it executes the remaining branches of the first test case tree in the order of the execution time of the remaining branch nodes; the execution time of the remaining branch nodes is the sum of the dependent test cases of the remaining branch nodes and the execution time of the remaining branch nodes.

[0091] Specifically, regarding the invocation strategy corresponding to the test case tree set, the server can sort the first test case trees in the test case tree set according to their execution time, and prioritize assigning the first test case tree with the longest execution time to the execution machine. During execution, the execution machine will traverse and execute each test case in the first test case tree. When it reaches a branch node of the first test case tree, the execution machine can determine the total execution time of the branch paths corresponding to the remaining branch nodes that depend on that branch node, and execute the remaining branches corresponding to the remaining branch nodes in order of length, thus completing the traversal of all branches of the first test case tree. Once all the first test case trees in the test case tree set have been executed, no more first test case trees will be assigned to the execution machine. The above execution process can be defined as a longest-dependency-first traversal strategy.

[0092] For a use case graph set, the root use case tree corresponding to the second use case tree in the use case graph set is executed first, followed by the common use case tree corresponding to the second use case tree.

[0093] Specifically, for the root use case tree and the common use case tree, when the execution machine corresponding to the use case graph reaches the branch node of the second use case tree, it executes the branches inside the second use case tree in the order of the number of common root use cases of the remaining branch nodes.

[0094] Specifically, regarding the invocation strategy corresponding to the use case graph set, the server can sort the second use case trees in the use case graph set according to their execution time, and prioritize assigning the second use case trees with longer execution times to the execution machine. During execution, the execution machine will first traverse the root use case tree in the second use case tree. After the root use case tree has been traversed, the common use case tree will be executed.

[0095] For each root use case tree, during the traversal of the root use case tree, when the execution machine reaches a branch node of the root use case tree, it determines the size of the number of common root use cases of the remaining branch nodes, and executes the remaining branches inside the root use case tree in order of size, so that more important use cases can be executed first.

[0096] For each common use case tree, during the traversal of the common use case tree, when the execution machine reaches a branch node of the common use case tree, it determines the number of common root use cases in the remaining branch nodes, and executes the remaining branches within the common root use case tree in order of the number of cases. If the number of common root use cases in the remaining branch nodes is the same, the total execution time of the branch path corresponding to the remaining branch node can be determined, and the remaining branches within the common root use case tree are executed in order of the number of cases.

[0097] Once the second use case tree of the use case graph has been fully executed, no more second use case trees will be allocated to the execution machine. The above execution process can be identified as a common use case dependency priority traversal strategy.

[0098] In this embodiment, the execution time of the test cases can be reduced and the execution efficiency of the test cases can be improved by executing each test case in the dependency-free set by the shortest execution time call strategy, executing each first test case tree in the test case tree set by the longest dependent duration priority traversal strategy, and executing the second test case tree in the test case graph set by the common test case dependency priority traversal strategy.

[0099] In one exemplary embodiment, the method further includes:

[0100] For a set of use case trees, if the execution machine corresponding to the set of use case trees is idle, the first use case tree is pruned according to the execution time order of the remaining branch nodes of the first use case tree currently being executed on the non-idle execution machine, resulting in multiple pruned branch trees; the branch trees are then executed by the idle execution machine.

[0101] Specifically, when the execution machine corresponding to the test case tree set is idle, it means that there is no longer a first test case tree that can be executed. In this case, the first test case tree currently executing on a non-idle execution machine can be pruned so that an idle execution machine can continue executing test cases. Based on this, the server can determine the execution time of each remaining branch node of the currently executing first test case tree and prune the first test case tree according to the order of execution time, resulting in multiple pruned branch trees. Branch trees with longer execution times are prioritized and sent to idle execution machines, thus enabling idle execution machines to continue executing test cases.

[0102] In this embodiment, by pruning the first use case tree that is currently being executed, multiple execution machines can execute the same use case tree, thereby increasing the utilization of the execution machines and reducing the execution time.

[0103] In one exemplary embodiment, the method further includes:

[0104] For the use case graph, if the execution machine corresponding to the use case graph is idle, the second use case tree is pruned according to the order of the number of common root use cases of each remaining branch node of the second use case tree currently being executed on the non-idle execution machine, and the order of the execution time of each remaining branch node, to obtain multiple pruned branch trees; the branch trees are then executed by the idle execution machine.

[0105] Specifically, when the execution machine corresponding to the use case graph is idle, it means there are no more executable second use case trees in the use case graph. In this case, the second use case tree currently executing on a non-idle execution machine can be pruned so that an idle execution machine can continue executing test cases. Based on this, the server can determine the number of common root use cases for each remaining branch node of the currently executing second use case tree, and prune the first use case tree according to the order of the number of common root use cases, resulting in multiple pruned branch trees. If the number of common root use cases for the remaining branch nodes is the same, the execution time of the remaining branch nodes can be determined, and pruning can be performed according to the order of execution time. If the execution time of the remaining branch nodes is the same, pruning can be performed according to the order of the numbers of the remaining branch nodes.

[0106] In this embodiment, by pruning the second use case tree that is currently being executed, multiple execution machines can execute the same use case tree, thereby increasing the utilization of the execution machines and reducing the execution time.

[0107] The following describes in detail the specific execution process of the above-described test case scheduling method with reference to a specific embodiment. This embodiment of the application breaks down the complex test case network into multiple smaller-granularity units, and formulates different calling strategies according to different types of units, thereby decoupling test case dependencies, improving machine utilization, shortening the total test case execution time, and improving testing efficiency.

[0108] The embodiments of this application can be divided into two parts: use case dependency management and use case scheduling execution.

[0109] For use case dependency management, assuming there are a total of First, for this test case... Each use case is numbered as follows: And the first The execution time of each test case is .

[0110] For the For each use case, create a use case dependency set. and use cases are dependent sets It is initialized to an empty set, and variables are created. and Store the total number of dependent test cases and the total duration of the dependent test cases, respectively, and initialize them to 0. Total duration of all use cases that are directly or indirectly dependent.

[0111] Traverse sequentially For the nth test case, For each use case, record the numbers of all use cases that this use case depends on and put them into... and record ; Traversal All use cases, such as for The Middle One use case, Add to In this step, the dependencies between use cases are established, meaning that for any given use case, the use cases it depends on and the use cases it depends on are clearly defined. These dependencies form a complex network of use cases, such as... Figure 3 As shown, a use case network was established by performing dependency analysis on 31 use cases. Subsequently, the use case network was broken down into finer-grained units to facilitate scheduling and execution on the execution machine.

[0112] The unit can be defined as follows:

[0113] (1) For any use case ,if Then define use cases. For the root use case, such as Figure 3 In the diagram, 17, 20, and 7 are the root use cases. (2) For any use case ,if If it is an empty set, then define a use case. For leaf use cases, such as Figure 3 In the diagram, 18, 26, etc., are leaf use cases. (3) Definition For use cases The root use case set to which it belongs, such as Figure 3 As shown, the root use case set for 26 is 17.

[0114] Iterate through all test cases to obtain all root test cases, and then perform a depth-first traversal starting from each root test case. Let's say... Leaf example, then If it is not a leaf example, At the same time, add the root test case number to middle.

[0115] Through the above operations, the use cases in the use case network can be... They are divided into three main categories: (1) Use cases without dependencies : and Only contains ; All use cases can be executed without depending on other use cases. (2) Use cases belong to a certain tree, that is, the use case tree. : And it contains only one non- The numbering; each use case tree contains only one root use case, and except for the root use case, all other nodes depend on the execution of the parent node. (3) The use cases belong to a directed graph, that is, the use case graph. : and Each use case diagram contains at least two numbers; each use case diagram contains at least two root use cases, and all use cases except the root use cases depend on the execution of the parent node.

[0116] The above three main categories are illustrated in the diagrams below. Figure 4 As shown in the diagram. Based on this, the use cases in the use case network can be divided into the three main categories mentioned above.

[0117] For the above three categories of use cases, separate processing is required: (1) For All test cases are sorted in descending order of execution time; and recorded. The sum of the execution times of all test cases .

[0118] (2) For All trees in the tree, based on the use case of each tree root. Sort from largest to smallest; assuming The set of root nodes of the medium tree is ,but The sum of the execution times of all test cases .

[0119] (3) Define the first The root use case set in the graph is The total duration of all test cases is ;for All the diagrams in the diagram, according to Sort by largest to smallest. Records The sum of the execution times of all use cases in all graphs is .

[0120] In an exemplary embodiment, as the number of use cases increases and the dependencies between them become more complex, the directed graph obtained by the above division will become very large. At this point, if the use cases in the use case graph are scheduled directly, the granularity is too large, which is not conducive to the scheduling and execution of use cases. Therefore, it is necessary to split the use case graph into individual use case trees.

[0121] At this point, the use case diagram can be defined. In a use case diagram, use cases contained within a tree with at least two root use cases as root nodes form a common use case tree (common root use case tree), and the root node of this common use case tree is the common tree root use case; conversely, it is called a root use case tree (root use case tree). Clearly, a use case diagram consists entirely of common use case trees and root use case trees, as illustrated in the diagram below. Figure 5 As shown, the use case diagram is split into two root use case trees and one common use case tree, with 25 root use cases in the common tree. In the root use case trees, each use case node defines a common root use case set. The common root use case set is used to store the root node of the common use case tree from which the branch to which this node belongs. For example... Figure 5 As shown, the CR of 17, 19, and 24 is 25, the CR of 20 and 21 is 25, but the CR of 18 and 26 is empty, and the CR of 23 is empty.

[0122] for The first in The graph is traversed sequentially from each root use case using a depth-first search until a leaf use case or the root use case set to which the use case belongs is reached. Return and update when other root use cases are present. In this way, the first The diagram is split into multiple common use case trees and a root use case tree, as shown in the diagram below. Figure 6 As shown. Clearly, the common root use case... It must be smaller than the root test case. Because of the root use case In addition to the common root use case, it also includes nodes of other root use case trees.

[0123] Finally All the tree sets into which the graph is cut are ordered in the order of root use case tree first, then common use case tree. Within the root use case tree and root common use case tree, they are further ordered according to the root node. The data is sorted from largest to smallest. This sorting ensures that the common use case tree always follows the root use case tree composed of the root use cases. This embodiment of the application names this method the Use Case Graph Splitting Use Case Tree Method.

[0124] After the above graph segmentation steps, all directed graphs of use cases have been segmented into ordered trees. At this point, the use case network has been segmented into sets of dependency-free use cases. and use case tree And the root use case tree and common use case tree in the diagram. The entire use case dependency management process is as follows: Figure 7 As shown.

[0125] In an exemplary embodiment, for use case scheduling execution, assume there are a total of The test case execution machines are numbered as follows: No dependency set for use cases Use Case Tree Use Case Diagram The trees in the data are allocated proportionally. , , A machine.

[0126] For The use cases in the code are scheduled for execution according to the following strategy. Note The use cases in the dataset have no dependencies and have been sorted by execution time from longest to shortest. Assume... In the machine, the first The total execution time of the test cases allocated on the machines is Then for The Middle Machine number assigned to each use case and update the number Total execution time of test cases on each machine .

[0127] By using the above methods, in advance The test cases are distributed across various machines. Since each distribution assigns a test case to the machine with the shortest execution time, this ensures... The method aims to minimize the execution time of all test cases. In this embodiment, the method is named the "Shortest Execution Time for Test Cases with No Dependencies" invocation method.

[0128] For Use cases in the use case tree are scheduled for execution according to the following strategy. Note All use case trees are sorted to ensure that trees with higher processing times are placed first. Data is then scheduled from largest to smallest, based on the use case tree. Execution starts from the root node on the machine, exceeding... The use case tree waits for an idle machine to schedule execution again, meaning that idle machines will be given priority for allocation. The use case tree in the example.

[0129] The traversal of the use case tree does not employ traditional depth-first or breadth-first traversal, but rather longest-running-first traversal. Specifically, for any use case in the use case tree, when that use case is depended on by multiple use cases (i.e., when there are multiple choices for the next executed use case), the root node of the remaining branch is selected. The longest branch traversal is executed. In this embodiment, the method is named the longest-dependency-longest-branch traversal method.

[0130] In one exemplary embodiment, when a test case tree is very large and takes a long time to execute, there may be a situation where one machine is continuously executing test cases on that tree while other machines are idle. This is detrimental to the utilization of machine resources and the improvement of testing efficiency. Therefore, when there are idle machines, it is necessary to prune the currently executing test case tree.

[0131] In one example, a breadth-first traversal is performed starting from the root node of a tree. The first node encountered has had its test cases executed, and any nodes with unexecuted branches are pruned nodes. For example... Figure 8 As shown, assuming test cases 7 and 10 have been completed, test case 14 is currently being executed. At this time, the pruned node is 7, and the unexecuted branches are the subtrees with 8 and 9 as root nodes.

[0132] The pruning call strategy is as follows: Assume there are If there are idle machines, start by breadth-first traversal of the first use case tree (the one with the longest execution time) to find the pruned node, and then proceed according to the child nodes of the pruned node. Prune the branches in descending order of size. If they are the same, pruning is performed according to the branch root node number, and the nodes are scheduled to proceed sequentially. Execute on a machine; if the number of unexecuted branches is greater than... If the number of unexecuted branches is less than 1, then pruning will be paused and wait for a machine to become available before resuming pruning; Then, the pruning call will be executed starting from the second use case tree. Clearly, by employing the pruning call strategy, the machine can be fully utilized, and the total execution time of all use cases can be shortened. In this embodiment of the application, this method is named the Use Case Pruning Call Method.

[0133] For use case diagrams The cut tree use cases are scheduled for execution according to the following strategy. (Use Case Diagram) The split use case trees have already been sorted, and the sorting rules ensure that common use case trees always follow their corresponding root use case trees. The root use case trees are then assigned sequentially to... Execute on a machine; if the number of unexecuted root test cases is greater than [number missing], [action missing]. The remaining root test case trees await scheduling execution on idle machines. Common test case trees are scheduled only after all root test case trees. If the number of unexecuted root test case trees is less than... Select a use case tree from all common use case trees. The execution is scheduled on the remaining machines, and the selection criteria are based on the order from front to back, selecting the common use case tree where all the use cases that the root node depends on have been completed.

[0134] The executability of the common use case tree depends on the execution result of the corresponding root use case tree, or more precisely, on a certain branch within the corresponding root use case tree, such as... Figure 6 As shown, the execution of the common test case tree depends only on the paths 17->19->24 of root test case tree 1 and 20->21 of root test case tree 2. Therefore, when traversing test cases in the execution tree, these dependent paths should be executed first. Otherwise, there may be situations where the machine is idle, but the test cases that the common test case tree depends on are not executed, resulting in execution failure, wasting machine resources and delaying the test progress. Therefore, for the traversal and execution of the root test case tree, the strategy of traversing and executing the most dependent common test case tree first should be adopted. The execution follows a maximum priority traversal. When a node in the root test case tree has been executed, and there are multiple branches to choose from, the root node of that branch is selected from all branches. The highest branch is executed first, meaning the use case path that is depended upon by the common use case tree is executed first, and the more common use case trees that depend on it, the higher the priority. In this embodiment of the application, this method is named Common Use Case Dependency Priority Traversal.

[0135] Similarly, and The use case tree is similar to that in the example tree. All use case trees in the system also employ a pruning call strategy, only... The pruning call strategy differs from that in other contexts. Pruning is prioritized from the root use case tree, and when pruning in the root use case tree, it follows the branch root node. Prune the branches in descending order of size. If they are the same, then follow the rules. Prune in descending order of size, if and If all are the same, then prune according to the branch root node number.

[0136] In the above scheduling, when the machine is idle, the scheduled execution of test cases of the corresponding category is completed first. Only after all test cases of the corresponding category have been executed can the machine be scheduled for test cases of other categories.

[0137] In this embodiment of the application, the above method is used to process test case dependencies and break down the complex test case network into multiple smaller units. Different calling strategies are formulated according to different types of units, thereby decoupling test case dependencies, improving machine utilization, shortening the total test case execution time, and improving testing efficiency.

[0138] In one exemplary embodiment, to help better understand the technical solution of the present invention, the technical solution of the present invention will be further described below with reference to the figures.

[0139] For ease of illustration, suppose there are 31 use cases (in real-world scenarios, this could be much larger than 31; this embodiment is merely an example). The dependencies between these use cases form the following... Figure 3The example network shown includes example use cases 5, 17, 20, and 7, which are root use cases, and example use cases 6 and 11, which are leaf use cases.

[0140] Starting from the root test case, perform a depth-first traversal to calculate the value of each test case. At the same time, the root use case number is added to the root use case set, such as the root use case set for 26 being {17} and the root use case set for 25 being {17,20}.

[0141] Through the above operations, all use cases in the use case network can be divided into three main categories, such as... Figure 4 As shown, all use cases are divided into , , middle.

[0142] for All test cases are sorted in descending order of execution time, for example, 1, 2, 3, 4; and the results are recorded. The sum of the execution times of all use cases.

[0143] for All trees in the tree, based on the use case of each tree root. Sort from largest to smallest, such as 7 and 5; The set of root nodes of the medium tree is ,but The sum of the execution times of all test cases is 5. With 7 sum.

[0144] for All diagrams, based on the total duration of the use cases. Sort by size from largest to smallest; there is only one image here. Record all images. The sum of the execution times of the test cases.

[0145] from Figure 4 As can be seen, the use case diagram is quite large and needs to be split into multiple use case trees. For example... Figure 5 As shown, the use case diagram consists of two root use case trees and one common use case tree, with 25 root use cases in the common tree. In the root use case trees, each use case node defines a common root use case set, as shown in 24. 21 .

[0146] for The diagram in the middle, according to the splitting rules, is shown below. Figure 6 As shown. Finally, All the tree sets into which the graph is cut are ordered in the order of root use case tree first, then common use case tree. Within the root use case tree and root common use case tree, they are further ordered according to the root node. Sort the data from largest to smallest. This sorting ensures that the common use case tree always follows the root use case tree composed of the root use cases. Assuming that according to... Sorting as follows Figure 6 As shown.

[0147] After the above graph segmentation steps, all directed graphs of use cases have been segmented into ordered trees. At this point, the use case network has been segmented into sets of dependency-free use cases. and use case tree And the root use case tree and common use case tree in the diagram. The entire use case dependency management process is as follows: Figure 7 As shown.

[0148] Assume there are a total of 7 machines executing test cases. There is no dependency set on the test cases. Use Case Tree Use Case Diagram The trees in the diagram are allocated to 2, 3, and 2 machines respectively in proportion.

[0149] for Assuming that test cases 1, 2, 3, and 4 take 8, 6, 4, and 3 minutes respectively, according to the principle of minimizing time allocation, the test case sets scheduled for execution on machines 1 and 2 are {1,4} and {2,3} respectively. This ensures that all four test cases are executed in the shortest possible time on both machines.

[0150] For use case trees In the example test case tree, there are only two trees, but they are assigned to machines 3, 4, and 5. Test case trees 7 and 5 are then scheduled to be executed on machines 3 and 4 respectively. After test case 7 is executed, assume that the child nodes... The test cases are sorted from largest to smallest as 10, 8, and 9. According to the maximum-first search, test case 10 is selected for execution on machine 3. Test case 7 then becomes a pruned node. Assuming machine 4 has already completed the execution of test case tree 5, and machines 4 and 5 are now idle, test case tree 7 should be pruned as follows: Figure 8 As shown, at this point, use case tree 8 and use case tree 9 should be scheduled to machines 4 and 5 respectively to execute the use cases.

[0151] For use case diagrams The use case tree in the image assigns machines 6 and 7, as follows: Figure 6As shown, assume the sorted use case trees are 17, 20, and 25. According to the root use case tree priority principle, use case trees 17 and 20 are scheduled for execution on machines 6 and 7, respectively. After use case 17 is completed, following the strategy of prioritizing execution based on the largest number of dependent common use cases, use case 19 should be selected for execution. Similarly, after use case 20 is completed, use case 21 should be selected for execution. Once both use cases 24 and 21 are completed, common use case tree 25 can begin execution. If there is an idle machine, 25 will be scheduled for execution on the corresponding idle machine.

[0152] In the above scheduling, when the machine is idle, the scheduled execution of test cases of the corresponding category is completed first. Only after all test cases of the corresponding category have been executed can the machine be scheduled for test cases of other categories.

[0153] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0154] Based on the same inventive concept, this application also provides a test case scheduling apparatus for implementing the test case scheduling method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more test case scheduling apparatus embodiments provided below can be found in the limitations of the test case scheduling method described above, and will not be repeated here.

[0155] In one exemplary embodiment, such as Figure 9 As shown, a test case scheduling device 900 is provided, including: a network construction module 901, a network splitting module 902, a machine allocation module 903, and a test case scheduling module 904, wherein:

[0156] The network building module is used to obtain the dependencies between multiple use cases and build a use case network based on the dependencies;

[0157] The network splitting module is used to split the use case network based on the number of root use cases and dependent use cases of each use case in the use case network, to obtain at least two types of use case sets: the use case set without dependencies, the use case tree set, and the use case graph set. The use cases in the use case set without dependencies have 0 dependent use cases. The use cases in the use case tree set constitute the first use case tree. The use cases in each first use case tree have a greater than 0 number of dependent use cases and a root use case of 1. The use cases in the use case graph set constitute the second use case tree. The use cases in each second use case tree have a greater than 0 number of dependent use cases and a root use case of 2 or more.

[0158] The machine allocation module is used to determine the total execution time of each test case in each test case set, and based on the total execution time, to determine the execution machine allocated to each test case set.

[0159] The test case scheduling module is used to schedule test cases in each test case set according to the corresponding execution machine and the invocation strategy corresponding to the test case set; different test case sets correspond to different invocation strategies.

[0160] Further, the network splitting module 902 is specifically used for: traversing each use case in the use case network, determining the number of root use cases and dependent use cases corresponding to each use case; determining that each use case satisfying the first judgment condition is a use case with no dependencies; the first judgment condition is that the number of dependent use cases of a use case is 0, and the root use case is itself; determining multiple first use case trees formed by each use case satisfying the second judgment condition, which are use case tree sets; the second judgment condition is that the number of dependent use cases of a use case is greater than 0, and the root use case is a use case that is not itself; wherein, the root use cases of each use case in the same first use case tree are the same; determining multiple second use case trees formed by each use case satisfying the third judgment condition, which are use case graphs; the third judgment condition is that the number of use case dependencies of a use case is greater than 0, and the root use case contains at least two use cases.

[0161] Furthermore, the machine allocation module is specifically used to: determine the sum of the execution times of each use case contained in the use case dependency set, use case tree set, and use case graph set in the use case network, respectively, as the total execution time corresponding to each use case set; and allocate the multiple execution machines to be allocated proportionally according to the proportion of the total execution time of each use case set to the total execution time corresponding to the use case network, so as to obtain the execution machine allocated to each use case set.

[0162] Furthermore, the second use case tree in the use case graph includes a root use case tree and a common use case tree. The apparatus also includes a use case tree splitting module, used to: for the use case graph, determine the common root use case of each use case by traversing the use cases in the second use case tree; the common root use case represents the root node of the common use case tree from which the use case belongs; based on the common root use case of each use case and the dependencies, split the second use case tree to obtain the root use case tree and the common use case tree; wherein, the root use case corresponding to each use case in the root use case tree is one use case; the root use case corresponding to each use case in the common use case tree contains at least two use cases.

[0163] Furthermore, the invocation strategy for the use case dependency-free set includes the shortest execution time invocation strategy, the invocation strategy for the use case tree set includes the longest dependent duration priority traversal strategy, and the invocation strategy for the use case graph set includes the common use case dependency priority traversal strategy. The test case scheduling module 904 is specifically configured to: for a test case dependency-free set, assign the test cases in the dependency-free set to the execution machine with the shortest current execution time for each execution machine corresponding to the dependency-free set, until all test cases in the dependency-free set have been executed; for a test case tree set, assign the first test case tree to the execution machine corresponding to the test case tree set according to the execution time of the first test case tree in the test case tree set, until all first test case trees in the test case tree set have been executed; wherein, when the execution machine corresponding to the test case tree set executes a branch node of the first test case tree, it executes the remaining branches of the first test case tree according to the execution time of the remaining branch nodes; the execution time of the remaining branch node is the sum of the dependent test cases of the remaining branch node and the execution time of the remaining branch node; for a test case graph set, prioritize the execution of the root test case tree corresponding to the second test case tree in the test case graph set, and then execute the common test case tree corresponding to the second test case tree; wherein, for the root test case tree and the common test case tree, when the execution machine corresponding to the test case graph set executes a branch node of the second test case tree, it executes the branches inside the second test case tree according to the number of common root test cases of the remaining branch nodes.

[0164] Furthermore, the device also includes a first pruning module, used to: for the test case tree set, if the execution machine corresponding to the test case tree set is idle, prune the first test case tree according to the execution time order of each remaining branch node of the first test case tree currently being executed on the non-idle execution machine, to obtain multiple pruned branch trees; and execute the branch trees through the idle execution machine.

[0165] Furthermore, the device also includes a second pruning module, used to: for the use case graph set, if the execution machine corresponding to the use case graph set is idle, prune the second use case tree according to the order of the number of common root use cases of each remaining branch node of the second use case tree currently being executed on the non-idle execution machine, and the order of the execution time of each remaining branch node, to obtain multiple pruned branch trees; and execute the branch trees through the idle execution machine.

[0166] Each module in the aforementioned test case scheduling device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can invoke and execute the operations corresponding to each module.

[0167] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data corresponding to each test case. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a test case scheduling method.

[0168] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0169] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0170] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0171] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0172] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0173] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0174] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A test case scheduling method, characterized in that, The method includes: Obtain the dependencies between multiple use cases, and construct a use case network based on the dependencies; Based on the number of root use cases and dependent use cases of each use case in the use case network, the use case network is split to obtain at least two types of use case sets: a use case set without dependencies, a use case tree set, and a use case graph set. The use cases in the use case set without dependencies have 0 dependent use cases. The use cases in the use case tree set constitute a first use case tree, in which the number of dependent use cases of each use case in the first use case tree set is greater than 0 and the number of root use cases is 1. The use cases in the use case graph set constitute a second use case tree, in which the number of use case dependencies of each use case in the second use case tree set is greater than 0 and the number of root use cases is greater than or equal to 2. Determine the total execution time for each use case in each use case set, and based on the total execution time, determine the execution machine allocated to each use case set; For a set of test cases without dependencies, for each execution machine corresponding to the set of test cases without dependencies, the test cases in the set of test cases without dependencies are assigned to the execution machine with the shortest current execution time, until all test cases in the set of test cases without dependencies are completed. For a set of use case trees, the first use case trees are assigned to the execution machines corresponding to the set of use case trees in order of their execution time, until all the first use case trees in the set of use case trees have been executed. Wherein, when the execution machine corresponding to the test case tree set executes a branch node of the first test case tree, it executes the remaining branches of the first test case tree in the order of the execution time of the remaining branch nodes; the execution time of the remaining branch node is the sum of the dependent test case of the remaining branch node and the execution time of the remaining branch node. For a use case graph set, the root use case tree corresponding to the second use case tree in the use case graph set is executed first, followed by the common use case tree corresponding to the second use case tree; Specifically, for the root use case tree and the common use case tree, when the execution machine corresponding to the use case graph reaches the branch node of the second use case tree, it executes the branches inside the second use case tree in the order of the number of common root use cases of the remaining branch nodes.

2. The method according to claim 1, characterized in that, Based on the number of root use cases and dependent use cases of each use case in the use case network, the use case network is split into at least two types of use case sets: a use case set without dependencies, a use case tree set, and a use case graph set. Traverse each use case in the use case network to determine the number of root use cases and dependent use cases corresponding to each use case; Each use case that satisfies the first judgment condition is determined to be a use case set with no dependencies; the first judgment condition is that the number of dependent use cases of a use case is 0, and the root use case is itself; Multiple first use case trees formed by the use cases that satisfy the second judgment condition are identified as a use case tree set; the second judgment condition is that the number of dependent use cases of a use case is greater than 0, and the root use case is a use case that is not itself; wherein, the root use case of each use case in the same first use case tree is the same. Multiple second use case trees formed by the use cases that satisfy the third judgment condition are identified as use case graphs; the third judgment condition is that the number of use case dependencies of a use case is greater than 0, and the root use case contains at least two use cases.

3. The method according to claim 1, characterized in that, The process of determining the total execution time corresponding to each use case set, and determining the execution machine allocated to each use case set based on the total execution time, includes: The sum of the execution times of each use case contained in the use case dependency set, use case tree set, and use case graph set in the use case network is determined as the total execution time corresponding to each use case set; Based on the proportion of the total execution time of each use case set to the total execution time corresponding to the use case network, the multiple execution machines to be allocated are proportionally distributed to obtain the execution machines allocated to each use case set.

4. The method according to claim 1, characterized in that, The second use case tree in the use case graph includes a root use case tree and a common use case tree; the method further includes: For the use case graph, the common root use case of each use case is determined by traversing the use cases of the second use case tree; the common root use case is used to represent the root node of the common use case tree from which the branch to which the use case belongs; Based on the common root use case of each use case and the dependencies, the second use case tree is split to obtain the root use case tree and the common use case tree. In the root use case tree, each use case corresponds to a root use case, which is one use case; in the common use case tree, each use case corresponds to a root use case, which contains at least two use cases.

5. The method according to claim 4, characterized in that, The invocation strategy for the use case set without dependencies includes the shortest execution time invocation strategy; the invocation strategy for the use case tree set includes the longest dependent duration priority traversal strategy; and the invocation strategy for the use case graph set includes the common use case dependency priority traversal strategy.

6. The method according to claim 5, characterized in that, The method further includes: For a set of use case trees, if the execution machine corresponding to the set of use case trees is idle, the first use case tree is pruned according to the execution time order of the remaining branch nodes of the first use case tree currently being executed on the non-idle execution machine, resulting in multiple pruned branch trees. The branch tree is executed using an idle execution machine.

7. The method according to claim 5, characterized in that, The method further includes: For the use case graph, if the execution machine corresponding to the use case graph is idle, the second use case tree is pruned according to the order of the number of common root use cases of each remaining branch node of the second use case tree being executed in the non-idle execution machine, and the order of the execution time of each remaining branch node, to obtain multiple pruned branch trees. The branch tree is executed using an idle execution machine.

8. A test case scheduling device, characterized in that, The device includes: The network construction module is used to obtain the dependencies between multiple use cases and construct a use case network based on the dependencies; The network splitting module is used to split the use case network based on the number of root use cases and dependent use cases of each use case in the use case network, to obtain at least two types of use case sets: a use case set without dependencies, a use case tree set, and a use case graph set. The use cases in the use case set without dependencies have 0 dependent use cases. The use cases in the use case tree set constitute a first use case tree, where the number of dependent use cases of each use case in the first use case tree is greater than 0 and the number of root use cases is 1. The use cases in the use case graph set constitute a second use case tree, where the number of use case dependencies of each use case in the second use case tree is greater than 0 and the number of root use cases is greater than or equal to 2. The machine allocation module is used to determine the total execution time corresponding to the test cases in each test case set, and to determine the execution machine allocated to each test case set based on the total execution time. The test case scheduling module is used to assign test cases in the set of test cases without dependencies to the execution machine with the shortest current execution time for each execution machine corresponding to the set of test cases without dependencies, until all test cases in the set of test cases without dependencies have been executed. For a set of use case trees, the first use case trees are assigned to the execution machines corresponding to the set of use case trees in order of their execution time, until all the first use case trees in the set of use case trees have been executed. Wherein, when the execution machine corresponding to the test case tree set executes a branch node of the first test case tree, it executes the remaining branches of the first test case tree in the order of the execution time of the remaining branch nodes; the execution time of the remaining branch node is the sum of the dependent test case of the remaining branch node and the execution time of the remaining branch node. For a use case graph set, the root use case tree corresponding to the second use case tree in the use case graph set is executed first, followed by the common use case tree corresponding to the second use case tree; Specifically, for the root use case tree and the common use case tree, when the execution machine corresponding to the use case graph reaches the branch node of the second use case tree, it executes the branches inside the second use case tree in the order of the number of common root use cases of the remaining branch nodes.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.