Method and device for analyzing the association between product defects and test cases

By building a hybrid similarity calculation and Sentence-BERT model, the problem of historical data dependence in defect and test case association analysis is solved, and fast and accurate defect and test case association is achieved, which reduces update costs and improves query efficiency.

CN120353712BActive Publication Date: 2025-09-23INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510828170.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2025-09-23
Estimated Expiration
2045-06-19

AI Technical Summary

Technical Problem

The correlation analysis between defects and test cases in existing technologies relies too much on historical data, resulting in incomplete construction in the initial stage, high update costs and low query efficiency. In particular, the response time increases exponentially when there are multiple layers of intermediate nodes or complex attributes.

Method used

By obtaining the defect information of the target product, the first test case set is constructed, the mixed similarity between the defect description and the test case is calculated, the target test cases with a similarity greater than the similarity threshold are screened out, the Sentence-BERT model is used for intelligent association, and the text matching model is trained to achieve rapid association between defects and test cases.

Benefits of technology

Without relying on historical data, it enables rapid association of defects and test cases in new projects and new areas, reduces maintenance costs, and improves query efficiency and association accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120353712B_ABST
    Figure CN120353712B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for analyzing the association between product defects and test cases, which relates to the field of data processing technology. The method comprises: narrowing the scope of use cases for similarity comparison and improving association efficiency by matching functional modules and R&D responsible persons of test cases and defects; using the Sentence-BERT model to calculate and analyze the similarity between test case information and defect information, adopting a hybrid similarity calculation rule to accurately calculate the similarity, and dynamically adjusting feature weights according to the characteristics of different projects to quickly and efficiently complete the intelligent association between defects and use cases. The method solves the technical problems in related technologies of over-reliance on historical data, high update costs, and low query efficiency, and achieves the technical effect of quickly completing the association between defects and use cases in new projects and new fields without relying on historical data, reducing maintenance costs, and facilitating long-term use.
Need to check novelty before this filing date? Find Prior Art

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 functionality, the test case library continues to expand. For mature products, the number of test cases often reaches tens of thousands, forming a massive testing system. During the test execution process, when testers discover defects, they need to associate the defects with the corresponding test cases for subsequent tracking and management. However, with 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 a major bottleneck to improving testing efficiency.

[0003] At present, the existing defect and test case matching method can obtain matching node information and matching path information based on 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 existing technology mainly has the following problems:

[0005] 1. Due to a lack of historical data accumulation, the initial use case-defect association network was incomplete, resulting in poor performance of graph-based recommendation algorithms and analysis models in the early stages.

[0006] 2. Due to demand changes and defect repairs, the association map needs to be continuously updated synchronously, otherwise the association may become invalid;

[0007] 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.

[0008] In summary, existing technologies rely too much on historical data, have high updating costs, and low query efficiency, which urgently need to be solved. Summary of the Invention

[0009] 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 related technologies of over-reliance on historical data, high updating costs, and low query efficiency.

[0010] The present application provides a method for analyzing the association between product defects and test cases, comprising the following steps: obtaining defect information of a target product, and querying multiple test cases corresponding to the defect information to construct a first test case set based on the multiple test cases, wherein the defect information includes a defect title, a module to which the defect function belongs, a defect handler, and a defect description; calculating a mixed similarity between the defect description and each test case in the multiple test cases, and determining multiple target test cases whose mixed similarity is greater than a preset similarity threshold, and sorting the multiple 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 the correct test case exists in the second test case set, associating the defect information with the correct test case; otherwise, selecting a correct test case from the first test case set, and associating the correct test case with the defect information to obtain association information corresponding to the defect information; and training a pre-constructed text matching model based on the association information to intelligently associate the defect information and test cases of the target product using the trained text matching model.

[0011] The present application also provides an apparatus for analyzing the association between product defects and test cases, comprising: a first construction module for obtaining defect information of a target product and querying multiple test cases corresponding to the defect information to construct a first test case set based on the multiple test cases, wherein the defect information includes a defect title, a module to which the defect function belongs, a defect handler, and a defect description; a second construction module for calculating a mixed similarity between the defect description and each of the multiple test cases, determining multiple target test cases whose mixed similarity is greater than a preset similarity threshold, and sorting the multiple target test cases in descending order to construct a corresponding second test case set; a detection module for detecting whether there is a correct test case in the second test case set, and if it is detected that the correct test case exists in the second test case set, associating the defect information with the correct test case; otherwise, selecting a correct test case from the first test case set and associating the correct test case with the defect information to obtain association information corresponding to the defect information; and an association module for training a pre-constructed text matching model based on the association information, so as to intelligently associate the defect information of the target product with the test cases using the trained text matching model.

[0012] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned product defect and test case association analysis methods when executing the computer program.

[0013] 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 of the above-mentioned product defect and test case association analysis methods are implemented.

[0014] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any of the above-mentioned product defect and test case association analysis methods.

[0015] Through the present application, the defect information of the target product can be obtained, and multiple test cases corresponding to the defect information can be queried to construct a first test case set based on the multiple test cases, wherein the defect information includes the defect title, the module to which the defect function belongs, the defect handler and the defect description; the mixed similarity between the defect description and each test case in the multiple test cases is calculated, and multiple target test cases whose mixed similarity is greater than a preset similarity threshold are determined, and the multiple target test cases are sorted in descending order to construct a corresponding second test case set; the defect information is detected to exist in the second test case set, and if the correct test case is detected in the second test case set, the defect information is detected to exist in the second test case set. The information is associated with the correct test case, otherwise the correct test case is selected from the first test case set, and the correct test case is associated with the defect information to obtain the associated information corresponding to the defect information; based on the associated information, a pre-built text matching model is trained to use the trained text matching model to intelligently associate the defect information and test cases of the target product. Therefore, the technical problems in related technologies such as over-reliance on historical data, high updating costs, and low query efficiency can be solved, and the technical effect of not relying on historical data is achieved, so that new projects and new fields can quickly complete the association of defects and use cases, and the maintenance cost is reduced, which is convenient for long-term use. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0017] Figure 1 A flowchart of a method for analyzing the association between product defects and test cases provided in accordance with an embodiment of the present application;

[0018] Figure 2 A schematic diagram of the execution logic of a method for analyzing the association between product defects and test cases provided in one embodiment of the present application;

[0019] Figure 3 A schematic diagram of the logical architecture of a system for analyzing the association between product defects and test cases provided in one embodiment of the present application;

[0020] Figure 4 This is an example diagram of a device for analyzing the association between product defects and test cases according to an embodiment of the present application.

[0021] Among them, 10-product defect and test case correlation analysis device, 100-first construction module, 200-second construction module, 300-detection module, 400-correlation module. DETAILED DESCRIPTION

[0022] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0023] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.

[0024] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0025] In combination with the specific application environment architecture or specific hardware architecture on which the execution of the correlation analysis method between product defects and test cases depends, the specific application environment architecture or specific hardware architecture is described herein.

[0026] The embodiments of the present application provide a method for analyzing the association between product defects and test cases.

[0027] like Figure 1 FIG. 1 is a flowchart of a method for analyzing the association between product defects and test cases according to an embodiment of the present application, wherein the method for analyzing the association between product defects and test cases includes the following steps:

[0028] In step S101, 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 based on the multiple test cases, wherein the defect information includes a defect title, a module to which the defect function belongs, a defect handler, and a defect description.

[0029] 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 may cause the software product to fail to meet the needs of users to some extent.

[0030] Therefore, in order to achieve intelligent association between defects and test cases, the embodiment of the present application can first obtain defect information such as the defect title, the module to which the defect function belongs, the defect handler and the defect description corresponding to the product defect, and query the test case corresponding to the defect information, thereby constructing a corresponding test case set (i.e., the first test case set).

[0031] Therefore, the embodiments of the present application obtain product defect information and construct a corresponding test case set, thereby providing reliable data support for subsequent similarity calculation and intelligent association of defects and test cases.

[0032] Optionally, in one 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 based on the multiple test cases, wherein the defect information includes a defect title, a module to which the defect function belongs, a defect handler, and a defect description, including: obtaining the defect information submitted by the target tester, and determining the test case corresponding to the module to which the defect function belongs and the defect handler in the defect information in a preset test case management system, and the test case and the defect information have the same function module and the same requirement corresponding R&D responsible person field, wherein each test case includes at least one of a case title, preconditions, test steps, expected results, test case designer, requirement corresponding R&D responsible person, and function module; based on the same function module and the same requirement corresponding R&D responsible person field, determine the corresponding multiple test cases to construct a first test case set based on the multiple test cases.

[0033] During the actual execution process, when submitting a defect, the tester needs to fill in the defect title, function module, defect handler and defect description. The defect description includes preconditions, test steps, expected results and actual results.

[0034] After the defect is submitted, the embodiment of the present application can obtain partial defect information such as the function module and defect handler in the defect information, and obtain the function module and requirement corresponding R&D responsible person field corresponding to the partial defect information on the test case management system based on the partial information, and determine the corresponding multiple test cases (that is, the test case and the defect information have the same function module and the same requirement corresponding R&D responsible person field) based on the corresponding function module and requirement corresponding R&D responsible person field, and then construct a first test case set corresponding to multiple test cases.

[0035] It should be noted that in the embodiments of this application, a test case in the test case management system is 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 case mainly includes the use case title, preconditions, test steps and expected results, the test case designer, the R&D person responsible for the requirement, the module to which the function belongs, etc. Among them, the use case title mainly describes the test function; the precondition refers to the condition that must be met to test the use case; the test step mainly describes the operation steps of the use case; and the expected result refers to the compliance with the expected requirements (such as development specifications, requirements documents, user needs, etc.).

[0036] Specifically, the test cases on the test case management system in the embodiment of the present application are shown in Table 1:

[0037]

[0038] As can be seen from Table 1, the test case number in the embodiment of the present application is the unique identifier of the test case, which is unique and non-repeatable, and the defect-associated use case in the embodiment of the present application 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, which is a tree structure. For example, there is a user management module on the platform, and the user management module includes user and user group modules. The user module includes disk quota, then the module of the disk quota-related test case is user management-user-disk quota; the use case title is a brief description of the function tested by the use case; the precondition indicates the corresponding conditions that need to be met for the use case test; the test steps mainly describe the operation steps of the use case; the expected result is the expected result of the use case; the R&D person in charge indicates the R&D personnel of the function. When a defect occurs in the function, the corresponding defect can be submitted to the corresponding R&D person in charge.

[0039] In addition, the specific content of the defect information on the defect management system in the embodiment of the present application is shown in Table 2:

[0040]

[0041] As can be seen from Table 2, in the embodiment of the present application, the defect number is the unique identifier of the defect. After the tester submits the defect, the defect number is automatically incremented. The defect association use case is to associate the test case number with the defect number; the defect management system in the embodiment of the present application can obtain the modules of all test cases on the test case management system. When the tester submits the defect, he can select the corresponding module in the drop-down list; the defect title can briefly describe the problem of the defect; the precondition indicates the conditions that need to be met for the defect to occur; the test steps mainly describe the operation steps for the defect to occur; the expected result indicates the expected result of the operation; the actual result is the actual result of the operation; the R&D person in charge is the R&D personnel of the function, who is mainly responsible for resolving and handling the defect.

[0042] Therefore, the embodiment of the present application can construct a corresponding first test case set by matching the functional modules and R&D responsible person information of the test cases and defects to quickly screen the use cases, narrow the query scope and the use case scope of similarity comparison, and improve the query and association efficiency.

[0043] In step S102, the mixed similarity between the defect description and each test case in the multiple test cases is calculated, and multiple target test cases whose mixed similarity is greater than a preset similarity threshold are determined, and the multiple target test cases are sorted in descending order to construct a corresponding second test case set.

[0044] Furthermore, the embodiments of the present application also need to calculate the sentence similarity (i.e., mixed similarity) between the defect description and each test case in the second test case set through a pre-built text matching model, and compare the sentence similarities corresponding to the test cases with the preset similarity thresholds to obtain test cases whose sentence similarity is greater than the similarity threshold, i.e., multiple target test cases; then, the embodiments of the present application can sort the multiple target test cases in descending order to construct the corresponding second test case set.

[0045] Therefore, the embodiment of the present application calculates the mixed similarity between the defect description and the test case and combines it with the similarity threshold to obtain the second test case set, thereby further improving the data basis for realizing the intelligent association of subsequent defects and test cases.

[0046] Optionally, in one embodiment of the present application, the hybrid similarity between the defect description and each test case in a plurality of test cases is calculated, and a plurality of target test cases whose hybrid similarity is greater than a preset similarity threshold are determined, and the plurality of target test cases are sorted in descending order to construct a corresponding second test case set, including: 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-built text matching model; comparing the hybrid similarity with the similarity threshold, wherein, when the hybrid similarity is greater than the similarity threshold, obtaining a plurality of target test cases corresponding to the hybrid similarity; and sorting the plurality of target test cases in descending order according to the hybrid similarity to establish a second test case set.

[0047] It should be noted that after obtaining the first test case set, the embodiments of the present application can begin to perform one-to-one sentence similarity calculations on the defect title, defect description (including preconditions, test steps, and expected results) and the test case title, preconditions, test steps, and expected results of the test case based on a hybrid similarity calculation rule and a pre-built text matching model, namely the Sentence-BERT (Sentence Bidirectional Encoder Representations from Transformers) model. 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).

[0048] Secondly, the embodiments of the present application can compare the similarity threshold with the mixed similarity calculated by the Sentence-BERT model to obtain and output test cases (i.e., multiple target test cases) whose mixed similarity between defects and test cases is greater than the similarity threshold, and based on the mixed similarity, sort the multiple target test cases in descending order to obtain a second test case set.

[0049] Therefore, the embodiment of the present application uses the Sentence-BERT model to calculate and analyze the similarity between test case information and defect information, without relying on historical data, to achieve intelligent association between defects and use cases, with extremely low maintenance costs, convenient for long-term use, so that new projects and new fields can quickly complete the association between defects and use cases.

[0050] Optionally, in one embodiment of the present application, based on a preset hybrid similarity calculation rule and a pre-built text matching model, the hybrid similarity between the defect title and the defect description and each test case in the first test case set is calculated, including: calculating the title similarity between the use case title and the defect title in each test case; respectively calculating 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; and performing weighted summation of the title similarity, precondition similarity, test step similarity and expected result similarity to obtain the hybrid similarity.

[0051] In the actual implementation process, the embodiments of the present application can analyze and calculate the mixed similarity of defects and test cases through the Sentence-BERT model, as described below:

[0052] 1. Calculate the similarity1 between the defect title and the use case title (i.e., title similarity);

[0053] 2. Calculate the similarity2 between the defect precondition in the defect description and the test case precondition (i.e., precondition similarity);

[0054] 3. Calculate the similarity3 between the defect test steps in the defect description and the test steps of the test case (i.e., test step similarity);

[0055] 4. Calculate the similarity4 between the expected result of the defect in the defect description and the expected result of the test case (i.e., expected result similarity);

[0056] 5. Perform weighted summation of title similarity, precondition similarity, test step similarity, and expected result similarity to obtain the corresponding mixed similarity, as shown in the following formula:

[0057]

[0058] in, Indicates mixed similarity; Indicates title similarity; Indicates precondition similarity; Indicates test step similarity; Indicates the similarity of expected results; 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 ,During the actual implementation process, technical personnel in this field can automatically optimize the ,corresponding weight parameters according to the actual needs of the ,project.

[0059] In addition, the embodiments of the present application can also use other methods to calculate the similarity between defects and test cases. Specifically, as a feasible method, the embodiments of the present application can first perform text standardization on defect descriptions and test cases. For example, the embodiments of the present application can unify the terms of defect descriptions and test cases, tokenize code snippets, or normalize version numbers, etc.; secondly, the embodiments of the present application can perform dual-channel vectorization operations, that is, input the defect descriptions and test cases after text standardization into the Sentence-BERT model to obtain a fixed-dimensional semantic vector (such as 768 dimensions), and use the mean pooling strategy to process long texts to retain the core semantics; thirdly, after the dual-channel vectorization operation, the embodiments of the present application For example, multi-scale similarity calculation and domain enhancement post-processing operations can be performed to add software engineering-specific similarity correction factors, such as module matching weights and defect type coefficients; further, the embodiments of the present application can be based on a hierarchical attention mechanism to strengthen the temporal correlation of the operation step sequence on the test case side, and focus on the feature interaction of abnormal phenomena and stack information on the defect side, and can dynamically adjust the importance of dual-channel features through a learnable weight matrix; thereafter, the embodiments of the present application can establish an error distribution model of the historical matching results to perform Gaussian normalization on the current similarity score, thereby obtaining the similarity between the defect and the test case.

[0060] Therefore, the embodiment of the present application adopts a hybrid similarity calculation rule, which improves the accuracy and efficiency of association through multi-dimensional feature analysis by comparing the similarities of titles, preconditions, test steps and expected results in sequence. It can also dynamically adjust the feature weights according to the characteristics of different projects to increase adaptability and improve similarity accuracy.

[0061] 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, the defect information and the correct test case are associated. Otherwise, the correct test case is selected from the first test case set, and the correct test case and the defect information are associated to obtain the associated information corresponding to the defect information.

[0062] Furthermore, the 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, the corresponding correct test case is selected from the first test case set and associated with the corresponding defect to obtain the associated information corresponding to the defect information.

[0063] Therefore, the embodiment of the present application effectively ensures the quality and reliability of defect association by selecting the correct test case from the second test case set or the first test case set.

[0064] Optionally, in one embodiment of the present application, before detecting whether there is a correct test case in the second test case set, it also includes: feeding back the second test case set to the target tester so that the target tester determines whether to perform the associated defect operation based on the second test case set, wherein when the target tester performs the associated defect operation, the correct test case is selected from the second test case set or the first test case set.

[0065] During the actual execution process, the embodiment of the present application can send the second test case set to the defect management system to feed back the second test case set to the tester through the defect management system; thereafter, the tester can browse the test cases in the second test case set and choose whether to associate defects.

[0066] If the correct test case exists in the second test case set, the association between the defect and the correct test case is completed; if the correct test case does not exist in the second test case set, the entire first test case set is output so that the tester can select the correct test case from the first test case set for association.

[0067] Therefore, the embodiments of the present application select and analyze the correct test cases for 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, and providing reliable data support for subsequent model training.

[0068] In step S104, a pre-built text matching model is trained based on the association information, so as to intelligently associate the defect information and test cases of the target product using the trained text matching model.

[0069] Afterwards, the embodiments of the present application can fine-tune the training of the Sentence-BERT model by associating the correct test cases and defect information (i.e., associated information), thereby effectively improving the efficiency and correctness of associating defect information and test cases.

[0070] Optionally, in one embodiment of the present application, a pre-built text matching model is trained based on the association information, so as 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 based on the association information; using the association training data set to train the pre-built text matching model, so as to use the trained text matching model to perform intelligent association operations on the defect information and test cases.

[0071] It should be noted that the embodiments of the present application can store the association information of the associated defects and correct test cases in a database of defects and test cases, and construct a corresponding association training data set based on the association information, so as to train the Sentence-BERT model through the association training data set, thereby realizing the fast and efficient completion of intelligent association between defects and test cases.

[0072] As an achievable approach, the specific process of training the Sentence-BERT model based on the associated test cases and defect information in the embodiment of the present application is as follows:

[0073] 1. Spatiotemporal correlation modeling:

[0074] (1) Construct a version evolution graph of test cases and defects, and extract defect patterns that recur across versions as high-weight samples;

[0075] (2) Perform topological analysis on the “test case-defect” association path in historical versions and generate timing enhancement labels;

[0076] 2. Multi-granularity semantic decomposition:

[0077] (1) Decompose the test case into a triplet of “preconditions-operation steps-expected results”;

[0078] (2) Defect reports are parsed into three-dimensional features: “phenomenon description – stack information – repair solution”;

[0079] (3) Establish fine-grained matching relationships at the sub-module level;

[0080] 3. Progressive training stage:

[0081] (1) Primary stage: only train strong association pairs with clear causal relationships (e.g., defects directly referencing test case numbers);

[0082] (2) Intermediate stage: Introducing potential association pairs generated by static analysis (e.g., code changes affecting the same module);

[0083] (3) Advanced stage: Adding difficult examples generated by adversarial means (negative examples that are semantically similar but actually irrelevant);

[0084] 4. Adaptive weight allocation:

[0085] (1) Dynamically adjust sample weights based on defect severity;

[0086] (2) Give higher learning priority to test cases that have discovered critical defects;

[0087] 5. Software Engineering Concept Map:

[0088] (1) Build a domain knowledge base containing test terms (such as "boundary value analysis") and defect types (such as "null pointer exception");

[0089] (2) Adding concept node constraints to the model attention layer;

[0090] 6. Environmental perception training:

[0091] (1) Label the test environment characteristics (development / testing / production);

[0092] (2) Add an environment consistency regularization term to the loss function.

[0093] Therefore, 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.

[0094] It is understandable that when defects and test cases cannot be intelligently associated, the embodiments of the present application can enable testers to obtain a small set of test cases, reducing the tester's search scope, improving the tester's efficiency, and eliminating the need to switch to other entrances.

[0095] The following describes the execution logic of the method for analyzing the association between product defects and test cases of this application in conjunction with the accompanying drawings.

[0096] Figure 2 This is a schematic diagram of the execution logic of the method for analyzing the association between product defects and test cases in this application. Figure 2 The execution process of the product defect and test case correlation analysis method of this application is as follows:

[0097] S201: Tester submits defect;

[0098] S202: Obtain defect information corresponding to the defect, including the defect title, function module, defect handler, and defect description (including preconditions, test steps, expected results, and actual results);

[0099] S203: Constructing a first test case set based on the function module in the defect information and the test cases corresponding to the defect handler query to narrow the query scope;

[0100] S204: Measure the hybrid similarity between computational defect descriptions and test cases based on a pre-built text matching model;

[0101] S205: Outputting a plurality of test cases corresponding to the mixed similarity being greater than a preset similarity threshold, to construct a second test case set;

[0102] S206: The tester selects a test case to associate with a defect;

[0103] S207: Determine whether there is a correct test case in the second test case set. If so, go to S208; otherwise, go to S209;

[0104] S208: Associate correct test cases and defects;

[0105] S209: Selecting a correct test case from the first test case set, and associating the correct test case with the defect;

[0106] S2010: Record the associated defects and the corresponding correct test cases into a preset database, and train a text matching model using the associated defects and the corresponding correct test cases.

[0107] In addition, the present application can also execute logic to construct a corresponding product defect and test case association analysis system based on the product defect and test case association analysis method.

[0108] Figure 3 The following is a diagram of the logical architecture of the product defect and test case correlation analysis system. Figure 3 As shown, the product defect and test case association analysis system of this 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 product defect and test case association analysis system is as follows:

[0109] 1. The test case management system transfers the initial test cases, i.e., all test cases, to the query module;

[0110] 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.

[0111] 3. The query module queries the initial test cases based on the modules and R&D responsible persons to output the corresponding first test case set to the text matching model.

[0112] 4. The text matching model analyzes and calculates the mixed similarity between defects and test cases;

[0113] 5. Sort the first test case set in descending order according to the mixed similarity. When the mixed similarity is greater than a preset similarity threshold, output the second test case set to the tester, who then selects the correct test case to associate with the defect.

[0114] 6. If there is no correct test case in the second test case set, the tester will report that there is no correct test case to the query module;

[0115] 7. The query module transmits the first test case set to the tester, who is asked to select the correct test case. The test case and defect information will be recorded in the database and used as a training set to train the text matching model.

[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.

[0117] The embodiments of the present application also provide a device for analyzing the association between product defects and test cases.

[0118] like Figure 4 As shown, the device 10 for analyzing the association between 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 .

[0119] Among them, the first construction module 100 is used to obtain the defect information of the target product and query multiple test cases corresponding to the defect information to construct a first test case set based on the multiple test cases, wherein the defect information includes the defect title, the module to which the defect function belongs, the defect handler and the defect description.

[0120] The second construction module 200 is used to calculate the mixed similarity between the defect description and each test case in the multiple test cases, and determine multiple target test cases whose mixed 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.

[0121] The detection module 300 is used 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, the defect information and the correct test case are associated. Otherwise, the correct test case is selected from the first test case set, and the correct test case and the defect information are associated to obtain the associated information corresponding to the defect information.

[0122] The association module 400 is used to train a pre-built text matching model based on the association information, so as to use the trained text matching model to intelligently associate the defect information and test cases of the target product.

[0123] Optionally, in one embodiment of the present application, the first building module 100 includes: an acquiring unit and a determining unit.

[0124] Among them, the acquisition unit is used to obtain the defect information submitted by the target tester, and determine the module to which the defect function in the defect information belongs and the test case corresponding to the defect handler in the preset test case management system, and the test case and the defect information have the same function module and the same requirement corresponding R&D responsible person field, wherein each test case includes at least one of the use case title, preconditions, test steps, expected results, test case designer, requirement corresponding R&D responsible person and function module.

[0125] The determination unit is used to determine multiple corresponding test cases based on modules belonging to the same function and R&D responsible person fields corresponding to the same requirements, so as to construct a first test case set based on the multiple test cases.

[0126] Optionally, in one embodiment of the present application, the second building module 200 includes: a calculation unit, a comparison unit, and a descending unit.

[0127] 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-built text matching model.

[0128] The comparison unit is configured to compare the mixed similarity with a similarity threshold, wherein when the mixed similarity is greater than the similarity threshold, a plurality of target test cases corresponding to the mixed similarity are obtained.

[0129] The descending unit is used to sort the multiple target test cases in descending order according to the mixed similarity to establish a second test case set.

[0130] Optionally, in one embodiment of the present application, the calculation unit includes: a first operator unit, a second operator unit and a weighted summation unit.

[0131] The first operator unit is used to calculate the title similarity between the use case title and the defect title in each test case.

[0132] The second operator unit is used to respectively 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.

[0133] The weighted summation unit is used to perform weighted summation on the title similarity, the precondition similarity, the test step similarity and the expected result similarity to obtain the mixed similarity.

[0134] Optionally, in one embodiment of the present application, the product defect and test case association analysis device 10 of the embodiment of the present application also includes: a judgment module, which is used to feed 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 can judge whether to perform the associated defect operation based on the second test case set, wherein when the target tester performs the associated defect operation, the correct test case is selected from the second test case set or the first test case set.

[0135] Optionally, in one embodiment of the present application, the association module 400 includes: a recording unit and a training unit.

[0136] The recording unit is used to record the associated information in a preset database and construct an associated training data set based on the associated information.

[0137] The training unit is used to train a pre-built text matching model using an associated training data set, so as to use the trained text matching model to perform intelligent association operations on defect information and test cases.

[0138] For the description of the features in the embodiment corresponding to the device for analyzing the association between product defects and test cases, please refer to the relevant description of the embodiment corresponding to the method for analyzing the association between product defects and test cases, which will not be repeated here.

[0139] An embodiment of the present application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned product defect and test case association analysis method embodiments.

[0140] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps of any of the above-mentioned product defect and test case association analysis method embodiments when running.

[0141] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0142] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above-mentioned product defect and test case association analysis method embodiments are implemented.

[0143] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps in any of the above-mentioned product defect and test case association analysis method embodiments.

[0144] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0145] The above is a detailed introduction to the method, device, equipment and medium for analyzing the association between product defects and test cases provided by this application. Specific examples are used herein to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the scope of protection of the claims of this application.

Claims

1. A method for analyzing the association between product defects and test cases, characterized in that: The following steps are involved: Obtaining defect information of a target product, and querying multiple test cases corresponding to the defect information to construct a first test case set based on the multiple test cases, wherein the defect information includes a defect title, a module to which the defect function belongs, a defect handler, and a defect description; Performing text normalization on the defect description and the multiple test cases, and based on a pre-built text matching model, performing dual-channel vectorization and mean pooling operations on the text-normalized defect description and test cases to obtain semantic vectors corresponding to the text-normalized defect description and test cases, performing multi-scale similarity calculation on the semantic vectors of the defect description and the test cases to obtain corresponding current similarity scores, performing domain enhancement processing based on the defect description and the test cases to construct a corresponding similarity correction factor, optimizing the current similarity score according to the similarity correction factor and a preset hierarchical attention mechanism, and constructing an error distribution model based on preset historical matching results to perform Gaussian normalization on the optimized current similarity score through the error distribution model, calculating the mixed similarity between the defect description and each test case in the multiple test cases, determining multiple target test cases whose mixed similarity is greater than a preset similarity threshold, and sorting the multiple target test cases in descending order to construct a corresponding second test case set; detecting whether a correct test case exists in the second test case set; if the correct test case exists 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 association information corresponding to the defect information; Based on the association information, a pre-built text matching model is trained to intelligently associate the defect information and test cases of the target product using the trained text matching model.

2. The method for analyzing the association between product defects and test cases according to claim 1, characterized in that: The step of obtaining defect information of a target product and querying multiple test cases corresponding to the defect information to construct a first test case set based on the multiple test cases, wherein the defect information includes a defect title, a module to which the defect function belongs, a defect handler, and a defect description, including: Obtain defect information submitted by a target tester, and determine the module to which the defect function in the defect information belongs and the test case corresponding to the defect handler in a preset test case management system, wherein the test case and the defect information have the same function module and the same requirement corresponding R&D responsible person field, wherein each test case includes at least one of a case title, preconditions, test steps, expected results, test case designer, requirement corresponding R&D responsible person, and function module; Based on the modules to which the same function belongs and the R&D responsible person fields corresponding to the same requirements, a corresponding plurality of test cases are determined 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 calculating the mixed similarity between the defect description and each test case in the plurality of test cases, determining a plurality of target test cases whose mixed 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: 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-built text matching model; comparing the mixed similarity with the similarity threshold, wherein, when the mixed similarity is greater than the similarity threshold, obtaining a plurality of target test cases corresponding to the mixed similarity; The plurality of target test cases are sorted in descending order according to the mixed 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, characterized in that: The calculating, based on a preset hybrid similarity calculation rule and a pre-built text matching model, 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; Calculating the similarity of preconditions, test steps and expected results between the preconditions, test steps and expected results in each test case and the defect description respectively; The title similarity, the precondition similarity, the test step similarity and the expected result similarity are weightedly summed to obtain the mixed 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, the method further includes: The second test case set is fed back to the target tester so that the target tester determines whether to perform the associated defect operation based on the second test case set, wherein when the target tester performs the associated defect operation, the correct test case is selected 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, wherein: The step of training a pre-built text matching model based on the association information, and intelligently associating the defect information and test cases of the target product using the trained text matching model, includes: Recording the associated information in a preset database, and constructing an associated training data set based on the associated information; The pre-built text matching model is trained using the associated training data set, so as to perform intelligent association operations on the defect information and test cases using the trained text matching model.

7. A device for analyzing the association between product defects and test cases, characterized in that: include: A first construction module is configured to obtain defect information of a target product and query multiple test cases corresponding to the defect information to construct a first test case set based on the multiple test cases, wherein the defect information includes a defect title, a module to which the defect function belongs, a defect handler, and a defect description; a second construction module, configured to perform text normalization on the defect description and the multiple test cases, and based on a pre-built text matching model, perform dual-channel vectorization and mean pooling operations on the text-normalized defect description and test cases to obtain semantic vectors corresponding to the text-normalized defect description and test cases, perform multi-scale similarity calculation on the semantic vectors of the defect description and the test cases to obtain corresponding current similarity scores, perform domain enhancement processing based on the defect description and the test cases to construct a corresponding similarity correction factor, optimize the current similarity score according to the similarity correction factor and a preset hierarchical attention mechanism, and construct an error distribution model based on a preset historical matching result to perform Gaussian normalization processing on the optimized current similarity score through the error distribution model, calculate the mixed similarity between the defect description and each of the multiple test cases, determine multiple target test cases whose mixed 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; a detection module, configured to detect whether a correct test case exists in the second test case set; if the correct test case is detected to exist in the second test case set, then associating the defect information with the correct test case; otherwise, selecting a correct test case from the first test case set and associating the correct test case with the defect information to obtain associated information corresponding to the defect information; The association module is used to train a pre-built text matching model based on the association information, so as to use the trained text matching model to intelligently associate the defect information and test cases of the target product.

8. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the method for analyzing the association between product defects and test cases as claimed in any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the method for analyzing the association between product defects and test cases according to any one of claims 1 to 6 are implemented.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method for analyzing the association between product defects and test cases as claimed in any one of claims 1 to 6 are implemented.