Test case processing method and apparatus, computing device, and computer storage medium

By constructing a knowledge graph of function call chains and using a graph convolutional neural network model, the problem of ineffective test case management and recommendation is solved, achieving more efficient test case management and recommendation.

CN115617652BActive Publication Date: 2025-11-11SHANGHAI HEHEHE CULTURE COMM CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211122847.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-15
Publication Date
2025-11-11
Estimated Expiration
2042-09-15

AI Technical Summary

Technical Problem

Existing technologies for test case management and recommendation are not effective enough, resulting in a narrow range of recommended test cases or duplication, which increases system storage overhead and management costs.

Method used

By generating a knowledge graph of function call chains and using a graph convolutional neural network model to perform deep learning on test cases, the similarity between test cases is calculated, redundant test cases are identified, and prompt information is generated.

Benefits of technology

It improves the accuracy and efficiency of test case management, reduces redundancy, saves storage resources, and enhances the comprehensiveness and accuracy of test case recommendations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115617652B_ABST
    Figure CN115617652B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a test case processing method and device, a computing device and a computer storage medium. The method comprises: determining a function contained in a to-be-tested item, obtaining a generated test case, and determining a function call link of any test case in the to-be-tested item; generating a first knowledge graph based on the function contained in the to-be-tested item, the obtained test case, and the function call link of the test case; inputting information of the first knowledge graph into a graph convolutional neural network model, and obtaining model output features of the test case output by the graph convolutional neural network model; and calculating a first similarity between test cases according to the model output features of the test cases. According to the present application, the similarity between test cases can be accurately determined, and the management and recommendation of test cases based on the similarity between test cases are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, specifically to a test case processing method, apparatus, computing device, and computer storage medium. Background Technology

[0002] With the continuous development of technology and society, the emergence of various internet products has greatly enriched people's work and life. In order to enable internet products to better serve users, they are usually tested before launch or in scenarios such as fault detection, in order to discover vulnerabilities in the internet products in a timely manner.

[0003] Test cases are a crucial part of the testing process. Existing technologies only record the association between test cases and test items, and manage and recommend test cases based on this association. However, this approach is not conducive to the management and recommendation of test cases. Summary of the Invention

[0004] In view of the technical problems in the prior art that are not conducive to the management and recommendation of test cases, embodiments of the present invention are proposed to provide a test case processing method, apparatus, computing device and computer storage medium that overcomes the above problems or at least partially solves the above problems.

[0005] According to a first aspect of the present invention, a test case processing method is provided, comprising:

[0006] Determine the functions contained in the item to be tested;

[0007] Obtain the generated test cases and determine the function call chain of any test case in the item to be tested;

[0008] A first knowledge graph is generated based on the functions contained in the item to be tested, the obtained test cases, and the function call chain of the test cases;

[0009] The information from the first knowledge graph is input into the graph convolutional neural network model, and the model output features of the test cases output by the graph convolutional neural network model are obtained.

[0010] Calculate the first similarity between the test cases based on the model output features of the test cases.

[0011] In an optional implementation, generating the first knowledge graph based on the functions contained in the item to be tested, the obtained test cases, and the function call chains of the test cases further includes:

[0012] For any function contained in the item to be tested, generate the function node corresponding to that function;

[0013] For any given test case, generate the corresponding test case node.

[0014] Based on the function call chain of any test case, determine the source function of the function call chain and establish the node edge between the test case node corresponding to the test case and the function node corresponding to the source function; and determine any two functions with a call relationship in the function call chain and establish the node edge between the function nodes corresponding to the two functions with a call relationship.

[0015] A first knowledge graph is generated based on the function nodes, the use case nodes, and the node edges.

[0016] In an optional implementation, inputting the information from the first knowledge graph into the graph convolutional neural network model further includes:

[0017] Extract the model input features of any test case from the first knowledge graph;

[0018] Input the model input features of any test case into the graph convolutional neural network model.

[0019] In an optional implementation, the step of extracting the model input features of any test case from the first knowledge graph further includes:

[0020] For any test case, the correlation degree between the test case node and each function node corresponding to the test case is calculated based on the first knowledge graph, and the model input features of the test case are generated according to the correlation degree with each function node.

[0021] In an optional implementation, the step of calculating the correlation between the test case node and each function node based on the first knowledge graph further includes:

[0022] For any function node, determine whether there is a connection path between the test case node corresponding to the test case and the function node in the first knowledge graph;

[0023] If so, determine the number of nodes in the connecting path between the use case node and the function node, and generate the correlation degree between the use case node and the function node based on the number of nodes; wherein, the correlation degree between the use case node and the function node is negatively correlated with the number of nodes in the connecting path between the use case node and the function node.

[0024] If not, then the correlation between the use case node and the function node is set to the preset value.

[0025] In an optional implementation, calculating the first similarity between the test cases based on the model output features of the test cases further includes:

[0026] The model output features of the test cases are dimensionality reduced to generate low-dimensional model output features;

[0027] The first similarity between the test cases is calculated based on the low-dimensional model output features of the test cases.

[0028] In an optional implementation, the method further includes: calculating the correlation between the functions contained in the item to be tested and the obtained test cases.

[0029] In an optional implementation, the calculation of the correlation between the functions contained in the item to be tested and the obtained test cases further includes;

[0030] For any test case and any function, calculate the correlation between the function and the test case based on the number of times the function is called by the test case.

[0031] And / or, based on the differences between the module to which the test case belongs and the module to which the function belongs, calculate the correlation between the function and the test case.

[0032] In an optional implementation, the method further includes:

[0033] The target function is determined from the functions contained in the item to be tested;

[0034] Based on the correlation between the objective function and the test cases, obtain the first type of recommended test cases for the objective function;

[0035] Based on the first similarity between the first type of recommended test cases and other test cases, a second type of recommended test cases for the objective function are obtained from the other test cases.

[0036] In an optional implementation, determining the target function from the functions contained in the item to be tested further includes:

[0037] Retrieve the test items that have been tested and completed;

[0038] The item to be tested is compared with the items that have been tested. The function in the item to be tested that is inconsistent with the items that have been tested is identified as the target function.

[0039] In one optional implementation, the method further includes: obtaining the overall function call chain of the item to be tested;

[0040] A second knowledge graph is generated based on the functions contained in the item to be tested, the obtained test cases, the overall function call chain, the first similarity between the test cases, and the correlation between the functions contained in the item to be tested and the obtained test cases.

[0041] In an optional implementation, the method further includes: identifying redundant test cases based on the second knowledge graph, and generating prompt information for the redundant test cases.

[0042] In an optional implementation, the method further includes: calculating a second similarity between test cases based on textual similarity between test cases;

[0043] The total similarity between test cases is calculated based on the first and second similarities between the test cases.

[0044] According to a second aspect of the present invention, a test case processing apparatus is provided, comprising:

[0045] The function determination module is used to determine the functions contained in the item to be tested;

[0046] The test case retrieval module is used to retrieve the generated test cases;

[0047] The function call chain determination module is used to determine the function call chain of any test case in the item to be tested.

[0048] The graph generation module is used to generate a first knowledge graph based on the functions contained in the item to be tested, the obtained test cases, and the function call chain of the test cases;

[0049] The input module is used to input the information of the first knowledge graph into the graph convolutional neural network model;

[0050] The feature acquisition module is used to acquire the model output features of the test cases output by the graph convolutional neural network model;

[0051] The similarity calculation module is used to calculate the first similarity between the test cases based on the model output features of the test cases.

[0052] In one optional implementation, the graph generation module is used to: generate a function node corresponding to any function contained in the item to be tested;

[0053] For any given test case, generate the corresponding test case node.

[0054] Based on the function call chain of any test case, determine the source function of the function call chain and establish the node edge between the test case node corresponding to the test case and the function node corresponding to the source function; and determine any two functions with a call relationship in the function call chain and establish the node edge between the function nodes corresponding to the two functions with a call relationship.

[0055] A first knowledge graph is generated based on the function nodes, the use case nodes, and the node edges.

[0056] In one alternative implementation, the input module is used to: extract model input features of any test case from the first knowledge graph;

[0057] Input the model input features of any test case into the graph convolutional neural network model.

[0058] In one optional implementation, the input module is configured to: for any test case, calculate the correlation degree between the test case node corresponding to the test case and each function node based on the first knowledge graph, and generate the model input features of the test case according to the correlation degree with each function node.

[0059] In one optional implementation, the input module is used to: for any function node, determine whether there is a connection path between the test case node corresponding to the test case and the function node in the first knowledge graph;

[0060] If so, determine the number of nodes in the connecting path between the use case node and the function node, and generate the correlation degree between the use case node and the function node based on the number of nodes; wherein, the correlation degree between the use case node and the function node is negatively correlated with the number of nodes in the connecting path between the use case node and the function node.

[0061] If not, then the correlation between the use case node and the function node is set to the preset value.

[0062] In one optional implementation, the similarity calculation module is used to: reduce the dimensionality of the model output features of the test cases to generate low-dimensional model output features;

[0063] The first similarity between the test cases is calculated based on the low-dimensional model output features of the test cases.

[0064] In an optional implementation, the device further includes a function-test case correlation calculation module, used to calculate the correlation between the functions contained in the test item and the obtained test cases.

[0065] In one optional implementation, the function-test case correlation calculation module is used to: for any test case and any function, calculate the correlation between the function and the test case based on the number of times the test case calls the function;

[0066] And / or, based on the differences between the module to which the test case belongs and the module to which the function belongs, calculate the correlation between the function and the test case.

[0067] In one alternative implementation, the apparatus further includes a recommendation module for determining a target function from the functions contained in the item to be tested;

[0068] Based on the correlation between the objective function and the test cases, obtain the first type of recommended test cases for the objective function;

[0069] Based on the first similarity between the first type of recommended test cases and other test cases, a second type of recommended test cases for the objective function are obtained from the other test cases.

[0070] In one alternative implementation, the recommendation module is used to: obtain the test items that have been tested;

[0071] The item to be tested is compared with the items that have been tested. The function in the item to be tested that is inconsistent with the items that have been tested is identified as the target function.

[0072] In one optional implementation, the graph generation module is used to: obtain the overall function call chain of the item to be tested;

[0073] A second knowledge graph is generated based on the functions contained in the item to be tested, the obtained test cases, the overall function call chain, the first similarity between the test cases, and the correlation between the functions contained in the item to be tested and the obtained test cases.

[0074] In one alternative implementation, the device further includes a management module for identifying redundant test cases based on the second knowledge graph and generating prompt information for the redundant test cases.

[0075] In one optional implementation, the similarity calculation module is used to: calculate a second similarity between test cases based on the textual similarity between test cases;

[0076] The total similarity between test cases is calculated based on the first and second similarities between the test cases.

[0077] According to a third aspect of the present invention, a computing device is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus;

[0078] The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the above test case processing method.

[0079] According to a fourth aspect of the present invention, a computer storage medium is provided, the storage medium storing at least one executable instruction, the executable instruction causing a processor to perform an operation corresponding to the test case processing method described above.

[0080] This invention identifies the functions contained in the item to be tested, obtains generated test cases, and determines the function call chain of any test case in the item to be tested. A first knowledge graph is generated based on the functions contained in the item to be tested, the obtained test cases, and the function call chains of the test cases. The information from the first knowledge graph is input into a graph convolutional neural network model, and the model output features of the test cases output by the graph convolutional neural network model are obtained. Based on the model output features of the test cases, a first similarity between the test cases is calculated. This accurately determines the similarity between test cases, facilitating the management and recommendation of test cases based on their similarity.

[0081] In constructing the first knowledge graph, this invention determines the source function of any test case's function call chain and establishes node edges between the test case node and the function node corresponding to the source function; it also determines any two functions with a call relationship in the function call chain and establishes node edges between the function nodes corresponding to the two functions with a call relationship. This allows the first knowledge graph to accurately describe the function call chain of the test case, facilitating the improvement of the accuracy of subsequent first similarity calculations.

[0082] Specifically, in this embodiment of the invention, the model input features of any test case are extracted from the first knowledge graph, and the model input features of any test case are input into the graph convolutional neural network model. This enables the graph convolutional neural network model to perform deep learning and mining of test cases, thereby improving the feature extraction accuracy of the graph convolutional neural network model.

[0083] In this embodiment of the invention, the correlation degree between the test case node and each function node corresponding to the test case is calculated based on the first knowledge graph, and the model input features of the test case are generated according to the correlation degree with each function node, thereby improving the matching degree between the model input features and the test case characteristics.

[0084] In this embodiment of the invention, for test case nodes and function nodes with connected paths, the correlation degree between the test case node and the function node is generated based on the number of nodes and edges. For test case nodes and function nodes without connected paths, the correlation degree is determined to a preset value, thereby enabling the correlation degree to truly reflect the strength of the association between the function and the test case.

[0085] This invention improves the computational efficiency of the first similarity between test cases and saves system resources by performing dimensionality reduction on the model output features.

[0086] In this embodiment of the invention, the correlation between the functions contained in the item to be tested and the obtained test cases is calculated, thereby facilitating test case management and recommendation based on the correlation.

[0087] In this embodiment of the invention, for any test case and any function, the correlation between the function and the test case is calculated based on the number of times the function is called by the test case; and / or, the correlation between the function and the test case is calculated based on the difference between the module to which the test case belongs and the module to which the function belongs, thereby accurately determining the correlation strength between the function and the test case.

[0088] In this embodiment of the invention, a target function is determined from the functions contained in the item to be tested. Based on the correlation between the target function and the test cases, a first type of recommended test cases for the target function are obtained. Based on the first similarity between the first type of recommended test cases and other test cases, a second type of recommended test cases for the target function are obtained from other test cases. This enables the recommendation of comprehensive test cases to the item to be tested, thereby improving the testing effect of the item to be tested.

[0089] In this embodiment of the invention, the tested items that have been tested are obtained, the item to be tested is compared with the tested items that have been tested, and the function in the item to be tested that is inconsistent with the tested items that have been tested is determined as the target function, thereby realizing incremental testing of the item to be tested and improving the testing efficiency of the item to be tested.

[0090] This invention obtains the overall function call chain of the item to be tested, and generates a second knowledge graph based on the functions contained in the item to be tested, the obtained test cases, the overall function call chain, the first similarity between the test cases, and the correlation between the functions contained in the item to be tested and the obtained test cases, thereby facilitating efficient and accurate management of functions and test cases based on the second knowledge graph.

[0091] The embodiments of the present invention identify redundant test cases based on a second knowledge graph and generate prompt information for redundant test cases, which can facilitate the simplification of the number of test cases and save storage and management resources.

[0092] In this embodiment of the invention, a second similarity between test cases is calculated based on the textual similarity between test cases; the total similarity between test cases is calculated based on the first similarity and the second similarity, thereby enabling a more accurate determination of the similarity between test cases.

[0093] The above description is merely an overview of the technical solutions of the embodiments of the present invention. In order to better understand the technical means of the embodiments of the present invention and to implement them in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the embodiments of the present invention more apparent and understandable, specific implementation methods of the embodiments of the present invention are described below. Attached Figure Description

[0094] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the embodiments of the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0095] Figure 1 A flowchart illustrating a test case processing method provided by an embodiment of the present invention is shown;

[0096] Figure 2 A schematic diagram of a first knowledge graph provided by an embodiment of the present invention is shown;

[0097] Figure 3 The diagram illustrates a flowchart of a method for determining the association degree between use case nodes and function nodes according to an embodiment of the present invention.

[0098] Figure 4 A flowchart illustrating another test case processing method provided by an embodiment of the present invention is shown;

[0099] Figure 5 A flowchart illustrating another test case processing method provided by an embodiment of the present invention is shown;

[0100] Figure 6 This diagram illustrates the structure of a test case processing device provided in an embodiment of the present invention.

[0101] Figure 7 A schematic diagram of the structure of a computing device provided in an embodiment of the present invention is shown. Detailed Implementation

[0102] Exemplary embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present invention are shown in the drawings, it should be understood that the embodiments of the present invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this understanding of the embodiments of the present invention will be thorough and complete, and will fully convey the scope of the embodiments of the present invention to those skilled in the art.

[0103] Existing technologies, when processing test cases, only record the association between test cases and test items. For example, they only record which version of code a test case is used to test. However, relying solely on the association between test cases and code versions can lead to drawbacks when recommending test cases for different code versions, such as a narrow range of recommendations or duplicate recommendations. Furthermore, due to the influence of the test case compiler, the generated test cases often contain duplicates, increasing system storage overhead and management costs.

[0104] In view of this, embodiments of the present invention generate a knowledge graph based on the function call path of test cases, and use a graph convolutional neural network model to perform deep learning on the knowledge graph to mine the call characteristics of test cases, thereby accurately obtaining the similarity of test cases in terms of functions, etc., which facilitates the recommendation and management of test cases based on the similarity.

[0105] The following embodiments illustrate the solutions of the present invention in detail.

[0106] Figure 1 The diagram shows a flowchart of a test case processing method provided by an embodiment of the present invention.

[0107] In this embodiment, the flowchart is not intended to limit the order of execution steps. Steps in the flowchart can be added to or removed as needed.

[0108] Specifically, such as Figure 1 As shown, the method includes the following steps:

[0109] Step S110: Determine the functions contained in the item to be tested.

[0110] The item to be tested is the code that needs to be tested using test cases. For example, the item to be tested could be a new version of the entire Internet product code, or it could be a new feature code, etc.

[0111] The item to be tested consists of at least one function. This step obtains each function contained in the item to be tested using appropriate methods. This embodiment of the invention does not limit the specific method of obtaining these functions; for example, static code scanning can be used to obtain each function in the item to be tested.

[0112] Step S120: Obtain the generated test cases and determine the function call chain of any test case in the item to be tested.

[0113] This invention relates to a method for determining the similarity between generated test cases, thereby obtaining the generated test cases in this step. This invention does not limit the specific method of test case generation; for example, the test cases can be manually written or automatically generated.

[0114] During the testing process of the item under test, test cases call functions in the item under test. The functions called by the test cases form a function call chain in the item under test through their mutual calling relationships. Thus, the function call chain of the test cases contains the calling relationships of the functions in the item under test associated with that test case.

[0115] In one optional implementation, the function call chain of a test case is obtained as follows: instrumenting the code of the item to be tested, running the test case after instrumentation, and collecting the functions called by the test case during execution and the call relationships between those functions. This method accurately obtains the function call chain of the test case within the item to be tested, providing a foundation for accurately determining the similarity between test cases. Alternatively, the interfaces accessed by the test case during execution can be collected, and the function call chain can be generated based on the function call relationships corresponding to those interfaces.

[0116] Step S130: Generate a first knowledge graph based on the functions contained in the item to be tested, the obtained test cases, and the function call chain of the test cases.

[0117] The knowledge graph generated based on the functions contained in the item to be tested, the obtained test cases, and the function call chain of the test cases is the first knowledge graph. This first knowledge graph contains function information, test case information, and function call chain information.

[0118] In one optional implementation, the first knowledge graph is generated as follows: for any function included in the item to be tested, a function node corresponding to that function is generated; for any acquired test case, a test case node corresponding to that test case is generated; based on the function call chain of any test case, the source function of the function call chain is determined, and a node edge is established between the test case node corresponding to the test case and the function node corresponding to the source function; and, any two functions with a call relationship in the function call chain are determined, and a node edge is established between the function nodes corresponding to the two functions with a call relationship; the first knowledge graph is generated based on the function nodes, test case nodes, and node edges.

[0119] In practical implementation, a knowledge graph consists of nodes (also known as entities) and node edges (also known as entity relationships). In this generation method, specifically, function nodes are generated for each function in the test item, thus each function node corresponds to a function in the test item; and test case nodes are generated for each test case, thus each test case node corresponds to a test case. When generating node edges, specifically for each test case's function call chain, a node edge is established between the function node corresponding to the source function in the function call chain and the test case node corresponding to that test case. The source function is specifically a function in the function call chain that has no upstream function; that is, the source function is the starting function in the function call chain. Furthermore, since the function call chain includes call relationships between functions, node edges are established between function nodes corresponding to functions with call relationships.

[0120] For example, if the function call chain of test case 1 is "function A → function C → function D", and the function call chain of test case 2 is "function B → function D", then the visualization result of the generated first knowledge graph is as follows: Figure 2 As shown. Figure 2 In the table, case1 is the test case node corresponding to test case 1, case2 is the test case node corresponding to test case 2, and funcA, funcB, funcC, and funcD are the function nodes corresponding to functions A, B, C, and D, respectively. Figure 2 In this context, directed edges correspond to node edges. For example, the directed edge between case1 and funcA corresponds to the node edge between the test case node corresponding to test case1 and the source function A in its function call chain; the directed edge between funcB and funcD corresponds to the node edge between function B and function D, that is, in the function call chain, function B calls function D, in other words, function B is the upstream function of function D.

[0121] Step S140: Input the information of the first knowledge graph into the graph convolutional neural network model, and obtain the model output features of the test cases output by the graph convolutional neural network model.

[0122] After obtaining the first knowledge graph, in order to further explore the characteristics of the test cases, this embodiment of the invention uses a graph convolutional network (GCN) model to further process the first knowledge graph. The features of the test cases output by the graph convolutional network model are the model output features of the test cases.

[0123] This graph convolutional neural network model is a deep learning model capable of processing graph data. This embodiment of the invention does not limit the specific structure or training parameters of the graph convolutional neural network model. For example, the graph convolutional neural network model may contain three neural network layers, and the propagation methods between network layers include, but are not limited to, the propagation methods shown in Equation 1:

[0124] X′=σ(L sym XW) (Formula 1)

[0125] In Formula 1, X' is the feature of the next layer, X is the feature of the current layer, W is the weight of the current layer, σ is the non-linear activation function, and L... sym It is a Laplace matrix.

[0126] The loss function used in the graph convolutional neural network model includes, but is not limited to, the loss function shown in Equation 2:

[0127] H (p,q) =-∑ x p(x)logq(x) (Formula 2)

[0128] In Formula 2, H (p,q) Let p(x) be the loss function, p(x) be the true probability distribution, and p(x) be the predicted probability distribution.

[0129] Furthermore, the optimizer of this graph convolutional neural network model includes, but is not limited to, the Adam optimizer. The learning rate parameter (LEARNING_RATE), weight decay parameter (WEIGHT_DACAY), and iteration count parameter can be set by those skilled in the art according to actual needs, and this embodiment of the invention does not limit these settings. For example, LEARNING_RATE = 0.1, WEIGHT_DACAY = 5e -4 The number of iterations is 50, etc.

[0130] In one optional implementation, when processing the first knowledge graph using the constructed graph convolutional neural network model, specifically, the model input features of any test case are extracted from the first knowledge graph, and then the model input features of any test case are input into the graph convolutional neural network model. In this implementation, the features of the test case nodes in the first knowledge graph are used as the input data of the graph convolutional neural network model, and this input data is the model input feature of any test case.

[0131] The model input features of the test cases include the call correlation between the test cases and various functions in the first knowledge graph. Specifically, when extracting model input features, for any test case, the correlation between the test case node corresponding to the test case and each function node is calculated based on the first knowledge graph, and the model input features of the test case are generated based on the correlation with each function node.

[0132] Further, optionally, the correlation between use case nodes and function nodes can be determined by... Figure 3 Steps S141-S143 show the following results:

[0133] S141. For any function node, determine whether there is a connected path between the test case node corresponding to the test case and the function node in the first knowledge graph; if yes, proceed to step S142; if no, proceed to step S143.

[0134] In the first knowledge graph, the nodes are directed edges, and connections between nodes can be achieved through the directions of each directed edge. If there is no connection path between a test case node and a function node, then step S143 is executed; if there is a connection path between a test case node and a function node, then step S142 is executed.

[0135] S142, determine the number of node edges in the connection path between the use case node and the function node, and generate the correlation degree between the use case node and the function node based on the number of node edges; wherein, the correlation degree between the use case node and the function node is negatively correlated with the number of node edges in the connection path between the use case node and the function node.

[0136] The connection path between a test case node and the function node can consist of one or more node edges. A larger number of node edges in the connection path indicates that the test case needs to be called multiple times before the function corresponding to that function node can be invoked, thus indicating a weaker call correlation. Based on this, this step calculates the number of node edges in the connection path between the test case node and the function node, and determines the corresponding correlation based on this number of node edges. The correlation is negatively correlated with the number of node edges; that is, the more node edges, the lower the correlation, and the fewer node edges, the higher the correlation.

[0137] Optionally, if a connection path exists between a use case node and a function node, there may be one or more connection paths between them. If multiple connection paths exist, the shortest connection path between the use case node and the function node is determined, and the association degree between the use case node and the function node is determined based on the number of nodes and edges in the shortest connection path, thereby accurately determining the association strength between the use case node and the function node.

[0138] S143, Determine the correlation between the use case node and the function node to be a preset value.

[0139] If there is no connection path between the use case node and the function node, the correlation between the use case node and the function node is directly determined to a preset value. This preset value is less than the correlation determined in step S142; for example, the preset value can be 0.

[0140] Alternatively, to facilitate subsequent model processing, after obtaining the correlation degree, the correlation degree can be further normalized to obtain the model input features of the test cases based on the normalization result of the correlation degree.

[0141] by Figure 2 For example, if test case node 'case1' in test case 1 can reach function nodes 'funcA', 'funcC', and 'funcD' sequentially via directed edges in the graph, it indicates that test case node 'case1' has connected paths with function nodes 'funcA', 'funcC', and 'funcD' respectively. However, after reaching 'funcD' via 'funcA' and 'funcC', test case node 'case1' cannot reach function node 'funcB' via directed edges in the graph, indicating that there is no connected path between test case node 'case1' and function node 'funcB'. Furthermore, the number of nodes and edges in the connected paths between test case node 'case1' and function node 'funcA' is 1, between test case node 'case1' and function node 'funcC' is 2, and between test case node 'case1' and function node 'funcD' is 3. Therefore, the correlation degree can be determined using the formula: Correlation Degree = (Number of Highest Node Edges + 1 - Number of Node Edges in Connected Paths). In this example, the highest node has 3 edges. Therefore, the association degrees between the test case node case1 and the function nodes funcA, funcC, and funcD are 3, 2, and 1, respectively, while the association degree between the test case node case1 and the function node funcB is 0. After further normalization, the association degrees between the test case node case1 and the function nodes funcA, funcB, funcC, and funcD are 3 / 4, 0, 2 / 4, and 1 / 4, respectively.

[0142] Correspondingly, there is no connected path between test case node case2 and function nodes funcA and funcC, so the normalized correlation degree is 0. Test case node case2 and function node funcB have a connected path containing one node edge, and their corresponding normalized correlation degree is (4-1) / 4. Test case node case2 and function node funcD have a connected path containing two node edges, and their corresponding normalized correlation degree is (4-2) / 4. Therefore, based on... Figure 2The correlation degrees between case1 and case2 obtained from the graph and the function nodes funcA, funcB, funcC, and funcD after normalization are shown in Table 1.

[0143] Table 1

[0144] funcA funcB funcC funcD caseA 3 / 4 0 2 / 4 1 / 4 case B 0 3 / 4 0 2 / 4

[0145] After obtaining the model input features of the test cases, these features are input into the graph convolutional neural network (GNN) model. Specifically, each test case corresponds to M correlations (M being the number of function nodes). If there are N test cases, the input data of the GNN model is an N*M matrix. The GNN model processes and analyzes the input data to further explore the calling characteristics of the test cases, and outputs the model output features of the test cases after processing.

[0146] Step S150: Calculate the first similarity between test cases based on the model output features of the test cases.

[0147] For any two test cases, the first similarity between the two test cases is calculated based on the model output features of the two test cases. That is, the first similarity is obtained by calculating based on the model output features of the test cases.

[0148] In one optional implementation, the model output features of the test cases are high-dimensional features. To quickly calculate the first similarity between test cases, this embodiment of the invention, after obtaining the model output features of the test cases, performs dimensionality reduction processing on the model output features to generate low-dimensional model output features, and calculates the first similarity between test cases based on the low-dimensional model output features. For example, dimensionality reduction algorithms such as TSNE can be used for dimensionality reduction processing, and the first similarity between test cases can be obtained by calculating the Euclidean distance and other distances of the low-dimensional model output features of the test cases.

[0149] Therefore, the embodiments of the present invention obtain first similarity information between test cases, thereby facilitating the management and recommendation of test cases based on the first similarity information between test cases; moreover, the embodiments of the present invention generate a first knowledge graph based on the functions contained in the test item, the obtained test cases, and the function call chain of the test cases, and use a graph convolutional neural network model to analyze the first knowledge graph to obtain the model output features of the test cases, and finally calculate the first similarity between test cases based on the model output features of the test cases, thereby accurately determining the similarity between test cases.

[0150] Figure 4A flowchart illustrating another test case processing method provided by an embodiment of the present invention is shown.

[0151] In this embodiment, the flowchart is not intended to limit the order of execution steps. Steps in the flowchart can be added to or removed as needed.

[0152] Specifically, such as Figure 4 As shown, the method includes the following steps:

[0153] Step S410: Determine the functions contained in the item to be tested and obtain the generated test cases.

[0154] Step S420: Calculate the correlation between the functions contained in the item to be tested and the obtained test cases.

[0155] This step calculates the correlation between the function and the test case. Specifically, for any test case and any function, the correlation between the function and the test case is calculated based on the number of times the function is called by the test case. The correlation between the function and the test case is positively correlated with the number of calls; that is, the higher the number of calls, the higher the correlation, and vice versa.

[0156] And / or, based on the differences between the module to which the test case belongs and the module to which the function belongs, the correlation between the function and the test case is calculated. Specifically, when generating test cases, corresponding business module tags are usually assigned to the test cases to identify that the test case is mainly used to test that business module; correspondingly, functions also have modules to which they belong. If the differences between the module to which the test case belongs and the module to which the function belongs are small, the corresponding correlation is high, that is, the correlation is negatively correlated with the differences between the module to which the test case belongs and the module to which the function belongs.

[0157] Step S430: Calculate the first similarity between test cases.

[0158] The specific method for obtaining the first similarity can be found in the descriptions of other method embodiments, and will not be repeated here.

[0159] In an optional implementation, a second similarity between test cases can be calculated based on the textual similarity between them, and a total similarity between test cases can be calculated based on the first and second similarities. Specifically, the first and second similarities are weighted and summed according to their corresponding weights to obtain the total similarity between test cases. This total similarity reflects the degree of similarity between test cases in terms of both functionality and text, thereby improving the accuracy of the similarity between test cases.

[0160] Step S440: Determine the target function from the functions contained in the item to be tested.

[0161] In one alternative implementation, when it is necessary to test the item to be tested, all functions in the item to be tested can be identified as target functions, thereby performing a full test on the item to be tested.

[0162] In another optional implementation, already tested test items are obtained, and the item to be tested is compared with the already tested test items. Functions in the item to be tested that are inconsistent with the already tested test items are identified as target functions. This way, only a portion of the functions in the item to be tested need to be tested, improving the testing efficiency of the item to be tested and saving system resources. For example, if the item to be tested is a new version of code, the old version of code that was most recently tested can be obtained. The new version of code is then compared with the old version of code to identify the changes in the new version of code compared to the old version of code, and the function corresponding to the changed part is then determined. The function corresponding to the changed part is the target function.

[0163] Step S450: Based on the correlation between the objective function and the test cases, obtain the first type of recommended test cases for the objective function.

[0164] Recommended test cases are selected from the generated test cases and are used to test the target function. This step first obtains recommended test cases based on the relevance between the target function and the test cases; these recommended test cases are the first type of recommended test cases. Specifically, n test cases with high relevance can be selected as the first type of recommended test cases.

[0165] Step S460: Based on the first similarity between the first type of recommended test cases and other test cases, obtain the second type of recommended test cases for the objective function from the other test cases.

[0166] Relying solely on the first type of recommended test cases is insufficient to comprehensively test the target function. Therefore, this embodiment of the invention further obtains a second type of recommended test cases for the target function from other test cases based on the first similarity between the first type of recommended test cases and other test cases. That is, the second type of recommended test cases are obtained from test cases different from the first type of recommended test cases, and are selected based on the similarity between test cases (this similarity can be either the first similarity or the total similarity). For example, 80 test cases with high relevance to the target function can be selected as the first type of recommended test cases, and the top 10 test cases with the highest relevance to the target function can be determined. Then, for any test case among the top 10 test cases, 10 test cases with high similarity to that test case are obtained as the second type of recommended test cases.

[0167] Therefore, the embodiments of the present invention recommend test cases for the items to be tested based on the correlation between functions and test cases, as well as the correlation between test cases, thereby facilitating comprehensive testing of the items to be tested, improving the test case recommendation effect, and improving the testing effect.

[0168] Figure 5 A flowchart illustrating another test case processing method provided by an embodiment of the present invention is shown.

[0169] In this embodiment, the flowchart is not intended to limit the order of execution steps. Steps in the flowchart can be added to or removed as needed.

[0170] Specifically, such as Figure 5 As shown, the method includes the following steps:

[0171] Step S510: Determine the functions contained in the item to be tested and obtain the generated test cases.

[0172] Step S520: Calculate the first similarity between test cases, calculate the correlation between the functions contained in the item to be tested and the obtained test cases, and obtain the overall function call chain of the item to be tested.

[0173] When obtaining the overall function call chain of the item to be tested, a static scan can be performed on the item to obtain the overall function call chain. The specific methods for calculating the first similarity between test cases and the correlation between the functions contained in the item to be tested and the obtained test cases can be referred to the descriptions in other method embodiments, and will not be repeated here.

[0174] Step S530: Generate a second knowledge graph based on the functions contained in the item to be tested, the obtained test cases, the overall function call chain, the first similarity between test cases, and the correlation between the functions contained in the item to be tested and the obtained test cases.

[0175] Specifically, for any function contained in the item to be tested, a function node corresponding to that function is generated; for any obtained test case, a test case node corresponding to that test case is generated.

[0176] Based on the overall function call chain, identify the functions with calling relationships and create node edges corresponding to the function nodes of these functions. The direction of these node edges is determined by the calling relationship. For example, if function A calls function B, the direction of the generated node edge will be: the function node corresponding to function A points to the function node corresponding to function B.

[0177] Node edges between test case nodes are established based on either the first similarity between test cases or the total similarity between test cases. Specifically, for any two test cases, if the first similarity or total similarity of the test cases is higher than a preset similarity threshold, then node edges are established between the corresponding test case nodes of the two test cases. The direction of these node edges is bidirectional; that is, in this embodiment of the invention, only node edges between test cases with high similarity are established.

[0178] The correlation between the functions included in the test item and the obtained test cases establishes node edges between function nodes and test case nodes. Specifically, for any test case and any function, if the correlation between the test case and the function is greater than a preset correlation threshold, then a node edge is established between the test case node corresponding to the test case and the function node corresponding to the function.

[0179] Step S540: Manage test cases based on the second knowledge graph.

[0180] The second knowledge graph can comprehensively and accurately reflect the relationships between functions, between functions and test cases, and between test cases. Based on this second knowledge graph, test cases can be managed better.

[0181] In one optional implementation, redundant test cases are identified based on a second knowledge graph, and prompts for redundant test cases are generated, allowing relevant personnel to process the redundant test cases based on these prompts. Specifically, if an isolated test case node exists in the second knowledge graph, that test case node is determined to be a redundant node; or, if a test case in the second knowledge graph has a high similarity to another test case, and both test cases have the same degree of association with the function, then the two test cases are determined to be duplicate test cases, and one of the test cases is identified as a redundant test case.

[0182] In one optional implementation, the first and second knowledge graphs generated in this invention can be stored in a corresponding graph engine (such as the Neo4j engine), thereby improving the efficiency of searching and managing knowledge graph data.

[0183] Therefore, the embodiments of the present invention generate a second knowledge graph based on the functions contained in the test item, the obtained test cases, the overall function call chain, the first similarity between test cases, and the correlation between the functions contained in the test item and the generated test cases. This second knowledge graph can comprehensively reflect the relevant information of functions and test cases, thereby facilitating the management of test cases.

[0184] Figure 6 This diagram illustrates the structure of a test case processing device provided in an embodiment of the present invention. Figure 6As shown, the device 600 includes:

[0185] Function determination module 610 is used to determine the functions contained in the item to be tested;

[0186] The test case acquisition module 620 is used to acquire the generated test cases;

[0187] Link determination module 630 is used to determine the function call link of any test case in the item to be tested;

[0188] The graph generation module 640 is used to generate a first knowledge graph based on the functions contained in the item to be tested, the obtained test cases, and the function call chain of the test cases;

[0189] The input module 650 is used to input the information of the first knowledge graph into the graph convolutional neural network model;

[0190] The feature acquisition module 660 is used to acquire the model output features of the test cases output by the graph convolutional neural network model.

[0191] The similarity calculation module 670 is used to calculate the first similarity between the test cases based on the model output features of the test cases.

[0192] In one optional implementation, the graph generation module is used to: generate a function node corresponding to any function contained in the item to be tested;

[0193] For any given test case, generate the corresponding test case node.

[0194] Based on the function call chain of any test case, determine the source function of the function call chain and establish the node edge between the test case node corresponding to the test case and the function node corresponding to the source function; and determine any two functions with a call relationship in the function call chain and establish the node edge between the function nodes corresponding to the two functions with a call relationship.

[0195] A first knowledge graph is generated based on the function nodes, the use case nodes, and the node edges.

[0196] In one alternative implementation, the input module is used to: extract model input features of any test case from the first knowledge graph;

[0197] Input the model input features of any test case into the graph convolutional neural network model.

[0198] In one optional implementation, the input module is configured to: for any test case, calculate the correlation degree between the test case node corresponding to the test case and each function node based on the first knowledge graph, and generate the model input features of the test case according to the correlation degree with each function node.

[0199] In one optional implementation, the input module is used to: for any function node, determine whether there is a connection path between the test case node corresponding to the test case and the function node in the first knowledge graph;

[0200] If so, determine the number of nodes in the connecting path between the use case node and the function node, and generate the correlation degree between the use case node and the function node based on the number of nodes; wherein, the correlation degree between the use case node and the function node is negatively correlated with the number of nodes in the connecting path between the use case node and the function node.

[0201] If not, then the correlation between the use case node and the function node is set to the preset value.

[0202] In one optional implementation, the similarity calculation module is used to: reduce the dimensionality of the model output features of the test cases to generate low-dimensional model output features;

[0203] The first similarity between the test cases is calculated based on the low-dimensional model output features of the test cases.

[0204] In an optional implementation, the device further includes a function-test case correlation calculation module, used to calculate the correlation between the functions contained in the test item and the obtained test cases.

[0205] In one optional implementation, the function-test case correlation calculation module is used to: for any test case and any function, calculate the correlation between the function and the test case based on the number of times the test case calls the function;

[0206] And / or, based on the differences between the module to which the test case belongs and the module to which the function belongs, calculate the correlation between the function and the test case.

[0207] In one alternative implementation, the apparatus further includes a recommendation module for determining a target function from the functions contained in the item to be tested;

[0208] Based on the correlation between the objective function and the test cases, obtain the first type of recommended test cases for the objective function;

[0209] Based on the first similarity between the first type of recommended test cases and other test cases, a second type of recommended test cases for the objective function are obtained from the other test cases.

[0210] In one alternative implementation, the recommendation module is used to: obtain the test items that have been tested;

[0211] The item to be tested is compared with the items that have been tested. The function in the item to be tested that is inconsistent with the items that have been tested is identified as the target function.

[0212] In one optional implementation, the graph generation module is used to: obtain the overall function call chain of the item to be tested;

[0213] A second knowledge graph is generated based on the functions contained in the item to be tested, the obtained test cases, the overall function call chain, the first similarity between the test cases, and the correlation between the functions contained in the item to be tested and the obtained test cases.

[0214] In one alternative implementation, the device further includes a management module for identifying redundant test cases based on the second knowledge graph and generating prompt information for the redundant test cases.

[0215] In one optional implementation, the similarity calculation module is used to: calculate a second similarity between test cases based on the textual similarity between test cases;

[0216] The total similarity between test cases is calculated based on the first and second similarities between the test cases.

[0217] Therefore, the embodiments of the present invention can accurately determine the similarity between test cases, which facilitates the management and recommendation of test cases based on the similarity between them.

[0218] Figure 7 This diagram illustrates the structure of a computing device according to an embodiment of the present invention. The specific embodiments of the present invention do not limit the specific implementation of the computing device.

[0219] like Figure 7 As shown, the computing device may include: a processor 702, a communications interface 704, a memory 706, and a communications bus 708.

[0220] The processor 702, communication interface 704, and memory 706 communicate with each other via communication bus 708. Communication interface 704 is used to communicate with other network elements, such as clients or other computing devices. Processor 702 executes program 710, specifically performing the relevant steps described in the test case processing method embodiment.

[0221] Specifically, program 710 may include program code that includes computer operation instructions.

[0222] The processor 702 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention. The computing device includes one or more processors, which may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0223] Memory 706 is used to store program 710. Memory 706 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device. Specifically, program 710 can be used to cause processor 702 to execute the test case processing method in any of the above method embodiments.

[0224] This invention provides a non-volatile computer storage medium storing at least one executable instruction that can execute the test case processing method in any of the above method embodiments.

[0225] The specific implementation process of the above-mentioned device embodiments, equipment embodiments and storage medium embodiments can be referred to the description in the method embodiments, and will not be repeated here.

[0226] The algorithms or displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, the embodiments of the present invention are not directed to any particular programming language. It should be understood that the embodiments of the present invention described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of the embodiments of the present invention.

[0227] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0228] Similarly, it should be understood that, in order to streamline the embodiments of the invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the invention, various features of the embodiments of the invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, this disclosure should not be construed as reflecting an intention that the claimed embodiments of the invention require more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into this detailed description, wherein each claim itself is a separate embodiment of the invention.

[0229] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.

[0230] Furthermore, those skilled in the art will understand that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the embodiments of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.

[0231] The various component embodiments of the present invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components according to the embodiments of the present invention. The embodiments of the present invention can also be implemented as device or apparatus programs (e.g., computer programs and computer program products) for performing part or all of the methods described herein. Such programs implementing the embodiments of the present invention can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

[0232] It should be noted that the above embodiments are illustrative of the present invention and not restrictive of the present invention, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. Embodiments of the present invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be construed as limiting the order of execution.

Claims

1. A test case processing method, characterized in that, include: Determine the functions contained in the item to be tested; Obtain the generated test cases and determine the function call chain of any test case in the item to be tested; For any function included in the item to be tested, generate the function node corresponding to that function; for any obtained test case, generate the test case node corresponding to that test case. Based on the function call chain of any test case, determine the source function of the function call chain, and establish the node edge between the test case node corresponding to the test case and the function node corresponding to the source function; Identify any two functions with a calling relationship in the function call chain, and establish node edges between the function nodes corresponding to these two functions with a calling relationship; The first knowledge graph is generated based on function nodes, test case nodes, and node edges; The information from the first knowledge graph is input into the graph convolutional neural network model, and the model output features of the test cases output by the graph convolutional neural network model are obtained. Calculate the first similarity between the test cases based on the model output features of the test cases.

2. The method according to claim 1, characterized in that, The step of inputting the information from the first knowledge graph into the graph convolutional neural network model further includes: Extract the model input features of any test case from the first knowledge graph; Input the model input features of any test case into the graph convolutional neural network model.

3. The method according to claim 2, characterized in that, The step of extracting the model input features of any test case from the first knowledge graph further includes: For any test case, the correlation degree between the test case node and each function node corresponding to the test case is calculated based on the first knowledge graph, and the model input features of the test case are generated according to the correlation degree with each function node.

4. The method according to claim 3, characterized in that, The step of calculating the correlation between the test case node and each function node corresponding to the test case based on the first knowledge graph further includes: For any function node, determine whether there is a connection path between the test case node corresponding to the test case and the function node in the first knowledge graph; If so, determine the number of nodes in the connecting path between the use case node and the function node, and generate the correlation degree between the use case node and the function node based on the number of nodes; wherein, the correlation degree between the use case node and the function node is negatively correlated with the number of nodes in the connecting path between the use case node and the function node. If not, then the correlation between the use case node and the function node is set to the preset value.

5. The method according to any one of claims 1-4, characterized in that, The step of calculating the first similarity between the test cases based on the model output features of the test cases further includes: The model output features of the test cases are dimensionality reduced to generate low-dimensional model output features; The first similarity between the test cases is calculated based on the low-dimensional model output features of the test cases.

6. The method according to any one of claims 1-4, characterized in that, The method further includes: Calculate the correlation between the functions contained in the item to be tested and the obtained test cases.

7. The method according to claim 6, characterized in that, The calculation of the correlation between the functions contained in the item to be tested and the obtained test cases further includes; For any test case and any function, calculate the correlation between the function and the test case based on the number of times the function is called by the test case. And / or, based on the differences between the module to which the test case belongs and the module to which the function belongs, calculate the correlation between the function and the test case.

8. The method according to claim 6, characterized in that, The method further includes: The target function is determined from the functions contained in the item to be tested; Based on the correlation between the objective function and the test cases, obtain the first type of recommended test cases for the objective function; Based on the first similarity between the first type of recommended test cases and other test cases, a second type of recommended test cases for the objective function are obtained from the other test cases.

9. The method according to claim 8, characterized in that, The step of determining the target function from the functions contained in the item to be tested further includes: Retrieve the test items that have been tested and completed; The item to be tested is compared with the items that have been tested. The function in the item to be tested that is inconsistent with the items that have been tested is identified as the target function.

10. The method according to claim 6, characterized in that, The method further includes: Obtain the complete function call chain of the item to be tested; A second knowledge graph is generated based on the functions contained in the item to be tested, the obtained test cases, the overall function call chain, the first similarity between the test cases, and the correlation between the functions contained in the item to be tested and the obtained test cases.

11. The method according to claim 10, characterized in that, The method further includes: Redundant test cases are identified based on the second knowledge graph, and prompt information for the redundant test cases is generated.

12. The method according to any one of claims 1-4, characterized in that, The method further includes: Calculate the second similarity between test cases based on the text similarity between them; The total similarity between test cases is calculated based on the first and second similarities between the test cases.

13. A test case processing device, characterized in that, include: The function determination module is used to determine the functions contained in the item to be tested; The test case retrieval module is used to retrieve the generated test cases; The function call chain determination module is used to determine the function call chain of any test case in the item to be tested. The graph generation module is used to generate a function node corresponding to any function contained in the item to be tested; and to generate a test case node corresponding to any obtained test case. Based on the function call chain of any test case, determine the source function of the function call chain, and establish the node edge between the test case node corresponding to the test case and the function node corresponding to the source function; Identify any two functions with a calling relationship in the function call chain, and establish node edges between the function nodes corresponding to these two functions with a calling relationship; The first knowledge graph is generated based on function nodes, test case nodes, and node edges; The input module is used to input the information of the first knowledge graph into the graph convolutional neural network model; The feature acquisition module is used to acquire the model output features of the test cases output by the graph convolutional neural network model; The similarity calculation module is used to calculate the first similarity between the test cases based on the model output features of the test cases.

14. A computing device, characterized in that, include: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the test case processing method as described in any one of claims 1-12.

15. A computer storage medium, characterized in that, The storage medium stores at least one executable instruction, which causes the processor to perform the operation corresponding to the test case processing method as described in any one of claims 1-12.

16. A computer program product, characterized in that, The computer program product is used to cause the processor to perform the operation corresponding to the test case processing method as described in any one of claims 1-12.

Citation Information

Patent Citations

  • Test process tracking method and system for Java function call path

    CN104536895A

  • Test case selection method and device

    CN110109816A

  • Case similarity calculation method and system based on graph convolution

    CN114169429A

  • Method and device for processing test case

    CN114490400A