Test case coverage rate determination method and device based on relation graph
Through the method based on the relationship graph, the coverage rate of test cases is calculated, which solves the problems of inaccurate coverage and inefficient coverage in the prior art, and improves the coverage rate and processing efficiency of test cases.
Patent Information
- Application Number
- CN202410827895.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-11-08
AI Technical Summary
The existing test case coverage determination method has one-dimensional keyword strategy that relies on manual query to lead to inaccuracy, difficulty in adjusting two-dimensional mind maps, and test case public libraries require manual calculation of coverage, resulting in inefficiency.
Using a relational graph-based method, by generating the first relational graph and the second relational graph, the importance deviation value is calculated to determine the coverage of the test case, and the use case is adjusted according to the difference value to improve coverage.
It realizes a more accurate representation of the relationship between demand points, preconditions and test cases, improves the coverage and efficiency of test cases, and reduces the need for manual adjustment.
Smart Images

Figure CN118916260A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of testing technology, and in particular to a method and device for determining test case coverage based on a relationship graph. Background Art
[0002] For the analysis of test points, existing solutions are usually one-dimensional keyword strategies, two-dimensional mind maps, and generating a public library of test cases.
[0003] One-dimensional keyword strategies rely on manual queries, which may lead to problems such as inadequate communication, insufficient understanding of requirements, and over-reliance on the personal experience of testers. Therefore, there may often be areas that are not covered, making the determination of test case coverage based on the one-dimensional keyword strategy inaccurate. Two-dimensional mind maps become bloated as test requirements increase and it is not easy to adjust parent nodes. The test case public library requires manual division of nodes, edges, and paths, and calculation of coverage separately. In addition, it is necessary to constantly ensure the accuracy of test cases in the test case public library, which makes it difficult to meet test efficiency requirements. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a method and device for determining test case coverage based on a relationship graph, aiming to solve at least one of the above technical problems.
[0005] In a first aspect, the technical solution of the present invention to solve the above technical problem is as follows: a method for determining test case coverage based on a relationship graph, the method comprising:
[0006] Generate a first relationship map according to a plurality of demand points to be processed and at least one precondition of each of the demand points to be processed, wherein each first parent node in the first relationship map represents one of the demand points to be processed, each first child node in the first relationship map represents one of the preconditions, and each of the preconditions corresponds to a verification method;
[0007] Generate a second relationship graph according to the test cases corresponding to the multiple demand points to be processed and the test cases corresponding to the preconditions, wherein each second parent node in the second relationship graph represents a test case corresponding to the demand point to be processed, and each second child node in the second relationship graph represents a test case corresponding to the precondition;
[0008] Calculating a first importance deviation value between each of the first parent nodes and each of the second parent nodes, and a second importance deviation value between each of the first child nodes and each of the second child nodes;
[0009] The coverage of each test case is determined according to each of the first importance deviation values and each of the second importance deviation values.
[0010] The beneficial effects of the present invention are: based on the first relationship graph and the second relationship graph, the relationship between the demand points to be processed, the preconditions and the test cases can be better characterized, and based on the first importance deviation value between each of the first parent nodes and each of the second parent nodes, and the second importance deviation value between each of the first child nodes and each of the second child nodes, the importance of different test cases can be reflected, so that the coverage of each test case can be accurately determined, so as to better process the test cases according to the coverage and improve the coverage of the test cases.
[0011] Based on the above technical solution, the present invention can also be improved as follows.
[0012] Further, the above calculation of the first importance deviation value between each of the first parent nodes and each of the second parent nodes, and the second importance deviation value between each of the first child nodes and each of the second child nodes, includes:
[0013] Calculate a first PR value corresponding to each of the first parent nodes, a second PR value corresponding to each of the second parent nodes, a third PR value corresponding to each of the first child nodes, and a fourth PR value corresponding to each of the second child nodes;
[0014] For any one of the first parent nodes and any one of the second parent nodes, determining a first importance deviation value between the first parent node and the second parent node according to a difference between a first PR value corresponding to the first parent node and a second PR value corresponding to the second parent node;
[0015] For any first child node and any second child node corresponding to the same parent node, the difference between the first PR value corresponding to the first child node and the second PR value corresponding to the second child node is determined as the second importance deviation value between the first child node and the second child node.
[0016] The beneficial effect of adopting the above further solution is that the PR value of each node is calculated based on PageRank, and the importance deviation value can be accurately judged based on the difference between the PR values of two nodes.
[0017] Further, determining the coverage of each test case according to each of the first importance deviation values and each of the second importance deviation values includes:
[0018] For any one of the first parent nodes and any one of the second parent nodes, based on a first importance deviation value between the first parent node and the second parent node, determine the coverage of the test case corresponding to the first parent node;
[0019] For any first child node and any second child node corresponding to the same parent node, based on the second importance deviation value between the first child node and the second child node, determine the coverage of the test case corresponding to the first child node;
[0020] The method further comprises:
[0021] For any of the first parent nodes and any of the second parent nodes, if the first importance deviation value between the first parent node and the second parent node is greater than the first importance threshold, it is judged that the coverage of the test case corresponding to the first parent node does not meet the test requirements; otherwise, it is judged that the coverage of the test case corresponding to the first parent node meets the test requirements;
[0022] For any first child node and any second child node corresponding to the same parent node, if the second importance deviation value between the first child node and the second child node is greater than the first importance threshold, it is judged that the coverage of the test case corresponding to the first child node does not meet the test requirements; otherwise, it is judged that the coverage of the test case corresponding to the first child node meets the test requirements.
[0023] The beneficial effect of adopting the above further scheme is that, based on the first importance deviation value between any of the first parent nodes and any of the second parent nodes, and the second importance deviation value between any of the first child nodes and any of the second child nodes corresponding to the same parent node, the coverage of the test cases can be accurately judged to facilitate subsequent adjustments to the test cases.
[0024] Further, for any first child node and any second child node corresponding to the same parent node, if the coverage of the test case corresponding to the first child node does not meet the test requirements, or the test case corresponding to any first parent node and any second parent node does not meet the test requirements, the method further includes:
[0025] The test case corresponding to the first child node or the first parent node is modified so that the modified test case meets the test requirement.
[0026] The beneficial effect of adopting the above further solution is that the test cases that do not meet the test requirements can be modified, the test cases can be continuously improved, and the coverage of the test cases can be improved.
[0027] Furthermore, the method further comprises:
[0028] Taking each node in the first relationship graph as a first test point, and taking each node in the second relationship graph as a second test point;
[0029] For each of the first test points, judging whether there is a second test point similar to the first test point in the second relationship graph according to each of the first importances and each of the second importances;
[0030] For each of the first test points, if there is a second test point similar to the first test point, and the importance corresponding to the first test point is less than a first importance threshold, updating the document description corresponding to the first test point;
[0031] For each of the first test points, if there is a second test point similar to the first test point, and the importance corresponding to the first test point is greater than the first importance threshold and less than the second importance threshold, then a new child node is created under the parent node corresponding to the first test point, and a link is established between the new child node and the corresponding parent node;
[0032] For each of the first test points, if there is no second test point similar to the first test point, a new parent node is created in the first relationship graph.
[0033] The beneficial effect of adopting the above further scheme is that, based on the above method, the first relationship map can be continuously updated so that the updated first relationship map can more comprehensively and accurately characterize the relationship between test cases, preconditions and test points.
[0034] Furthermore, in the first relationship graph, each node corresponds to a document description, and the method further includes:
[0035] Add the corresponding document description under the new parent node.
[0036] The beneficial effect of adopting the above further solution is that, based on the document description, the new parent node can be accurately described.
[0037] Furthermore, the method further comprises:
[0038] If the first relationship graph changes, the changed content is recorded, and the changed content includes the changed target node and the associated nodes of the target node.
[0039] The beneficial effect of adopting the above further solution is that, based on the changed content, the subsequent search for the changed target node and the associated nodes of the target node can be more accurate and faster.
[0040] In a second aspect, in order to solve the above technical problem, the present invention also provides a test case coverage determination device based on a relationship graph, the device comprising:
[0041] A first relationship map generating module, used to generate a first relationship map according to a plurality of demand points to be processed and at least one precondition of each of the demand points to be processed, wherein each parent node in the first relationship map represents one of the demand points to be processed, each first child node in the first relationship map represents one of the preconditions, and each of the preconditions corresponds to a verification method;
[0042] A second relationship graph generating module, used to generate a second relationship graph according to the test cases corresponding to the multiple demand points to be processed and the test cases corresponding to the preconditions, wherein each parent node in the second relationship graph represents a test case corresponding to the demand point to be processed, and each second child node in the second relationship graph represents a test case corresponding to the precondition;
[0043] An importance deviation value determination module, used to calculate a first importance deviation value between each of the first parent nodes and each of the second parent nodes, and a second importance deviation value between each of the first child nodes and each of the second child nodes;
[0044] The coverage determination module is used to determine the coverage of each test case according to each of the first importance deviation values and each of the second importance deviation values.
[0045] In the third aspect, in order to solve the above-mentioned technical problems, the present invention also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the test case coverage determination method based on the relationship graph of the present application is implemented.
[0046] In a fourth aspect, in order to solve the above-mentioned technical problem, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method for determining the test case coverage based on the relationship graph of the present application is implemented.
[0047] Additional aspects and advantages of the present application will be partially given in the following description, which will become apparent from the following description, or will be understood through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for describing the embodiments of the present invention are briefly introduced below.
[0049] Figure 1A schematic diagram of a flow chart of a method for determining test case coverage based on a relationship graph provided by an embodiment of the present invention;
[0050] Figure 2 A schematic diagram of a first relationship map provided by an embodiment of the present invention;
[0051] Figure 3 A schematic diagram of a test flow in the prior art provided for an embodiment of the present invention;
[0052] Figure 4 A schematic diagram of a process for updating a first relationship map provided by an embodiment of the present invention;
[0053] Figure 5 A schematic diagram of the structure of a test case coverage determination device based on a relationship graph provided by an embodiment of the present invention;
[0054] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The principles and features of the present invention are described below. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.
[0056] The technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.
[0057] The solution provided by the embodiment of the present invention can be applied to any application scenario where the coverage of test cases needs to be determined. The solution provided by the embodiment of the present invention can be executed by any electronic device, for example, it can be a user's terminal device, and the terminal device that can access the web page through the application includes at least one of the following: a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a smart TV, and a smart car device.
[0058] The embodiment of the present invention provides a possible implementation method, such as Figure 1 As shown, a flowchart of a method for determining test case coverage based on a relationship graph is provided. The solution can be executed by any electronic device, for example, a terminal device, or a terminal device and a server. For the convenience of description, the method provided by the embodiment of the present invention will be described below using a terminal device as an example of an execution subject. Figure 1 The method may include the following steps:
[0059] Step S10, generating a first relationship map according to a plurality of demand points to be processed and at least one precondition of each of the demand points to be processed, wherein each first parent node in the first relationship map represents one of the demand points to be processed, each first child node in the first relationship map represents one precondition, and each of the preconditions corresponds to a verification method;
[0060] Step S20, generating a second relationship graph according to the test cases corresponding to the multiple demand points to be processed and the test cases corresponding to the preconditions, wherein each second parent node in the second relationship graph represents a test case corresponding to the demand point to be processed, and each second child node in the second relationship graph represents a test case corresponding to the precondition;
[0061] Step S30, calculating a first importance deviation value between each of the first parent nodes and each of the second parent nodes, and a second importance deviation value between each of the first child nodes and each of the second child nodes;
[0062] Step S40: determining the coverage of each test case according to each of the first importance deviation values and each of the second importance deviation values.
[0063] Through the method of the present invention, the relationship between the demand points to be processed, the preconditions and the test cases can be better characterized based on the first relationship map and the second relationship map, and the importance of different test cases can be reflected based on the first importance deviation value between each of the first parent nodes and each of the second parent nodes, and the second importance deviation value between each of the first child nodes and each of the second child nodes, so that the coverage of each test case can be accurately determined, so as to better process the test cases according to the coverage and improve the coverage of the test cases.
[0064] The solution of the present invention is further described below in conjunction with the following specific embodiments. In this embodiment, a method for determining test case coverage based on a relationship graph may include the following steps:
[0065] Step S10, generating a first relationship map according to a plurality of demand points to be processed and at least one precondition of each of the demand points to be processed, wherein each first parent node in the first relationship map represents one of the demand points to be processed, each first child node in the first relationship map represents one precondition, and each of the preconditions corresponds to a verification method;
[0066] Among them, the pending demand points refer to the nodes that need to be tested according to the test cases. They can be generated through collaboration based on R&D, testing, demand, etc. For example, see Figure 2The schematic diagram of the first relationship graph is shown, in which the input class represents a demand point to be processed, and special character verification, uniqueness verification and required item verification are three different verification methods. In the first relationship graph, the input class is a first parent node, and special character verification, uniqueness verification and required item verification are the three first child nodes under the first parent node.
[0067] As an example, a person needs to be approved to enter the site, and the information he submits must be verified before it can enter the approval process. Verification of the information is a prerequisite.
[0068] In the present application, the first relationship map can be used as the original map, and other maps can be obtained by supplementing and modifying the original map. For example, a map obtained by supplementing the original map based on demand, research and development, or testing, or a map generated according to the preconditions of the test case.
[0069] Optionally, all nodes in the first relationship map are generated based on the mature public standards of the project, and the subsequent second relationship map is supplemented on this basis. For example, when submitting information, there is of course information verification. The basic information verification is divided into uniqueness verification, required field verification, length verification, format verification, etc. These can be used as nodes of the original map as prerequisites. There is no need to repeatedly add these nodes during subsequent testing, but to add and supplement them on this basis to specialize the content.
[0070] As an example, see Figure 4 As shown in , the first test point in the first relationship graph can be a demand test point generated before demand briefing, a test point generated based on demand understanding, and a key test point generated by smoke testing before R&D testing.
[0071] Step S20, generating a second relationship graph according to the test cases corresponding to the multiple demand points to be processed and the test cases corresponding to the preconditions, wherein each second parent node in the second relationship graph represents a test case corresponding to the demand point to be processed, and each second child node in the second relationship graph represents a test case corresponding to the precondition;
[0072] Similarly, in the second relationship graph, Figure 2 For example, for the three preconditions of the input class, each precondition corresponds to a test case. In the second relationship graph, each node corresponds to a test case, and the test case corresponding to the input class corresponds to a second parent node. For the parent node representing the same demand point to be processed, the parent node corresponds to 6 child nodes in the two relationship graphs, and each first child node corresponds to a corresponding second child node.
[0073] Step S30, calculating a first importance deviation value between each of the first parent nodes and each of the second parent nodes, and a second importance deviation value between each of the first child nodes and each of the second child nodes;
[0074] Based on the first relationship graph and the second relationship graph, the importance deviation value between any first child node and any second child node can be calculated, the importance deviation value between any first child node and any second child node corresponding to the same parent node can also be calculated, and the importance deviation value between the first child node and the second child node corresponding to the same precondition corresponding to the same parent node can also be calculated. In order to reduce the amount of calculation, the first importance deviation value between each of the first parent nodes and each of the second parent nodes, and the second importance deviation value between each of the first child nodes and each of the second child nodes are usually calculated.
[0075] As an example, for the same precondition (e.g., uniqueness check) corresponding to the same parent node (the first parent node and the second parent node corresponding to the input class), the importance deviation value between the first child node corresponding to the uniqueness check in the first relationship graph and the second child node corresponding to the second relationship graph can be calculated; the importance deviation value between the first child node corresponding to the uniqueness check in the first relationship graph and the second child node corresponding to the required item check can also be calculated. Similarly, the importance deviation value between the first child node corresponding to the uniqueness check and the second child node corresponding to the uniqueness check under different parent nodes can also be calculated.
[0076] Step S40: determining the coverage of each test case according to each of the first importance deviation values and each of the second importance deviation values.
[0077] Among them, for the two child nodes corresponding to the same precondition corresponding to the same parent node, the smaller the importance difference value corresponding to the two child nodes, the higher the coverage of the test cases corresponding to the same precondition, and vice versa.
[0078] Optionally, one possible implementation of S30 is as follows:
[0079] S301, calculating a first PR value corresponding to each of the first parent nodes, a second PR value corresponding to each of the second parent nodes, a third PR value corresponding to each of the first child nodes, and a fourth PR value corresponding to each of the second child nodes;
[0080] S302, for any one of the first parent nodes and any one of the second parent nodes, determining a first importance deviation value between the first parent node and the second parent node according to a difference between a first PR value corresponding to the first parent node and a second PR value corresponding to the second parent node;
[0081] S303: For any first child node and any second child node corresponding to the same parent node, the difference between the third PR value corresponding to the first child node and the fourth PR value corresponding to the second child node is determined as the importance deviation value between the first child node and the second child node.
[0082] Among them, for each node in the first relationship graph and the second relationship graph, the calculation method of the PR value corresponding to the node is the same, and the following will take the calculation method of the first PR value of a first parent node as an example for explanation.
[0083] Before calculating the first PR value of the first parent node, let's first introduce the principle of PageRank calculating PR value:
[0084] PageRank is essentially an algorithm that roughly analyzes the importance of web pages using the number and quality of hyperlinks between web pages as the main factors. Its basic assumption is that more important pages tend to be more referenced by other pages (or other pages will have more hyperlinks to the page). It interprets the link from page A to page B as "page A votes for page B" and determines the rank of the voted page based on the source of the vote (even the source of the source, that is, the page that links to page A) and the rank of the voting object. Simply put, a high-ranking page can improve other low-ranking pages.
[0085] When users use a system, the more core functional pages are often used more, which is usually the focus of the testing process. Therefore, in this solution, the concept of web pages in PageRank is extended to test points in the relationship graph. In other words, more important test points are often linked to more by other test points. At the same time, a high-level test point can also improve other low-level test points.
[0086] For a certain page i, the calculation formula for its corresponding PR value is as follows:
[0087]
[0088] Among them, p1, p2, ···, p N Indicates the target page p i ,M(p j ) indicates linking into p i The collection of pages, L(p j ) indicates page pj The number of pages linked out, where N is the number of all pages in the collection.
[0089] The above equation introduces the concept of a random browser, which assumes that someone randomly opens certain pages and clicks certain links in a browser. For ease of understanding, assume that the web surfer keeps clicking on links on the web page until he enters a web page with no external links, at which point he will randomly browse other web pages (which may be unrelated to the previous web page).
[0090] In order to deal with the problems caused by "pages without external links" (these pages are like "black holes" that swallow up the probability of users continuing to browse down, of course there are definitely test points without external links in the relationship map), it can be assumed that: this type of page links to all web pages in the collection (regardless of whether they are related), so that the PR value of this type of web page will be evenly divided by all web pages. For this residual probability, the damping coefficient d can be omitted, d = 0.85, which means: at any time, the probability of a user continuing to visit the next page after visiting a certain page, and the corresponding 1-d = 0.15 is the probability of the user stopping clicking and randomly browsing new web pages.
[0091] It should be noted that the size of d is estimated by the average frequency of general Internet users using the browser bookmark function.
[0092] Although this algorithm is designed to calculate web pages, it is used as a centrality algorithm to calculate test points in this solution and has nothing to do with web pages. This algorithm is used in this solution to measure the importance and influence of nodes in the relationship graph, thereby reflecting the centrality of the nodes to a certain extent. Its object is not limited to the web page itself.
[0093] The test points involved in this solution can be understood as detection standards, and the relationship between parent nodes and child nodes can be understood as the outline table of biological classification. For example, in the above example, the parent node is the input class, which means that this parent node and its child nodes are the key points for testing the input. The uniqueness check, mandatory check, etc. are the child nodes corresponding to the parent node. The line between the child node and the parent node represents which parent node the child node belongs to, that is, the in-link in the algorithm.
[0094] Therefore, in this solution, the first PR value of the first parent node can be calculated based on the above formula by using the algorithm, and the parameter "page" in the above formula can be replaced by "first parent node". In addition, the calculation in this implementation does not need to be calculated manually in the actual project, and can be automatically calculated using the Neo4j graph database.
[0095] In the prior art, see Figure 3The test workflow swimlane diagram shown in the figure has several problems:
[0096] 1. The three links of requirement briefing, test case writing, and R&D smoke testing are basically independent. Test case writing (test cases) will largely rely on factors such as the tester's personal experience and the degree of understanding of the briefing content, which will result in low case coverage.
[0097] 2. The only way to detect test cases is to review them. The review usually involves the tester explaining the test points he generated and submitting them to R&D and demand review. This method does not have a numerical standard for evaluation and is more dependent on the understanding and communication level of the three parties.
[0098] 3. If the requirements are changed later and a specific requirement content is significantly modified, many test cases used for testing will need to spend a lot of time to manually modify or even rewrite most of them.
[0099] Based on the above problems, this solution uses a 3D relationship map to represent pending demand points, test cases and preconditions. Based on this, since the 3D relationship map is a team collaboration, if you want to perform a uniqueness check on a pending demand point corresponding to a certain number in the demand, you can perform an in-link operation in the "uniqueness check"; if the R&D smoke test finds that there is a problem with a certain part of the function, you can also perform an in-link operation on the corresponding function point and mark it, because the smoke test finds that there are problems with the function point, and subsequent detailed testing will often find many problems; the test can also mark the parent node of any test according to its own understanding. In this way, the relationship map at the test submission stage will include the test focus obtained by the three parties of demand, R&D and testing, which will reduce a lot of communication costs and achieve the effect of brainstorming.
[0100] In addition, this solution uses PageRank to calculate the PR value of each node, and this PR value can be used to evaluate the coverage of test cases during the review process, because the basic principle of the PageRank algorithm is to regard the entire network as a Markov chain, in which the PR value can be regarded as the steady-state distribution of the Markov chain. In this distribution, the sum of the PR values of all web pages should be equal to 1. In this application solution, the sum of the PR values of all nodes in a relationship graph is equal to 1, which ensures that the importance of the entire network is fully distributed and represented.
[0101] Optionally, a possible implementation of the above S40 is:
[0102] S401: for any one of the first parent nodes and any one of the second parent nodes, based on a first importance deviation value between the first parent node and the second parent node, determine the coverage of the test case corresponding to the first parent node;
[0103] S402: For any first child node and any second child node corresponding to the same parent node, determine the coverage of the test case corresponding to the first child node based on the second importance deviation value between the first child node and the second child node.
[0104] Among them, based on the calculation of the PR value in the previous text, for any of the first parent nodes and any of the second parent nodes, the difference between the first PR value of the first parent node and the second PR value of the second parent node can be used as the first importance deviation value. The smaller the first importance deviation value, the higher the coverage of the test case corresponding to the first parent node.
[0105] Similarly, for any first child node and any second child node corresponding to the same parent node, the difference between the third PR value of the first child node and the fourth PR value of the second child node can be used as the second importance deviation value. The smaller the second importance deviation value, the higher the coverage of the test case corresponding to the corresponding first child node.
[0106] Optionally, after the coverage of the test cases corresponding to each node (including child nodes and parent nodes) is determined, the following processing can be performed:
[0107] For any of the first parent nodes and any of the second parent nodes, if the first importance deviation value between the first parent node and the second parent node is greater than a first importance threshold (for example, it may be 0.05), it is judged that the coverage of the test case corresponding to the first parent node does not meet the test requirements, that is, the coverage is low; otherwise, it is judged that the coverage of the test case corresponding to the first parent node meets the test requirements;
[0108] For any first child node and any second child node corresponding to the same parent node, if the second importance deviation value between the first child node and the second child node is greater than the first importance threshold, it is judged that the coverage of the test case corresponding to the first child node does not meet the test requirements, that is, the coverage is low; otherwise, it is judged that the coverage of the test case corresponding to the first child node meets the test requirements.
[0109] In this solution, based on the difference in PR values of two subnodes in the two relationship graphs, it can be determined which test case is lacking, that is, it is used as a criterion for determining the coverage of the test point. The first importance threshold can be set based on actual needs.
[0110] Furthermore, when the first importance deviation value or the second importance deviation value is less than 0.01, it indicates that the corresponding two nodes are basically similar and can be ignored, that is, no processing is required, indicating that the corresponding test case coverage is high. When the first importance deviation value or the second importance deviation value is greater than 0.1, it indicates that the corresponding two nodes are basically dissimilar, that is, the difference is large, and the coverage of the corresponding test case is low, and the test case needs to be modified subsequently.
[0111] It should be noted that in this scheme, the difference corresponding to the PR value is compared with the first importance threshold from top to bottom, from parent node to child node, that is, the first importance deviation value and the first importance threshold corresponding to any one of the first parent nodes and any one of the second parent nodes are compared first, and then the child nodes are compared.
[0112] Optionally, for any first child node and any second child node corresponding to the same parent node, if the coverage of the test case corresponding to the first child node does not meet the test requirements, or the test case corresponding to any first parent node and any second parent node does not meet the test requirements, the method further includes:
[0113] The test case corresponding to the first child node or the first parent node is modified so that the modified test case meets the test requirement. After the above processing, the coverage of the test case can be improved.
[0114] There are actually only two types of changes in test requirements for the relationship graph: one is the change of nodes, and the other is the change of node content.
[0115] First, the simplest change of node content. In fact, each node in the relationship map exists in the form of a document description (see Figure 2 To modify the content, you only need to add the changed content under the corresponding node document. The tester can also quickly locate which part has been changed by following the nodes of the graph through the modification records of the document. When modifying the test case, the corresponding test case can be found through the same preconditions as the graph nodes, which is very convenient.
[0116] The change of the second node also requires two types of changes to the relationship graph. One is to add a new node, and the other is to rewrite the inherited node. Because the original baseline relationship graph already has many basic nodes, it only needs to determine whether similar test points already exist. If not, find the parent node to which it belongs, inherit and rewrite the document content of the parent node. If the parent node cannot be found, a new parent node is added for linking.
[0117] The relationships between nodes in the relationship map exist in the form of links, so there is no situation where the prerequisites are rewritten in a two-dimensional mind map manner and all subsequent content is disconnected. Disconnected nodes can be restored to integrity through a simple link.
[0118] See also Figure 4 , the specific scheme for updating the first relationship graph is:
[0119] Taking each node in the first relationship graph as a first test point, and taking each node in the second relationship graph as a second test point;
[0120] For each of the first test points, according to each of the first importance and each of the second importance, it is determined whether there is a second test point similar to the first test point in the second relationship graph (corresponding to Figure 4 There are similar test points in the middle relationship graph (second relationship graph);
[0121] For each of the first test points, if there is a second test point similar to the first test point, and the importance corresponding to the first test point (the first test point is the parent node, the corresponding importance is the first importance, the first test point is the child node, the corresponding importance is the second importance) is less than the first importance threshold, indicating that there is a second test point that is completely consistent with the first test point, then the document description corresponding to the first test point is updated; as an example, an animal is discovered, which differs from the animals in the existing recorded order (first relationship map) only in hair color, then the description of the hair of the animal is updated to make its document description more accurate.
[0122] For each of the first test points, if there is a second test point similar to the first test point, and the importance corresponding to the first test point is greater than the first importance threshold and less than the second importance threshold, it means that there is a second test point similar to the first test point, but it is only similar and not completely consistent, then a new child node is created under the parent node corresponding to the first test point, and a link is established between the new child node and the corresponding parent node; as an example, an animal is found that has similar points to animals in an existing recorded class, but it can be determined that it is not that class, so a new class (child node) is created under this class (parent node) to represent this animal. This step corresponds to Figure 4 As shown in , a parent node with high importance (the parent node corresponding to the first test point) is selected to create a new child node. In this solution, in addition to establishing a link between the new child node and the corresponding parent node, the document content of the selected parent node can also be inherited and rewritten.
[0123] For each of the first test points, if there is no second test point similar to the first test point, then the maximum importance value corresponding to the first test point may be larger, and a new parent node is created in the first relationship map. As an example, if an animal is found and no similar species can be found in the entire recorded class, a new class (parent node) is created for the species. Figure 4 To create a new parent node, you need to establish a new link.
[0124] After the above processing, the first relationship graph is expanded, that is, the corresponding Figure 4 The expanded 3D relationship graph shown in .
[0125] Optionally, in the first relationship graph, each node corresponds to a document description, and the method further includes:
[0126] Add the corresponding document description under the new parent node. Figure 4 Adding new test points as shown in the documentation description.
[0127] For each node, the document description corresponding to the node is used to describe the relevant information or specific information of the node, for example, see Figure 2 In the first relationship graph shown, for the node of mandatory item verification, the document description of the node is: the specific content of the mandatory item verification includes XX function, XX field and XX field in the input class.
[0128] Optionally, the method further includes:
[0129] If the first relationship graph changes, the changed content is recorded, and the changed content includes the changed target node and the associated nodes of the target node.
[0130] By recording the changed content, it is possible to quickly find which nodes in the first relationship graph have changed and which nodes (associated nodes) have been affected after the change. As an example, if the target node is a child node, the associated node may be the parent node of the child node.
[0131] The change refers to the change of the node itself and / or the change of the document description corresponding to the node. The change of the node itself refers to the addition of a new child node or a new parent node to the node.
[0132] It is understandable that, in the process of updating the first relationship graph, the original child node may become the parent node.
[0133] Based on Figure 1Based on the same principle as the method shown in , the embodiment of the present invention also provides a test case coverage determination device 20 based on a relationship graph, such as Figure 5 As shown in , the test case coverage determination device 20 based on the relationship graph may include a first relationship graph generation module 210, a second relationship graph generation module 220, an importance deviation value determination module 230 and a coverage determination module 240, wherein:
[0134] A first relationship map generating module 210 is used to generate a first relationship map according to a plurality of demand points to be processed and at least one precondition of each of the demand points to be processed, wherein each first parent node in the first relationship map represents one of the demand points to be processed, each first child node in the first relationship map represents one precondition, and each of the preconditions corresponds to a verification method;
[0135] A second relationship graph generating module 220 is used to generate a second relationship graph according to the test cases corresponding to the multiple demand points to be processed and the test cases corresponding to the preconditions, wherein each second parent node in the second relationship graph represents a test case corresponding to the demand point to be processed, and each second child node in the second relationship graph represents a test case corresponding to the precondition;
[0136] An importance deviation value determination module 230, configured to calculate a first importance deviation value between each of the first parent nodes and each of the second parent nodes, and a second importance deviation value between each of the first child nodes and each of the second child nodes;
[0137] The coverage determination module 240 is used to determine the coverage of each test case according to each of the first importance deviation values and each of the second importance deviation values.
[0138] Optionally, when calculating the first importance deviation value between each of the first parent nodes and each of the second parent nodes, and the second importance deviation value between each of the first child nodes and each of the second child nodes, the importance determination module 230 is specifically used to:
[0139] Calculate a first PR value corresponding to each of the first parent nodes, a second PR value corresponding to each of the second parent nodes, a third PR value corresponding to each of the first child nodes, and a fourth PR value corresponding to each of the second child nodes;
[0140] For any one of the first parent nodes and any one of the second parent nodes, determining a first importance deviation value between the first parent node and the second parent node according to a difference between a first PR value corresponding to the first parent node and a second PR value corresponding to the second parent node;
[0141] For any first child node and any second child node corresponding to the same parent node, the difference between the third PR value corresponding to the first child node and the fourth PR value corresponding to the second child node is determined as the second importance deviation value between the first child node and the second child node.
[0142] Optionally, when the coverage determination module 240 determines the coverage of each test case according to each of the first importance deviation values and each of the second importance deviation values, it is specifically configured to:
[0143] For any one of the first parent nodes and any one of the second parent nodes, based on a first importance deviation value between the first parent node and the second parent node, determine the coverage of the test case corresponding to the first parent node;
[0144] For any first child node and any second child node corresponding to the same parent node, based on the second importance deviation value between the first child node and the second child node, determine the coverage of the test case corresponding to the first child node;
[0145] The device also includes:
[0146] A coverage judgment module is used to, for any first parent node and any second parent node, if the first importance deviation value between the first parent node and the second parent node is greater than the first importance threshold, then judge that the coverage of the test case corresponding to the first parent node does not meet the test requirements, otherwise, judge that the coverage of the test case corresponding to the first parent node meets the test requirements; for any first child node and any second child node corresponding to the same parent node, if the second importance deviation value between the first child node and the second child node is greater than the first importance threshold, then judge that the coverage of the test case corresponding to the first child node does not meet the test requirements, otherwise, judge that the coverage of the test case corresponding to the first child node meets the test requirements.
[0147] Optionally, for any first child node and any second child node corresponding to the same parent node, if the coverage of the test case corresponding to the first child node does not meet the test requirements, or the test case corresponding to any first parent node and any second parent node does not meet the test requirements, the device further includes:
[0148] The test case modification module is used to modify the test case corresponding to the first child node or the first parent node so that the modified test case meets the test requirement.
[0149] Optionally, the device further comprises:
[0150] Update modules for:
[0151] Taking each node in the first relationship graph as a first test point, and taking each node in the second relationship graph as a second test point;
[0152] For each of the first test points, judging whether there is a second test point similar to the first test point in the second relationship graph according to each of the first importances and each of the second importances;
[0153] For each of the first test points, if there is a second test point similar to the first test point, and the importance corresponding to the first test point is less than a first importance threshold, updating the document description corresponding to the first test point;
[0154] For each of the first test points, if there is a second test point similar to the first test point, and the importance corresponding to the first test point is greater than the first importance threshold and less than the second importance threshold, then a new child node is created under the parent node corresponding to the first test point, and a link is established between the new child node and the corresponding parent node;
[0155] For each of the first test points, if there is no second test point similar to the first test point, a new parent node is created in the first relationship graph.
[0156] Optionally, in the first relationship graph, each node corresponds to a document description, and the device further includes:
[0157] The document description adding module is used to add the corresponding document description under the new parent node.
[0158] Optionally, the device further comprises:
[0159] A recording module is used to record the changed content when the first relationship graph changes, and the changed content includes the changed target node and the associated nodes of the target node.
[0160] The test case coverage determination device based on relationship graph in the embodiment of the present invention can execute the test case coverage determination method based on relationship graph provided in the embodiment of the present invention, and its implementation principle is similar. The actions performed by each module and unit in the test case coverage determination device based on relationship graph in each embodiment of the present invention correspond to the steps in the test case coverage determination method based on relationship graph in each embodiment of the present invention. For the detailed functional description of each module of the test case coverage determination device based on relationship graph, please refer to the description of the corresponding test case coverage determination method based on relationship graph shown in the previous text, and will not be repeated here.
[0161] Among them, the above-mentioned test case coverage determination device based on the relationship graph can be a computer program (including program code) running in a computer device, for example, the test case coverage determination device based on the relationship graph is an application software; the device can be used to execute the corresponding steps in the method provided in the embodiment of the present invention.
[0162] In some embodiments, the test case coverage determination device based on the relationship graph provided in the embodiment of the present invention can be implemented in a combination of software and hardware. As an example, the test case coverage determination device based on the relationship graph provided in the embodiment of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the test case coverage determination method based on the relationship graph provided in the embodiment of the present invention. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.
[0163] In other embodiments, the apparatus for determining test case coverage based on a relationship graph provided by the embodiment of the present invention may be implemented in a software manner. Figure 5 A test case coverage determination device based on a relationship graph stored in a memory is shown, which can be software in the form of a program and a plug-in, and includes a series of modules, including a first relationship graph generation module 210, a second relationship graph generation module 220, an importance deviation value determination module 230 and a coverage determination module 240, which are used to implement the test case coverage determination method based on a relationship graph provided in an embodiment of the present invention.
[0164] The modules involved in the embodiments of the present invention may be implemented by software or hardware, wherein the name of a module does not limit the module itself in some cases.
[0165] Based on the same principle as the method shown in the embodiments of the present invention, an electronic device is also provided in the embodiments of the present invention, which may include but is not limited to: a processor and a memory; the memory is used to store a computer program; the processor is used to execute the method shown in any embodiment of the present invention by calling the computer program.
[0166] In an alternative embodiment, an electronic device is provided, such as Figure 6 As shown, Figure 6 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present invention.
[0167] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0168] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0169] The memory 4003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.
[0170] The memory 4003 is used to store the application code (computer program) for executing the solution of the present invention, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the application code stored in the memory 4003 to implement the content shown in the above method embodiment.
[0171] The electronic device may also be a terminal device. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0172] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding contents of the aforementioned method embodiment.
[0173] According to another aspect of the present invention, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the implementation modes of the above-mentioned various embodiments.
[0174] Computer program code for performing the operations of the present invention may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0175] It should be understood that the flow charts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the module, the program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0176] The computer-readable storage medium provided by the embodiment of the present invention may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device, or device.
[0177] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0178] The above description is only a preferred embodiment of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the disclosure scope involved in the present invention is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) by each other.
Claims
1. A method for determining test case coverage based on a relationship graph, characterized in that: The following steps are involved: Generate a first relationship map according to a plurality of demand points to be processed and at least one precondition of each of the demand points to be processed, wherein each first parent node in the first relationship map represents one of the demand points to be processed, each first child node in the first relationship map represents one of the preconditions, and each of the preconditions corresponds to a verification method; Generate a second relationship graph according to the test cases corresponding to the multiple demand points to be processed and the test cases corresponding to the preconditions, wherein each second parent node in the second relationship graph represents a test case corresponding to the demand point to be processed, and each second child node in the second relationship graph represents a test case corresponding to the precondition; Calculating a first importance deviation value between each of the first parent nodes and each of the second parent nodes, and a second importance deviation value between each of the first child nodes and each of the second child nodes; The coverage of each test case is determined according to each of the first importance deviation values and each of the second importance deviation values.
2. The method according to claim 1, characterized in that The calculating of the first importance deviation value between each of the first parent nodes and each of the second parent nodes, and the second importance deviation value between each of the first child nodes and each of the second child nodes, includes: Calculate a first PR value corresponding to each of the first parent nodes, a second PR value corresponding to each of the second parent nodes, a third PR value corresponding to each of the first child nodes, and a fourth PR value corresponding to each of the second child nodes; For any one of the first parent nodes and any one of the second parent nodes, determining a first importance deviation value between the first parent node and the second parent node according to a difference between a first PR value corresponding to the first parent node and a second PR value corresponding to the second parent node; For any first child node and any second child node corresponding to the same parent node, the difference between the third PR value corresponding to the first child node and the fourth PR value corresponding to the second child node is determined as the second importance deviation value between the first child node and the second child node.
3. The method according to claim 1, characterized in that The determining the coverage of each test case according to each of the first importance deviation values and each of the second importance deviation values includes: For any one of the first parent nodes and any one of the second parent nodes, based on a first importance deviation value between the first parent node and the second parent node, determine the coverage of the test case corresponding to the first parent node; For any first child node and any second child node corresponding to the same parent node, based on the second importance deviation value between the first child node and the second child node, determine the coverage of the test case corresponding to the first child node; The method further comprises: For any of the first parent nodes and any of the second parent nodes, if the first importance deviation value between the first parent node and the second parent node is greater than the first importance threshold, it is judged that the coverage of the test case corresponding to the first parent node does not meet the test requirements; otherwise, it is judged that the coverage of the test case corresponding to the first parent node meets the test requirements; For any first child node and any second child node corresponding to the same parent node, if the second importance deviation value between the first child node and the second child node is greater than the first importance threshold, it is judged that the coverage of the test case corresponding to the first child node does not meet the test requirements; otherwise, it is judged that the coverage of the test case corresponding to the first child node meets the test requirements.
4. The method according to claim 3, characterized in that For any first child node and any second child node corresponding to the same parent node, if the coverage of the test case corresponding to the first child node does not meet the test requirements, or the test case corresponding to any first parent node and any second parent node does not meet the test requirements, the method further includes: The test case corresponding to the first child node or the first parent node is modified so that the modified test case meets the test requirement.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Taking each node in the first relationship graph as a first test point, and taking each node in the second relationship graph as a second test point; For each of the first test points, judging whether there is a second test point similar to the first test point in the second relationship graph according to each of the first importances and each of the second importances; For each of the first test points, if there is a second test point similar to the first test point, and the importance corresponding to the first test point is less than a first importance threshold, updating the document description corresponding to the first test point; For each of the first test points, if there is a second test point similar to the first test point, and the importance corresponding to the first test point is greater than the first importance threshold and less than the second importance threshold, then a new child node is created under the parent node corresponding to the first test point, and a link is established between the new child node and the corresponding parent node; For each of the first test points, if there is no second test point similar to the first test point, a new parent node is created in the first relationship graph.
6. The method according to claim 5, characterized in that In the first relationship graph, each node corresponds to a document description, and the method further includes: Add the corresponding document description under the new parent node.
7. The method according to any one of claims 1 to 4, characterized in that The method further comprises: If the first relationship graph changes, the changed content is recorded, and the changed content includes the changed target node and the associated nodes of the target node.
8. A device for determining test case coverage based on a relationship graph, characterized in that: include: A first relationship map generating module, used to generate a first relationship map according to a plurality of demand points to be processed and at least one precondition of each of the demand points to be processed, wherein each first parent node in the first relationship map represents one of the demand points to be processed, each first child node in the first relationship map represents one of the preconditions, and each of the preconditions corresponds to a verification method; A second relationship graph generating module, used to generate a second relationship graph according to the test cases corresponding to the multiple demand points to be processed and the test cases corresponding to the preconditions, wherein each second parent node in the second relationship graph represents a test case corresponding to the demand point to be processed, and each second child node in the second relationship graph represents a test case corresponding to the precondition; An importance deviation value determination module, used to calculate a first importance deviation value between each of the first parent nodes and each of the second parent nodes, and a second importance deviation value between each of the first child nodes and each of the second child nodes; The coverage determination module is used to determine the coverage of each test case according to each of the first importance deviation values and each of the second importance deviation values.
9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
