Product defect and test case correlation analysis method and device
By constructing text matching of mixed similarity calculation and Sentence-BERT model, the high update cost and low query efficiency problems caused by historical data dependence in the existing technology are solved, and fast and accurate defects are associated with test cases, which are suitable for new projects and new fields.
Patent Information
- Application Number
- CN202510828170.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-06-19
AI Technical Summary
The existing technology relies too much on historical data, resulting in incomplete construction of use case-defect association networks in the initial stage, high update costs, and low query efficiency, especially when facing complex properties and multi-layer intermediate nodes, the response time is increasing exponentially.
By obtaining defect information of the target product, building the first test case set, calculating the mixed similarity between defect description and test cases, using the Sentence-BERT model for sentence similarity analysis, dynamically adjusting feature weights, training the text matching model for intelligent association, and reducing dependence on historical data.
It realizes rapid defects that do not rely on historical data and correlates with test cases, reduces maintenance costs, improves query efficiency, and facilitates the application of new projects and new fields.
Smart Images

Figure CN120353712A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method and device for analyzing the association between product defects and test cases. Background Art
[0002] With the continuous iteration and upgrade of product functions, the test case library is also expanding; for mature products, the number of test cases often reaches tens of thousands, forming a huge test system. During the test execution process, when testers find defects, they need to associate the defects with the corresponding test cases for subsequent tracking and management. However, in the face of such a large number of test cases, manually searching for matching cases is not only inefficient, but also prone to association errors due to human negligence. This traditional method has become one of the main bottlenecks for improving test efficiency.
[0003] At present, the existing defect and test case matching method can obtain matching node information and matching path information according to the knowledge graph corresponding to the defect to be processed, the defect description information of the defect to be processed and the fused knowledge graph stored in the graph database; the fused knowledge graph is obtained by fusing the knowledge graphs corresponding to multiple historical test cases and the knowledge graphs corresponding to multiple historical defects; the large language model is called according to the target knowledge graph composed of matching node information and matching path information, the defect description information of the defect to be processed and the preset matching request prompt words to obtain the matching results returned by the large language model; the matching results include the matching test cases corresponding to the defect to be processed, thereby realizing intelligent matching of test cases and defects based on the knowledge graph and the large language model.
[0004] However, the prior art mainly has the following problems: 1. Due to the lack of historical data accumulation, the use case-defect association network in the initial stage was incomplete, resulting in poor results of the graph-based recommendation algorithm and analysis model in the early stage; 2. Due to demand changes and defect repairs, the association graph needs to be continuously updated synchronously, otherwise the association may become invalid; 3. When there are multiple layers of intermediate nodes or complex attributes between test cases and defects, the graph query response time will increase exponentially.
[0005] In summary, existing technologies rely too much on historical data, have high updating costs, and low query efficiency, which need to be solved urgently. Summary of the invention
[0006] The present application provides a method and device for analyzing the association between product defects and test cases, so as to at least solve the technical problems in the related technology of over-reliance on historical data, high updating cost and low query efficiency.
[0007] The present application provides a method for associating product defects with test cases, including the following steps: obtaining defect information of a target product, and querying a plurality of test cases corresponding to the defect information to construct a first test case set according to the plurality of test cases, where the defect information includes a defect title, a module to which the defective function belongs, a defect handler, and a defect description; calculating the hybrid similarity between the defect description and each of the plurality of test cases, determining a plurality of target test cases with the hybrid similarity greater than a preset similarity threshold, and sorting the plurality of target test cases in descending order to construct a corresponding second test case set; detecting whether there is a correct test case in the second test case set, and if it is detected that there is a correct test case in the second test case set, performing an association operation on the defect information and the correct test case, otherwise selecting a correct test case from the first test case set and performing an association operation on the correct test case and the defect information to obtain the association information corresponding to the defect information; training a pre-constructed text matching model based on the association information to intelligently associate the defect information of the target product with test cases by using the trained text matching model.
[0008] The present application further provides an apparatus for associating product defects with test cases, including: a first construction module, configured to obtain defect information of a target product, and query a plurality of test cases corresponding to the defect information to construct a first test case set according to the plurality of test cases, where the defect information includes a defect title, a module to which the defective function belongs, a defect handler, and a defect description; a second construction module, configured to calculate the hybrid similarity between the defect description and each of the plurality of test cases, determine a plurality of target test cases with the hybrid similarity greater than a preset similarity threshold, and sort the plurality of target test cases in descending order to construct a corresponding second test case set; a detection module, configured to detect whether there is a correct test case in the second test case set, and if it is detected that there is a correct test case in the second test case set, perform an association operation on the defect information and the correct test case, otherwise select a correct test case from the first test case set and perform an association operation on the correct test case and the defect information to obtain the association information corresponding to the defect information; an association module, configured to train a pre-constructed text matching model based on the association information to intelligently associate the defect information of the target product with test cases by using the trained text matching model.
[0009] The present application further provides an electronic device, including: a memory, configured to store a computer program; a processor, configured to implement the steps of any one of the above methods for associating product defects with test cases when executing the computer program.
[0010] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the above-mentioned methods for associating product defects with test cases are implemented.
[0011] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of any one of the above-mentioned methods for associating product defects with test cases are implemented.
[0012] Through the present application, defect information of a target product can be obtained, and multiple test cases corresponding to the defect information can be queried to construct a first test case set according to the multiple test cases. The defect information includes a defect title, a module to which the defective function belongs, a defect handler, and a defect description. Calculate the hybrid similarity between the defect description and each test case in the multiple test cases, and determine multiple target test cases whose hybrid similarity is greater than a preset similarity threshold, and sort the multiple target test cases in descending order to construct a corresponding second test case set. Detect whether there is a correct test case in the second test case set. If a correct test case is detected in the second test case set, an association operation is performed on the defect information and the correct test case. Otherwise, a correct test case is selected from the first test case set, and an association operation is performed on the correct test case and the defect information to obtain association information corresponding to the defect information. Based on the association information, a pre-constructed text matching model is trained to intelligently associate the defect information and test cases of the target product by using the trained text matching model. Therefore, the technical problems in the related art of relying too much on historical data, having a high update cost, and low query efficiency can be solved, and the technical effect of not relying on historical data is achieved, so that the association of defects and use cases can be quickly completed in new projects and new fields, and the maintenance cost is reduced, which is convenient for long-term use. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0014] Figure 1 It is a flowchart of a method for associating product defects with test cases provided according to an embodiment of the present application; Figure 2 It is a schematic diagram of the execution logic of a method for associating product defects with test cases provided in an embodiment of the present application; Figure 3Schematic diagram of the logical architecture of a system for associative analysis of product defects and test cases provided by an embodiment of the present application; Figure 4 Example diagram of an apparatus for associative analysis of product defects and test cases according to an embodiment of the present application.
[0015] Among them, 10 - apparatus for associative analysis of product defects and test cases, 100 - first construction module, 200 - second construction module, 300 - detection module, 400 - association module. Detailed implementation manners
[0016] Next, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0017] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variation thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0018] In order to enable those skilled in the art of the present technology to better understand the solution of the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific implementation manners.
[0019] Combined with the specific application environment architecture or specific hardware architecture on which the execution of the associative analysis method of product defects and test cases depends, the specific application environment architecture or specific hardware architecture is described herein.
[0020] Embodiments of the present application provide an associative analysis method for product defects and test cases.
[0021] As Figure 1 shown, it is a flowchart of the associative analysis method for product defects and test cases in an embodiment of the present application. Among them, the associative analysis method for product defects and test cases includes the following steps: In step S101, obtain the defect information of the target product, and query multiple test cases corresponding to the defect information, so as to construct a first test case set according to the multiple test cases. Among them, the defect information includes the defect title, the module to which the defect function belongs, the defect handler, and the defect description.
[0022] Those skilled in the art should understand that a product defect is a problem, error, or hidden functional defect in a software program that disrupts the normal operation of the program. The existence of this defect will cause the software product to fail to meet the needs of users to some extent.
[0023] Therefore, in order to achieve the intelligent association of defects and test cases, the embodiments of the present application can first obtain defect information such as the defect title, the module to which the defective function belongs, the defect handler, and the defect description corresponding to the product defect, and query the test cases corresponding to the defect information, so as to construct a corresponding test case set (i.e., the first test case set).
[0024] Thus, the embodiments of the present application provide reliable data support for the subsequent similarity calculation and intelligent association of defects and test cases by obtaining the defect information of the product and constructing the corresponding test case set.
[0025] Optionally, in an embodiment of the present application, defect information of a target product is obtained, and multiple test cases corresponding to the defect information are queried to construct a first test case set according to the multiple test cases, where the defect information includes a defect title, the module to which the defective function belongs, the defect handler, and the defect description, including: obtaining the defect information submitted by a target tester, and determining the test cases corresponding to the module to which the defective function belongs and the defect handler in the defect information in a preset test case management system, and the test cases have the same module to which the function belongs and the same field of the R & D responsible person corresponding to the requirement, where each test case includes at least one of a use case title, a precondition, test steps, an expected result, a test case designer, the R & D responsible person corresponding to the requirement, and the module to which the function belongs; determining the corresponding multiple test cases based on the same module to which the function belongs and the same field of the R & D responsible person corresponding to the requirement, so as to construct a first test case set corresponding to the multiple test cases.
[0026] In the actual execution process, when a tester submits a defect, the defect title, the module to which the function belongs, the defect handler, and the defect description need to be filled in, and the defect description includes a precondition, test steps, an expected result, and an actual result.
[0027] After the defect is submitted, the embodiments of the present application can obtain some defect information such as the module to which the defective function belongs and the defect handler in the defect information, so as to obtain the module to which the function belongs and the field of the R & D responsible person corresponding to the requirement of some defect information on the test case management system based on this part of the information, and determine the corresponding multiple test cases based on the corresponding module to which the function belongs and the field of the R & D responsible person corresponding to the requirement (i.e., the test cases have the same module to which the function belongs and the same field of the R & D responsible person corresponding to the requirement as the defect information), and then construct a first test case set corresponding to the multiple test cases.
[0028] It should be noted that in the embodiments of the present application, the test cases on the test case management system are a set of test inputs, execution conditions, and expected results compiled for a specific purpose, used to verify whether a specific software requirement is met. The test cases mainly include parts such as test case title, preconditions, test steps and expected results, test case designer, R & D responsible person corresponding to the requirement, and module to which the function belongs. Among them, the test case title mainly describes the function to be tested; the preconditions refer to the conditions that need to be met for testing this test case; the test steps mainly describe the operation steps of the test case; the expected result refers to meeting the expected requirements (such as development specifications, requirement documents, user requirements, etc.).
[0029] Specifically, the test cases on the test case management system in the embodiments of the present application are shown in Table 1 as follows:
[0030] As can be seen from Table 1, the test case number in the embodiments of the present application is the unique identifier of the test case, which is unique and non - repeatable. And in the embodiments of the present application, the defect - related use case is to associate the test case number with the defect number; the module is the module to which the function tested by the test case belongs, and it is a tree - like structure. For example, there is a user management module on the platform. Under the user management module, there are user and user group modules. If the user module contains disk quota, then the module of the test cases related to disk quota is user management - user - disk quota; the test case title is a brief description of the function tested by the test case; the preconditions indicate the corresponding conditions that need to be met for testing this test case; the test steps mainly describe the operation steps of the test case; the expected result is the expected result of this test case; the R & D responsible person indicates the R & D personnel of this function. When a defect occurs in this function, the corresponding defect can be submitted to the corresponding R & D responsible person.
[0031] In addition, the specific content of the defect information on the defect management system in the embodiments of the present application is shown in Table 2 as follows:
[0032] As can be seen from Table 2, in the embodiments of the present application, the defect number is the unique identifier of the defect. After the tester submits the defect, the defect label automatically increments. The defect - related use case is to associate the test case number with the defect number; the defect management system in the embodiments of the present application can obtain all the modules of the test cases on the test case management system. When the tester submits a defect, the corresponding module can be selected from the drop - down list; the defect title can briefly describe the problem of this defect; the preconditions indicate the conditions that need to be met for this defect to occur; the test steps mainly describe the operation steps when the defect occurs; the expected result indicates the expected result of this operation; the actual result is the actual result of this operation; the R & D responsible person is the R & D personnel of this function, mainly responsible for solving and handling this defect.
[0033] Thus, the embodiments of the present application construct a corresponding first test case set by matching the functional modules and R & D responsible person information of test cases and defects, so as to quickly screen test cases, narrow the query scope and the scope of test cases for similarity comparison, and improve the query and association efficiency.
[0034] In step S102, calculate the hybrid similarity between the defect description and each of the multiple test cases, determine multiple target test cases with the hybrid similarity greater than a preset similarity threshold, and sort the multiple target test cases in descending order to construct a corresponding second test case set.
[0035] Further, the embodiments of the present application also need to calculate the sentence similarity (i.e., hybrid similarity) between the defect description and each test case in the second test case set through a pre-constructed text matching model, and compare the sentence similarity corresponding to each test case with the preset similarity threshold respectively to obtain test cases with the sentence similarity greater than the similarity threshold, that is, multiple target test cases; then, the embodiments of the present application can sort the multiple target test cases in descending order to construct a corresponding second test case set.
[0036] Thus, the embodiments of the present application obtain the second test case set by calculating the hybrid similarity between the defect description and the test cases and combining the similarity threshold, further improving the data basis for realizing the intelligent association between subsequent defects and test cases.
[0037] Optionally, in an embodiment of the present application, calculating the hybrid similarity between the defect description and each of the multiple test cases, determining multiple target test cases with the hybrid similarity greater than a preset similarity threshold, and sorting the multiple target test cases in descending order to construct a corresponding second test case set includes: calculating the hybrid similarity between the defect title and the defect description and each test case in the first test case set based on a preset hybrid similarity calculation rule and a pre-constructed text matching model; comparing the hybrid similarity with the similarity threshold, where, when the hybrid similarity is greater than the similarity threshold, obtaining multiple target test cases corresponding to the hybrid similarity; sorting the multiple target test cases in descending order according to the hybrid similarity to establish a second test case set.
[0038] It should be noted that after obtaining the first test case set, the embodiments of the present application can start calculating the sentence similarity one by one between the defect title, defect description (including preconditions, test steps, and expected results) and the use case title, preconditions, test steps, and expected results of the test cases based on the hybrid similarity calculation rule and the pre-constructed text matching model, that is, the Sentence-BERT (Sentence Bidirectional Encoder Representations from Transformers) model. Among them, the Sentence-BERT model is based on the BERT model and aims to generate a fixed-length vector representation of sentences, so that the semantic similarity between sentences can be measured by vector similarity (such as cosine similarity).
[0039] Secondly, the embodiments of the present application can compare the similarity threshold with the hybrid similarity calculated by the Sentence-BERT model to obtain and output the test cases (i.e., multiple target test cases) whose hybrid similarity between the defect and the test case is greater than the similarity threshold, and sort the multiple target test cases in descending order based on the hybrid similarity to obtain the second test case set.
[0040] Thus, by using the Sentence-BERT model to calculate and analyze the similarity between test case information and defect information, the embodiments of the present application do not rely on historical data, realize the intelligent association between defects and use cases, and have extremely low maintenance costs, which is convenient for long-term use, enabling the quick association of defects and use cases in new projects and new fields.
[0041] Optionally, in an embodiment of the present application, based on the preset hybrid similarity calculation rule and the pre-constructed text matching model, calculating the hybrid similarity between the defect title and the defect description and each test case in the first test case set includes: calculating the title similarity between the use case title in each test case and the defect title; respectively calculating the precondition similarity, test step similarity, and expected result similarity between the preconditions, test steps, and expected results in each test case and the defect description; and performing weighted summation on the title similarity, precondition similarity, test step similarity, and expected result similarity to obtain the hybrid similarity.
[0042] In the actual execution process, the embodiments of the present application can analyze and calculate the hybrid similarity between the defect and the test case through the Sentence-BERT model, which is specifically described as follows: 1. Calculate the similarity similarity1 (i.e., the title similarity) between the defect title and the use case title; 2. Calculate the similarity similarity2 (i.e., the precondition similarity) between the defect precondition in the defect description and the precondition of the test case; 3. Calculate the similarity similarity3 (i.e., the test step similarity) between the defect test step in the defect description and the test step of the test case; 4. Calculate the similarity similarity4 (i.e., the expected result similarity) between the defect expected result in the defect description and the expected result of the test case; 5. Perform a weighted sum of the title similarity, precondition similarity, test step similarity, and expected result similarity to obtain the corresponding hybrid similarity, as shown in the following formula:
[0043] where, represents the hybrid similarity; represents the title similarity; represents the precondition similarity; represents the test step similarity; represents the expected result similarity; represents the title similarity weight parameter; represents the precondition similarity weight parameter; represents the test step similarity weight parameter; represents the expected result similarity weight parameter, and In the actual execution process, those skilled in the art can automatically optimize the corresponding weight parameters according to the actual needs of the project.
[0044] In addition, embodiments of the present application can also calculate the similarity between defects and test cases in other ways. Specifically, as an implementable way, embodiments of the present application can first perform text standardization processing on defect descriptions and test cases. For example, embodiments of the present application can perform term unification, code snippet tokenization, or version number normalization on defect descriptions and test cases; secondly, embodiments of the present application can perform two-channel vectorization operations, that is, input the defect descriptions and test cases after text standardization processing into the Sentence-BERT model to obtain semantic vectors with a fixed dimension (such as 768 dimensions), and use the mean pooling strategy to process long texts to retain the core semantics; thirdly, after the two-channel vectorization operation, embodiments of the present application can perform multi-scale similarity calculation and domain-enhanced post-processing operations to add software engineering-specific similarity correction factors, such as module matching weights and defect type coefficients; further, embodiments of the present application can, based on the hierarchical attention mechanism, strengthen the temporal correlation of the operation step sequence on the test case side, and perform feature interaction on the defect side by focusing on abnormal phenomena and stack information, and can dynamically adjust the importance of two-channel features through a learnable weight matrix; after that, embodiments of the present application can establish an error distribution model of historical matching results to perform Gaussian normalization processing on the current similarity score, so as to obtain the similarity between defects and test cases.
[0045] Thus, embodiments of the present application adopt a hybrid similarity calculation rule, by sequentially comparing the similarities of the title, preconditions, test steps, and expected results, thereby improving the accuracy and efficiency of association through multi-dimensional feature analysis, and can dynamically adjust the feature weights according to different project characteristics to increase adaptability and improve the similarity accuracy.
[0046] In step S103, it is detected whether there is a correct test case in the second test case set. If it is detected that there is a correct test case in the second test case set, an association operation is performed on the defect information and the correct test case. Otherwise, a correct test case is selected from the first test case set, and an association operation is performed on the correct test case and the defect information to obtain the association information corresponding to the defect information.
[0047] Furthermore, embodiments of the present application can determine whether there is a correct test case in the second test case set. If there is a corresponding correct test case, the correct test case can be associated with the corresponding defect. Otherwise, a corresponding correct test case is selected from the first test case set and associated with the corresponding defect to obtain the association information corresponding to the defect information.
[0048] Thus, embodiments of the present application effectively ensure the quality and reliability of defect association by selecting correct test cases from the second test case set or the first test case set.
[0049] Optionally, in an embodiment of the present application, before detecting whether there is a correct test case in the second test case set, it further includes: feeding back the second test case set to the target tester, so that the target tester determines whether to perform an associated defect operation according to the second test case set. When the target tester performs the associated defect operation, a correct test case is selected from the second test case set or the first test case set.
[0050] In the actual execution process, the embodiment of the present application can send the second test case set to the defect management system to feedback the second test case set to the tester through the defect management system; afterwards, the tester can browse the test cases in the second test case set and select whether to perform an associated defect.
[0051] If there is a correct test case in the second test case set, the association between the defect and the correct test case is completed; if there is no correct test case in the second test case set, the entire first test case set is output, so that the tester can select a correct test case from the first test case set for association.
[0052] Thus, the embodiment of the present application selects and analyzes the correct test case from the first test case set or the second test case set by the tester, thereby effectively ensuring the correctness of the association by adding a manual calibration link, providing reliable data support for subsequent model training.
[0053] In step S104, based on the association information, train a pre-constructed text matching model to use the trained text matching model to intelligently associate the defect information and test cases of the target product.
[0054] Afterwards, the embodiment of the present application can fine-tune and train the Sentence-BERT model through the associated correct test cases and defect information (i.e., association information), thereby effectively improving the association efficiency and correctness of the defect information and test cases.
[0055] Optionally, in an embodiment of the present application, based on the association information, train a pre-constructed text matching model to use the trained text matching model to intelligently associate the defect information and test cases of the target product, including: recording the association information in a preset database, and constructing an association training data set according to the association information; using the association training data set to train the pre-constructed text matching model to use the trained text matching model to perform an intelligent association operation on the defect information and test cases.
[0056] It should be noted that the embodiments of the present application can store the association information between the associated defects and correct test cases in the defect and test case database, and construct a corresponding associated training dataset based on the association information to train the Sentence-BERT model through the associated training dataset, so as to achieve the intelligent association of defects and test cases quickly and efficiently.
[0057] As a feasible implementation, the specific process of training the Sentence-BERT model based on the associated test cases and defect information in the embodiments of the present application is as follows: 1. Spatiotemporal association modeling: (1) Construct a version evolution graph of test cases and defects, and extract defect patterns that repeatedly appear across versions as high-weight samples; (2) Perform topological analysis on the association paths of "test case - defect" in historical versions to generate time-series enhanced labels; 2. Multi-granularity semantic decomposition: (1) Decompose test cases into "precondition - operation steps - expected result" triples; (2) Parse defect reports into three-dimensional features of "phenomenon description - stack information - repair solution"; (3) Establish a fine-grained matching relationship at the sub-module level; 3. Progressive training stage: (1) Primary stage: Only train strongly associated pairs with clear causal relationships (such as defects directly referencing test case numbers); (2) Intermediate stage: Introduce potentially associated pairs generated through static analysis (such as code changes affecting the same module); (3) Advanced stage: Add difficult samples generated adversarially (negative examples with similar semantics but actually irrelevant); 4. Adaptive weight assignment: (1) Dynamically adjust the sample weights according to the defect severity level; (2) Assign higher learning priorities to test cases that have discovered critical defects; 5. Software engineering concept graph: (1) Construct a domain knowledge base containing test terms (such as "boundary value analysis") and defect types (such as "null pointer exception"); (2) Add concept node constraints to the model attention layer; 6. Environment-aware training: (1) Label test environment features (development / testing / production); (2) Add an environment consistency regularization term to the loss function.
[0058] Thus, the embodiments of the present application use the associated test cases and defect information to train the Sentence-BERT model, effectively ensuring the reliability and robustness of the Sentence-BERT model.
[0059] It can be understood that when defects and test cases cannot be intelligently associated, the embodiments of the present application enable testers to obtain a small range of test case sets, reducing the search scope of testers, improving the efficiency of testers, and eliminating the need to switch to other entrances.
[0060] The following describes the execution logic of the association analysis method for product defects and test cases of the present application in conjunction with the accompanying drawings.
[0061] Figure 2 It is a schematic diagram of the execution logic of the association analysis method for product defects and test cases of the present application. As Figure 2 shown. The execution process of the association analysis method for product defects and test cases of the present application is as follows: S201: The tester submits a defect; S202: Obtain the defect information corresponding to the defect, including the defect title, the module to which the function belongs, the defect handler, and the defect description (including preconditions, test steps, expected results, and actual results); S203: Query the corresponding test cases according to the module to which the function belongs and the defect handler in the defect information, and construct a first test case set to narrow the query scope; S204: Measure and calculate the hybrid similarity between the defect description and the test cases based on the pre-constructed text matching model; S205: Output multiple test cases corresponding to the hybrid similarity greater than the preset similarity threshold to construct a second test case set; S206: The tester selects test cases to associate with the defect; S207: Determine whether there are correct test cases in the second test case set. If so, go to S208; otherwise, go to S209; S208: Associate the correct test case and the defect; S209: Select the correct test case from the first test case set and associate the correct test case and the defect; S2010: Record the associated defect and the corresponding correct test case in a preset database, and train the text matching model with the associated defect and the corresponding correct test case.
[0062] In addition, the present application can also construct a corresponding association analysis system for product defects and test cases according to the execution logic of the association analysis method for product defects and test cases.
[0063] Figure 3Schematic diagram of the logical architecture of the system for associative analysis of product defects and test cases. As Figure 3 shown, the associative analysis system for product defects and test cases of the present application mainly includes a query module, a text matching model (such as the Sentence-BERT model), and a database. The specific execution logic of the associative analysis system for product defects and test cases is as follows: 1. The test case management system transmits the initial test cases, that is, all test cases, to the query module; 2. The defect management system transmits the module and R & D responsible person in the defect information to the query module, and transmits the defect title, preconditions, test steps, and expected results to the text matching model, such as the Sentence-BERT model.
[0064] 3. The query module queries in the initial test cases according to the module and R & D responsible person to output the corresponding first test case set to the text matching model.
[0065] 4. The text matching model analyzes and calculates the hybrid similarity between the defect and the test case; 5. Sort the first test case set in descending order according to the hybrid similarity. When the hybrid similarity is greater than the preset similarity threshold, output the second test case set to the tester, and the tester selects the correct test case to be associated with the defect; 6. If there is no correct test case in the second test case set, the tester feeds back that there is no correct case to the query module; 7. The query module transmits the first test case set to the tester, and asks the tester to select the correct test case. This test case and the defect information will be recorded in the database and used as a training set to train the text matching model.
[0066] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0067] The embodiments of the present application also provide an associative analysis device for product defects and test cases.
[0068] As Figure 4 shown, the associative analysis device 10 for product defects and test cases includes: a first construction module 100, a second construction module 200, a detection module 300, and an association module 400.
[0069] Among them, the first construction module 100 is used to obtain the defect information of the target product, query multiple test cases corresponding to the defect information, and construct a first test case set according to the multiple test cases. Among them, the defect information includes a defect title, a module to which the defective function belongs, a defect handler, and a defect description.
[0070] The second construction module 200 is used to calculate the hybrid similarity between the defect description and each test case in the multiple test cases, determine multiple target test cases with the hybrid similarity greater than a preset similarity threshold, and sort the multiple target test cases in descending order to construct a corresponding second test case set.
[0071] The detection module 300 is used to detect whether there is a correct test case in the second test case set. If a correct test case is detected in the second test case set, an association operation is performed on the defect information and the correct test case. Otherwise, a correct test case is selected from the first test case set, and an association operation is performed on the correct test case and the defect information to obtain the association information corresponding to the defect information.
[0072] The association module 400 is used to train a pre-constructed text matching model based on the association information, and use the trained text matching model to perform intelligent association on the defect information and test cases of the target product.
[0073] Optionally, in an embodiment of the present application, the first construction module 100 includes: an acquisition unit and a determination unit.
[0074] Among them, the acquisition unit is used to obtain the defect information submitted by the target tester, and determine the test cases corresponding to the module to which the defective function belongs and the defect handler in the defect information in a preset test case management system. And the test cases have the same module to which the function belongs and the same R & D responsible person field corresponding to the requirement. Each test case includes at least one of a case title, a precondition, test steps, an expected result, a test case designer, an R & D responsible person corresponding to the requirement, and a module to which the function belongs.
[0075] The determination unit is used to determine the corresponding multiple test cases based on the same module to which the function belongs and the same R & D responsible person field corresponding to the requirement, and construct a first test case set according to the multiple test cases.
[0076] Optionally, in an embodiment of the present application, the second construction module 200 includes: a calculation unit, a comparison unit, and a descending order unit.
[0077] Among them, the calculation unit is used to calculate the hybrid similarity between the defect title and the defect description and each test case in the first test case set based on a preset hybrid similarity calculation rule and a pre-constructed text matching model.
[0078] A comparison unit for comparing the hybrid similarity with a similarity threshold, wherein, when the hybrid similarity is greater than the similarity threshold, a plurality of target test cases corresponding to the hybrid similarity are obtained.
[0079] A descending unit for sorting the plurality of target test cases in descending order according to the hybrid similarity to establish a second test case set.
[0080] Optionally, in an embodiment of the present application, the calculation unit includes: a first operator unit, a second operator unit, and a weighted summation unit.
[0081] Wherein, the first operator unit is used to calculate the title similarity between the use case title and the defect title in each test case.
[0082] The second operator unit is used to calculate the precondition similarity, test step similarity, and expected result similarity between the precondition, test step, and expected result in each test case and the defect description, respectively.
[0083] The weighted summation unit is used to perform weighted summation on the title similarity, precondition similarity, test step similarity, and expected result similarity to obtain the hybrid similarity.
[0084] Optionally, in an embodiment of the present application, the product defect and test case association analysis device 10 of the present application embodiment further includes: a judgment module for feeding back the second test case set to the target tester before detecting whether there is a correct test case in the second test case set, so that the target tester determines whether to perform an associated defect operation according to the second test case set, wherein, when the target tester performs the associated defect operation, a correct test case is selected from the second test case set or the first test case set.
[0085] Optionally, in an embodiment of the present application, the association module 400 includes: a recording unit and a training unit.
[0086] Wherein, the recording unit is used to record the association information in a preset database and construct an association training data set according to the association information.
[0087] The training unit is used to train a pre-constructed text matching model by using the association training data set to perform an intelligent association operation on defect information and test cases by using the trained text matching model.
[0088] For the description of the features in the corresponding embodiment of the product defect and test case association analysis device, reference can be made to the relevant description of the corresponding embodiment of the product defect and test case association analysis method, which will not be elaborated here one by one.
[0089] An embodiment of the present application further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any of the above-described method embodiments for associative analysis of product defects and test cases.
[0090] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any of the above-described method embodiments for associative analysis of product defects and test cases when running.
[0091] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media that can store computer programs such as USB flash drives, read-only memories (ROM for short), random access memories (RAM for short), external hard drives, magnetic disks, or optical discs.
[0092] An embodiment of the present application further provides a computer program product. The above computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above-described method embodiments for associative analysis of product defects and test cases.
[0093] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above-described method embodiments for associative analysis of product defects and test cases.
[0094] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled artisans can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present application.
[0095] The above has introduced in detail a method, apparatus, device, and medium for analyzing the association between product defects and test cases provided by this application. Specific examples are used in this article to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A method for associative analysis of product defects and test cases, characterized in that, The method includes the following steps: Obtain defect information of a target product, and query a plurality of test cases corresponding to the defect information, so as to construct a first test case set according to the plurality of test cases, where the defect information includes a defect title, a module to which the defective function belongs, a defect handler, and a defect description; Calculate the hybrid similarity between the defect description and each test case in the plurality of test cases, and determine a plurality of target test cases whose hybrid similarity is greater than a preset similarity threshold, and sort the plurality of target test cases in descending order to construct a corresponding second test case set; Detect whether there is a correct test case in the second test case set. If it is detected that there is a correct test case in the second test case set, perform an association operation on the defect information and the correct test case; otherwise, select a correct test case from the first test case set, and perform an association operation on the correct test case and the defect information to obtain associated information corresponding to the defect information; Based on the associated information, train a pre-constructed text matching model, so as to use the trained text matching model to intelligently associate the defect information and test cases of the target product.
2. The method for analyzing the association between product defects and test cases according to claim 1, wherein The step of obtaining defect information of a target product, and querying a plurality of test cases corresponding to the defect information, so as to construct a first test case set according to the plurality of test cases, where the defect information includes a defect title, a module to which the defective function belongs, a defect handler, and a defect description, includes: Obtain defect information submitted by a target tester, and determine test cases corresponding to the module to which the defective function belongs and the defect handler in the defect information in a preset test case management system, and the test cases have the same module to which the function belongs and the same research and development responsible person field corresponding to the requirement, where each test case includes at least one of a use case title, a precondition, test steps, an expected result, a test case designer, a research and development responsible person corresponding to the requirement, and a module to which the function belongs; Based on the same module to which the function belongs and the same research and development responsible person field corresponding to the requirement, determine a corresponding plurality of test cases, so as to construct the first test case set according to the plurality of test cases.
3. The method for analyzing the association between product defects and test cases according to claim 1, wherein The step of calculating the hybrid similarity between the defect description and each test case in the plurality of test cases, and determining a plurality of target test cases whose hybrid similarity is greater than a preset similarity threshold, and sorting the plurality of target test cases in descending order to construct a corresponding second test case set, includes: Calculate the hybrid similarity between the defect title and the defect description and each test case in the first test case set based on a preset hybrid similarity calculation rule and a pre-constructed text matching model; Compare the hybrid similarity with the similarity threshold. In the case where the hybrid similarity is greater than the similarity threshold, obtain a plurality of target test cases corresponding to the hybrid similarity; Sort the plurality of target test cases in descending order according to the hybrid similarity to establish the second test case set.
4. The method for analyzing the association between product defects and test cases according to claim 3, wherein Calculating the hybrid similarity between the defect title and the defect description and each test case in the first test case set based on a preset hybrid similarity calculation rule and a pre-constructed text matching model, including: Calculating the title similarity between the use case title in each test case and the defect title; Respectively calculating the precondition similarity, test step similarity, and expected result similarity between the precondition, test steps, and expected results in each test case and the defect description; Performing a weighted sum of the title similarity, the precondition similarity, the test step similarity, and the expected result similarity to obtain the hybrid similarity.
5. The method for analyzing the association between product defects and test cases according to claim 1, wherein Before detecting whether there is a correct test case in the second test case set, further including: Feeding back the second test case set to the target tester so that the target tester determines whether to perform an associated defect operation according to the second test case set. When the target tester performs the associated defect operation, selecting the correct test case from the second test case set or the first test case set.
6. The method for analyzing the association between product defects and test cases according to claim 1, characterized in that Training a pre-constructed text matching model based on the association information to perform intelligent association of the defect information and test cases of the target product by using the trained text matching model, including: Recording the association information in a preset database and constructing an association training data set according to the association information; Training a pre-constructed text matching model by using the association training data set to perform intelligent association operations on the defect information and test cases by using the trained text matching model.
7. An apparatus for correlative analysis of product defects and test cases, characterized in that Including: A first construction module, configured to obtain defect information of a target product, query a plurality of test cases corresponding to the defect information, and construct a first test case set according to the plurality of test cases, where the defect information includes a defect title, a module to which the defective function belongs, a defect handler, and a defect description; A second construction module, configured to calculate the hybrid similarity between the defect description and each test case in the plurality of test cases, determine a plurality of target test cases whose hybrid similarity is greater than a preset similarity threshold, and perform a descending order sorting on the plurality of target test cases to construct a corresponding second test case set; A detection module, configured to detect whether there is a correct test case in the second test case set. If it is detected that there is a correct test case in the second test case set, performing an association operation on the defect information and the correct test case; otherwise, selecting a correct test case from the first test case set and performing an association operation on the correct test case and the defect information to obtain the association information corresponding to the defect information; An association module, configured to train a pre-constructed text matching model based on the association information to perform intelligent association of the defect information and test cases of the target product by using the trained text matching model.
8. An electronic device, characterized in that, Including: A memory, configured to store a computer program; A processor, configured to implement the steps of the method for analyzing the association between product defects and test cases according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program, when executed by a processor, implements the steps of the method for analyzing the association between product defects and test cases according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the steps of the method for analyzing the association between product defects and test cases according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for generating target case defect prediction model of test case
CN115794647A
Using similarity analysis and machine learning techniques to manage test case information
US20190155572A1