Defect diagnosis and positioning method and system and storage medium

Through the multi-agent collaborative driving method, the problems of low efficiency in the diagnosis of software defects and insufficient positioning accuracy in the prior art are solved, efficient diagnosis and precise positioning of software defects are achieved, and the efficiency and quality of software testing are improved.

CN120086052AActive Publication Date: 2025-06-03NINETECH INFORMATION TECH (SHENZHEN) CO LTD +1

Patent Information

Application Number
CN202510520412.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-06-03
Estimated Expiration
2045-04-24

AI Technical Summary

Technical Problem

In the prior art, the software defect diagnosis process is inefficient and the accuracy of positioning defect locations is insufficient, especially when dealing with large-scale software systems, which requires a lot of time and manpower, and lack flexibility and adaptability.

Method used

The method of multi-agent collaborative driving is adopted to define data acquisition agents, rule matching agents, abnormal detection agents and diagnostic inference agents. Through the collaborative work of these agents, data from all levels of the software system is collected, rule matching, abnormal detection and diagnostic inference are performed, and defect locations are determined.

Benefits of technology

It improves the efficiency and accuracy of the software defect diagnosis process, can identify and locate software defects faster and more accurately, and improves the efficiency and quality of software testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120086052A_ABST
    Figure CN120086052A_ABST
Patent Text Reader

Abstract

The invention relates to a defect diagnosis and positioning method, which comprises the following steps of: acquiring data of each layer of a software system through a data acquisition agent, matching the data of the software system by a rule matching agent according to a preset rule and a case library, identifying and determining a rule error mode, the anomaly detection agent performs recognition detection on the data based on a machine learning algorithm, recognizes and determines an abnormal fluctuation mode, finally performs diagnostic reasoning according to the diagnostic reasoning agent in combination with the recognition result of the rule error mode and the abnormal fluctuation mode, determines a defect position, and performs cooperative driving through a plurality of agents. Different abnormal modes of a software system are detected, inference diagnosis is performed by fusing identification results of the abnormal modes, and finally the defect position is positioned, so that intelligent diagnosis and accurate positioning of software test defects are realized, and the efficiency and quality of software test are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of software testing, and particularly to a method, a system and a storage medium for defect diagnosis and location. Background Art

[0002] With the continuous expansion of the scale and the improvement of the complexity of software systems, the location and diagnosis of software defects have become an important link to ensure the stability and reliability of the systems. The existing software testing defect diagnosis methods mainly rely on preset rules and fixed test cases. Testers usually need to manually define various possible defect patterns before testing, and compare and analyze the data during the operation of the system according to these patterns. Especially when dealing with large-scale software systems, it may take a lot of time and manpower, lacking flexibility and adaptability.

[0003] In the prior art, the diagnosis of software systems is usually executed sequentially, and each test link is independent of each other, lacking effective coordination and communication, resulting in low efficiency of the diagnosis process. The data collected during the software testing process may have noise, missing values or error information, which will affect the accuracy of defect diagnosis.

[0004] In view of this, there are still many problems in the defects of testing software systems in the prior art, and there is an urgent need for a method for defect diagnosis and location to break through the bottleneck of the prior art. Summary of the Invention

[0005] The present application provides a method, a system and a storage medium for defect diagnosis and location to solve the problems of low efficiency in the process of diagnosing defects and insufficient accuracy in locating the defect positions in the prior art.

[0006] In a first aspect, the present application provides a method for defect diagnosis and location, including: defining a plurality of agents, where the agents are used to cooperate and drive to test a software system, and the agents include a data collection agent, a rule matching agent, an anomaly detection agent and a diagnostic reasoning agent; collecting data from various levels of the software system according to the data collection agent to obtain data feature information; matching the data feature information according to the rule matching agent according to preset rules and a case library to identify and determine a rule error pattern; identifying and detecting the data feature information based on a machine learning algorithm according to the anomaly detection agent to identify and determine an abnormal fluctuation pattern; performing diagnostic reasoning according to the diagnostic reasoning agent in combination with the identification results of the rule error pattern and the abnormal fluctuation pattern to determine the defect position.

[0007] Optionally, collecting data from various levels of the software system according to the data collection agent to obtain data feature information, including: Collecting data from various levels of the software system, where the data includes execution code, intermediate results, configuration information, and user input data; Preprocessing the data and extracting the feature information of the data to obtain data feature information, where the data feature information includes statistical features, structural features, and semantic features.

[0008] Optionally, the rule error mode includes a logical error mode and an abnormal data mode. Matching the data feature information according to the rule matching agent according to preset rules and a case library, identifying and determining the rule error mode, including: Matching the data feature information according to the preset rules. When it is recognized that the data feature information does not conform to the preset rules, determining the logical error mode; Matching the data feature information and the case library. When it is recognized that the data feature information matches the defective cases in the case library, determining the abnormal data mode.

[0009] Optionally, the abnormal fluctuation mode includes a performance anomaly mode and an abnormal data mode. Identifying and detecting the data feature information based on a machine learning algorithm according to the anomaly detection agent, identifying and determining the abnormal fluctuation mode, including: Learning the distribution and change rules of preset performance indicators based on a machine learning algorithm, identifying performance anomalies in the data feature information, and determining the performance anomaly mode; Identifying abnormal data in the data feature information based on a machine learning algorithm and determining the abnormal data mode, where the abnormal data includes mutations and deviations from the normal range.

[0010] Optionally, the diagnostic reasoning agent combines the recognition results of the rule error mode and the abnormal fluctuation mode for diagnostic reasoning to determine the defect location, including: Analyzing the association between the recognition results of the rule error mode and the abnormal fluctuation mode to obtain fusion information; Performing diagnostic reasoning on the fusion information based on an inference algorithm to determine the defect location.

[0011] Optionally, the inference algorithm includes rule inference, case inference, and model inference. The diagnostic reasoning agent performs diagnostic reasoning on the fusion information based on the inference algorithm to determine the defect location, including: Inferring the fusion information according to preset rules based on the rule inference to judge the first position range of the defect; Retrieve from the case library based on the case-based reasoning and the first position range of the defect, and determine the second position range of the defect; Input the second position range of the defect and the model-based reasoning into a preset simulation model to locate the specific position of the defect.

[0012] Optionally, the method for identifying abnormal data of the data feature information based on a machine learning algorithm and determining an abnormal data pattern includes: Input the data feature information into a trained logistic regression model based on a supervised learning algorithm, classify the data feature information, calculate an abnormal probability, and screen for first abnormal data; Cluster the data feature information based on an unsupervised learning algorithm, analyze the data distribution, and identify second abnormal data not detected by the supervised learning algorithm; Fuse the first abnormal data and the second abnormal data to determine the abnormal data pattern.

[0013] In a second aspect, the present application provides a defect diagnosis and location system, where the system includes: A defined agent module for defining a plurality of agents, where the agents are used to cooperatively drive to test a software system, and the agents include a data collection agent, a rule matching agent, an anomaly detection agent, and a diagnostic reasoning agent; A data acquisition module for collecting data from various levels of the software system according to the data collection agent to obtain data feature information; A rule matching module for matching the data feature information according to the rule matching agent according to preset rules and a case library, and identifying and determining a rule error pattern; An anomaly detection module for identifying and detecting the data feature information based on a machine learning algorithm according to the anomaly detection agent, and identifying and determining an abnormal fluctuation pattern; A diagnostic reasoning module for performing diagnostic reasoning according to the diagnostic reasoning agent in combination with the recognition results of the rule error pattern and the abnormal fluctuation pattern to determine the defect location.

[0014] In a third aspect, an embodiment of the present application provides a terminal device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the method as described above when executing the computer program.

[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program implements the method as described above when executed by a processor.

[0016] The above technical solution provided by the embodiments of the present application has the following advantages compared with the prior art: The present application collects data at all levels of the software system through data collection agents, which is conducive to comprehensively and efficiently collecting various relevant data. Among them, the rule matching agent matches the data of the software system according to preset rules and a case library, identifies and determines rule error patterns, and the anomaly detection agent identifies and detects the data based on machine learning algorithms, identifies and determines abnormal fluctuation patterns. By the collaborative drive of multiple agents, different agents are respectively responsible for testing different modules or business processes, detecting different abnormal patterns of the software system, which is conducive to accurately identifying software defect characteristics and pattern difficulties, and improving the efficiency in the defect diagnosis process. Finally, according to the diagnosis and reasoning agent, diagnosis and reasoning are carried out in combination with the recognition results of rule error patterns and abnormal fluctuation patterns to determine the defect location, which is conducive to realizing the intelligent diagnosis and accurate positioning of software test defects, and improving the efficiency and quality of software testing. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present invention and, together with the specification, are used to explain the principles of the present invention.

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0018] One or more embodiments are exemplarily illustrated by the pictures in the corresponding accompanying drawings. These exemplary illustrations do not limit the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements, unless otherwise stated, and the drawings in the figures do not constitute a proportional limitation.

[0019] Figure 1 It is a schematic flowchart of a defect diagnosis and location method provided by the embodiments of the present application; Figure 2 It is a schematic structural diagram of a defect diagnosis and location system provided by the embodiments of the present application; Figure 3 It is a schematic structural diagram of a computer-readable storage medium provided by the embodiments of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are some, but not all, of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the scope of protection of this application.

[0021] The following disclosure provides many different embodiments or examples for implementing different structures of the present invention. To simplify the disclosure of the present invention, components and settings of specific examples are described below. Of course, they are only examples and are not intended to limit the present invention. In addition, the present invention may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplification and clarity and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0022] Figure 1 A method for defect diagnosis and location provided for the embodiments of this application, the method includes: S100, define multiple agents, where the agents are used to cooperate and drive to test a software system, and the agents include a data collection agent, a rule matching agent, an anomaly detection agent, and a diagnostic reasoning agent.

[0023] In the embodiments of this application, an Agent refers to a program or entity that can autonomously perceive the environment and make decisions, commonly found in AI, distributed systems, or software architectures. An Intelligent Agent refers to one that can autonomously learn, perceive, make decisions, and act, such as a chatbot or an autonomous driving algorithm. Information interaction and collaborative work are carried out between each Agent through a defined communication protocol. They can request and provide data, share knowledge, and reasoning results with each other according to task requirements. For example, the data collection Agent sends the collected data to the rule matching Agent and the anomaly detection Agent for analysis, and the diagnostic reasoning Agent makes a comprehensive judgment based on the results of rule matching and anomaly detection. Through the collaborative driving of multiple agents in this application, different agents are respectively responsible for testing different modules or business processes of the software system, detecting different abnormal patterns of the software system, which is beneficial to accurately identifying software defect characteristics and pattern difficulties and improving the efficiency in the defect diagnosis process.

[0024] S200, collect data from all levels of the software system according to the data collection agent to obtain data feature information.

[0025] Specifically, the data collection agent collects data from various levels of the software system to obtain data feature information, including: S201, collect data from various levels of the software system, where the data includes execution code, intermediate results, configuration information, and user input data.

[0026] Facing complex software systems, it is difficult for traditional methods to comprehensively and efficiently collect various relevant data. In the embodiments of this application, the data collection agent is responsible for collecting relevant data from different components, modules, and operating environments of the software system. These data not only include the execution code and intermediate results of the software, but also the configuration information of the system, user input data, etc., such as system logs, user operation records, performance metrics, etc. By collecting multi-source data, more comprehensive software operation status information can be obtained.

[0027] S202, preprocess the data and extract the feature information of the data to obtain data feature information, where the data feature information includes statistical features, structural features, and semantic features.

[0028] The data collected during the software testing process may contain noise, missing values, or error information, which will all affect the accuracy of defect diagnosis. In the embodiments of this application, preprocessing operations such as cleaning, transforming, and feature extraction are performed on the collected raw data. Cleaning the data can remove noise and error data, improving the quality of the data. Transforming the data can unify different formats of data for subsequent analysis. Feature extraction is to extract valuable features for defect diagnosis from massive data, reducing the dimension and complexity of the data, which is beneficial to improving the accuracy of defect diagnosis.

[0029] In the embodiments of this application, machine learning and data mining techniques are used to extract features related to software defects from the preprocessed data. These features can be statistical features of the data (such as mean, variance, frequency, etc.), structural features (such as the call relationship of code, the dependency relationship of data, etc.), or semantic features (such as code comments, variable names, etc.). By extracting these features, complex software data can be transformed into feature vectors that are easy to analyze and understand, which is beneficial to data processing to obtain data feature information.

[0030] In this application, both the rule matching agent and the anomaly detection agent can use the extracted features for pattern recognition. Among them, the rule matching agent matches the feature vectors according to a preset rule library to find data that conforms to known defect patterns; the anomaly detection agent, through a trained model, identifies abnormal features that are different from the normal pattern. These abnormal features may imply potential defects in the software. Detecting different abnormal patterns in the software system is beneficial to accurately identifying software defect features and pattern difficulties, and is conducive to improving the efficiency in the defect diagnosis process. This will be described one by one through S300 and S400 below.

[0031] S300: The rule matching agent matches the data feature information according to the preset rules and case library, and identifies and determines the rule error pattern.

[0032] In the embodiment of this application, the rule matching agent is used to match the collected data according to the preset rules and patterns to discover potential abnormal situations. The basis of the rule matching agent is constructed by preset rules and patterns, and can be analyzed and summarized based on the past fault data and defect reports of the software system.

[0033] Specifically, the rule error pattern includes a logic error pattern and an abnormal data pattern. The rule matching agent matches the data feature information according to the preset rules and case library, and identifies and determines the rule error pattern, including: S301: Match the data feature information according to the preset rules. When it is identified that the data feature information does not conform to the preset rules, determine the logic error pattern.

[0034] In the embodiment of this application, the logic error pattern includes conditional judgment errors and loop logic errors in the code. For example: In a piece of code for calculating the total price of goods, if the conditional judgment statement wrongly writes the discount calculation logic, resulting in incorrect discount application, it is determined to belong to the logic error pattern. The rule matching agent can identify such patterns by checking the consistency between the code logic structure and the preset correct logic rules.

[0035] In the embodiment of this application, by identifying the matching of data feature information and preset rules, when it is identified that the data feature information does not conform to the preset rules, it means that the data has conditional judgment errors, logical loop errors, etc., and it is determined to belong to the logic error pattern, and at the same time, the logic error result is detected.

[0036] S302: Match the data feature information and the case library. When it is identified that the data feature information matches the defect cases in the case library, determine the abnormal data pattern.

[0037] In the embodiments of the present application, the abnormal data patterns include data missing, data type errors, data values exceeding reasonable ranges, etc. In database operations, if a field that should be an integer type inserts string data, or a key piece of data is lost during transmission, it belongs to the data abnormal pattern.

[0038] For example, in an e-commerce system, there was once a situation where the order status was not updated for a long time after a user placed an order. After investigation, it was found that when the order processing module interacted with the inventory module, the inventory data update was delayed, resulting in the order status being unable to be changed in a timely manner. Based on this, a rule can be set: when the order is generated for more than a certain time (such as 10 minutes) and the inventory module does not return a confirmation update message, it is determined as an abnormal situation.

[0039] On the other hand, industry regulations and best practices are also important sources of rules. Taking financial software as an example, according to the data security regulations in the financial industry, it is required that users' sensitive information (such as ID numbers, bank card numbers) must be encrypted during transmission and storage. Therefore, a rule can be set: check whether the sensitive information fields use an encryption algorithm that complies with industry standards (such as the AES encryption algorithm) during data transmission and storage. If not, it is regarded as abnormal. After collecting the data during the operation of the software system, the rule matching agent starts to work. It first preprocesses the data to extract key information and features. Once the rule matching agent finds that the data does not match the case data in the database, that is, it discovers a potential abnormal situation and determines the abnormal data pattern.

[0040] It should be noted that the logical error patterns that the rule matching agent can identify are mainly determined by whether they match the preset rules, and the abnormal data patterns are mainly determined by whether they match the case data in the preset database. Both abnormal patterns are determined through the preset matching mechanism.

[0041] S400, based on the abnormal detection agent, perform identification and detection on the data feature information based on a machine learning algorithm, and identify and determine the abnormal fluctuation pattern.

[0042] The abnormal fluctuation pattern includes a performance abnormal pattern and an abnormal data pattern. The performing identification and detection on the data feature information based on a machine learning algorithm by the abnormal detection agent to identify and determine the abnormal fluctuation pattern includes: S401, learn the distribution and variation rules of preset performance indicators based on a machine learning algorithm, identify the performance abnormality in the data feature information, and determine the performance abnormal pattern.

[0043] In the embodiments of the present application, the performance anomaly mode is manifested as too long software response time, too high or too low resource utilization rate, etc. When the software is processing a large amount of data, the CPU usage rate continuously exceeds 90%, and the response time extends from the original second level to dozens of seconds, which is the performance anomaly mode. The anomaly detection agent uses machine learning algorithms to learn the distribution and variation rules of normal performance indicators, so as to identify such anomalies.

[0044] S402. Identify the abnormal data of the data feature information based on the machine learning algorithm, and determine the abnormal data mode, where the abnormal data includes mutations and deviations from the normal range.

[0045] In the embodiments of the present application, the abnormal data mode includes data loss, data type error, data value exceeding the reasonable range, etc. The anomaly detection agent can check and identify the type, integrity and value range of the data.

[0046] Specifically, the machine learning algorithm is mainly divided into supervised learning and unsupervised learning. The identifying the abnormal data of the data feature information based on the machine learning algorithm and determining the abnormal data mode includes: S4021. Input the data feature information into the trained logistic regression model based on the supervised learning algorithm, classify the data feature information, calculate the anomaly probability and screen the first abnormal data.

[0047] In the embodiments of the present application, the process of the supervised learning algorithm is as follows: First, the anomaly detection agent will first use the existing labeled data, that is, a data set containing normal and abnormal data samples for model training. For example, using a logistic regression model, during the training process, the model will learn the feature boundaries between normal data and abnormal data. Taking network traffic data as an example, under normal circumstances, the size and request frequency of network traffic are within a certain range. When the rule matching agent triggers the network traffic anomaly rule according to rule matching or case base matching and the match fails, the anomaly detection agent inputs the data related to network traffic collected, such as features like the number of requests per second and bandwidth occupancy, into the trained logistic regression model. If the model prediction result is the abnormal category, the abnormal situation is further confirmed, and at the same time, the severity of the anomaly can be judged according to the probability value output by the model.

[0048] Based on the logistic regression model trained by the supervised learning algorithm, according to the error value between the data feature information and the standard data feature information, a preset error value is introduced, and when it is greater than the preset error value, the data is marked as the first abnormal data.

[0049] S4022. Cluster the data feature information based on the unsupervised learning algorithm, analyze the data distribution, and identify the second abnormal data that has not been detected by the supervised learning algorithm.

[0050] In the embodiments of the present application, unsupervised learning usually adopts clustering algorithms such as DBSCAN (Density-Based Spatial Clustering of Applications). It clusters data points according to density, and data points that are density-connected are divided into the same cluster, while data points in low-density regions are regarded as outliers. When analyzing software operation logs, the log records contain information such as timestamps, operation types, module names, etc. The anomaly detection agent uses the DBSCAN algorithm to cluster these log data. If a log record cannot be assigned to any existing cluster or is in the low-density region at the edge of the cluster, it indicates that this log may correspond to an abnormal situation, which may be an unexpected operation or error in the software.

[0051] Autoencoders are also a powerful unsupervised learning tool. It consists of an encoder and a decoder. The encoder maps the input data to a low-dimensional representation, and the decoder then reconstructs the low-dimensional representation back to the original data form. Under normal circumstances, the reconstruction error of the autoencoder for normal data is small. When the rule matching agent triggers an anomaly, the anomaly detection agent inputs the relevant data into the autoencoder. If the reconstruction error exceeds the set threshold, it means that the data is quite different from the normal data pattern and is very likely to be abnormal data. For example, in an image recognition software, if it is detected that the reconstruction error of the image data by the autoencoder is too large, it may mean that the image data has been tampered with or there is a fault in the image recognition module of the software.

[0052] A possible implementation method is to adopt a clustering algorithm based on the unsupervised learning algorithm, perform clustering according to the data feature information and the standard data feature information, and data points that are density-connected are divided into the same cluster, while data points in low-density regions are regarded as second abnormal data. Another possible implementation method is to adopt an autoencoder based on the unsupervised learning algorithm, input the data feature information. If the reconstruction error exceeds the set threshold, it means that the data is quite different from the normal data pattern, and then the data is regarded as second abnormal data.

[0053] It should be noted that in the present application, the first abnormal data can be obtained only based on the supervised learning algorithm, the second abnormal data can be obtained only based on the unsupervised learning algorithm, or the supervised learning algorithm and the unsupervised learning algorithm can be combined. On the basis of screening the first abnormal data, the second abnormal data that has not been detected by the supervised learning algorithm is identified, which is beneficial to more accurately detecting abnormal data and improving the accuracy of defect detection.

[0054] S500, perform diagnostic reasoning according to the recognition results of the diagnostic reasoning agent combining the rule error pattern and the abnormal fluctuation pattern to determine the defect location.

[0055] In the embodiments of the present application, the diagnostic reasoning agent is used to comprehensively analyze the results of the rule matching agent and the anomaly detection agent, and use reasoning algorithms for in-depth diagnosis to determine the possible causes and locations of defects. The interaction process of multiple specific agents is summarized as follows: The data received by the diagnostic reasoning agent is collected by the data collection agent from multiple levels and components of the software system, covering system logs, user operation records, performance metrics, etc. System logs record key events during software operation, such as function calls, error messages, etc.; user operation records reflect the interaction behavior between users and the software, which helps to discover defects related to user operations; performance metrics reflect the resource usage and response speed during software operation. The rule matching agent obtains potential abnormal situations after matching the collected data according to preset rules and patterns. For example, in a piece of user login verification code, the rule matching agent presets that the length of the username should be between 6 and 20 digits. If it detects that the length of the input username does not conform to this rule, it will transmit this abnormal information to the diagnostic reasoning agent. The anomaly detection agent uses machine learning or statistical analysis methods to identify data anomaly patterns, such as data mutations, deviations from the normal range, etc. When monitoring the software memory usage, the anomaly detection agent discovers that the memory occupancy has increased sharply within a short period of time, far exceeding the normal fluctuation range, and sends this anomaly pattern information to the diagnostic reasoning agent.

[0056] Specifically, the diagnostic reasoning based on the recognition results of the diagnostic reasoning agent combining the rule error pattern and the anomaly fluctuation pattern to determine the defect location includes: S501, analyze the association between the recognition results of the rule error pattern and the anomaly fluctuation pattern to obtain fusion information.

[0057] In the embodiments of the present application, after each agent completes its own analysis task, it sends the results to the diagnostic reasoning agent. The diagnostic reasoning agent fuses this information and comprehensively considers the viewpoints and evidences of different agents. For example, the rule matching agent discovers possible logical errors in certain code segments, and the anomaly detection agent detects abnormal fluctuations in system performance. The diagnostic reasoning agent can combine these two pieces of information and further analyze the association between them.

[0058] S502, perform diagnostic reasoning on the fusion information based on the reasoning algorithm to determine the defect location.

[0059] In the embodiments of the present application, the diagnostic reasoning agent uses various reasoning algorithms, such as rule-based reasoning, case-based reasoning, model-based reasoning, etc., to deeply analyze and reason about the fused information. Through these reasoning algorithms, the possible range of defects can be gradually narrowed down, and the specific location and cause of the defects can be determined. For example, rule-based reasoning can derive new conclusions from the known information according to the preset rules and logical relationships; case-based reasoning can draw on the processing experience of similar defects in the past to quickly locate the current problem.

[0060] The diagnostic reasoning agent uses various reasoning algorithms, such as rule-based reasoning, case reasoning, and model reasoning, etc., to deeply analyze and reason about the fused information. Through these reasoning algorithms, the possible range of defects can be gradually narrowed down, and the specific location and cause of the defects can be determined. For example, rule-based reasoning can derive new conclusions from the known information according to the preset rules and logical relationships, and case-based reasoning can draw on the processing experience of similar defects in the past to quickly locate the current problem.

[0061] Specifically, the diagnostic reasoning based on the reasoning algorithm by the diagnostic reasoning agent for the fused information to determine the defect location includes: S5021, based on the rule reasoning, infer the fused information according to the preset rules, and judge the first position range of the defect.

[0062] In the embodiments of the present application, the working principle of rule reasoning: Rule-based reasoning is based on a series of preset rules for logical deduction. These rules are usually expressed in the form of "if (condition), then (conclusion)", which is a summary of software domain knowledge and common defect patterns. During the diagnosis process, the diagnostic reasoning agent matches the analysis results provided by other agents with the rules in the rule library. If the conditions of a certain rule are met, the corresponding conclusion can be derived, and the first position range of the defect can be determined, that is, the possible position range of the defect. The first position range is larger than the second position range and the specific location of the defect. For example: When detecting the file reading and writing function of software, the rule is set as "if the file reading operation returns an error code, and the file path exists and the permissions are correct, then it may be a file format incompatibility problem". When the rule matching agent finds that the file reading operation has an error, and the information provided by the data collection agent indicates that the file path and permissions are both correct, the diagnostic reasoning agent can initially judge that the problem may lie in the file format based on this rule.

[0063] In the embodiments of the present application, for the logical error mode: after receiving the logical error mode information identified by the rule matching agent, the diagnostic reasoning agent uses a rule-based reasoning method. According to the preset logical rules and the business logic of the program, it further analyzes the possible causes of the error. For example: if the rule matching agent finds a conditional judgment error in a certain order processing code, the diagnostic reasoning agent reasons based on the normal business logic rules of order processing, such as order status change conditions, commodity inventory deduction logic, etc., and infers that it may be due to incorrect boundary value settings of the conditional judgment, resulting in an abnormal order processing flow, and then determines the first position range of the defect.

[0064] S5022, retrieve from the case library based on the case-based reasoning and the first position range of the defect, and determine the second position range of the defect.

[0065] In the embodiments of the present application, the working principle of case-based reasoning: case-based reasoning is to compare the current problem with similar cases solved in the past and draw on the solutions of similar cases to handle the current problem. The diagnostic reasoning agent first retrieves historical cases similar to the current defect characteristics from the case library. Each case in the case library contains information such as problem description, solution, and final effect. By calculating the similarity between the current problem and the cases in the case library, the most similar case or case set is found, and then according to the solutions of these similar cases, combined with the specific situation of the current problem, it is adjusted and applied to determine the position range where the defect is likely to occur. The second position range is smaller than the first position range and the second position range includes the specific position of the defect.

[0066] For example: when diagnosing a screen flickering problem that appears in a graphics rendering software, the diagnostic reasoning agent searches the case library and finds a similar screen flickering case that was handled in the past. In this case, it was caused by an outdated graphics card driver. The diagnostic reasoning agent will refer to this case, first check the graphics card driver situation of the current system, and decide whether to update the graphics card driver according to the actual situation to solve the current problem.

[0067] In the embodiments of the present application, for the performance anomaly mode: the diagnostic reasoning agent uses a model-based reasoning method. Build a software performance model to simulate the performance of the software under different load conditions. When the anomaly detection agent identifies the performance anomaly mode, the diagnostic reasoning agent inputs the actual performance data into the model and compares the difference between the model output and the actual situation. If the model shows that under the current load, the response time should not exceed a certain threshold, but the actual response time is extremely long, by analyzing the impact of each component in the model on performance, such as database query efficiency, algorithm complexity, etc., it is determined whether it is due to unreasonable database index settings resulting in too long query time, or whether a certain algorithm is inefficient when processing a large amount of data, so as to locate the second position range of the defect.

[0068] S5023, input the second position range of the defect and the model inference into a preset simulation model to locate the specific position of the defect.

[0069] In the embodiment of the present application, the working principle of model inference: Inference based on a model is to simulate the normal behavior and operation process of a system by constructing a model of the software system. The model can be a structural model, a functional model, a behavioral model, etc., reflecting the relationships between the components of the software system, the functional implementation method of the system, and the behavioral changes under different conditions. The diagnostic inference agent inputs the collected software operation data into the model for simulation operation, and then compares the output result of the model with the actual observed software operation situation. If there are differences between the two, it indicates that there may be defects in the software system, and the specific position and cause of the defects are determined by analyzing these differences.

[0070] For example: In the test of a network communication software, a network communication model is constructed, including links such as data packet sending, transmission, reception, and error handling. When there is a problem of excessive data transmission delay in actual network communication, relevant network parameters and data transmission conditions are input into the model for simulation. If the model simulation result shows that such a high delay should not occur under normal circumstances, further analyze the data packet transmission path, congestion control mechanism, etc. in the model, and combine the actual network topology and device status to determine that a certain network node may be congested or there is a fault in the transmission link.

[0071] In the embodiment of the present application, for data anomaly patterns: Combine rule-based and case-based reasoning methods. Rule-based reasoning is used to check whether data anomalies violate the data rules of the database or software system, and determine the reasons for data type errors or data value out-of-range. Case-based reasoning is to search for cases of dealing with similar data anomalies in the case library and draw on their solutions. If the anomaly detection agent discovers a data missing problem, the diagnostic inference agent first determines the possible impact of the data missing on the business function according to the data integrity rule, and then refers to the processing methods of similar data missing cases in the case library, such as restoring from backup data, checking the data transmission link, etc., to determine the specific position of the defect and the repair solution.

[0072] Illustrated by an embodiment of defect diagnosis and location, the above processes S5021 - 5023 are processes of gradually narrowing down the scope of the defect location. (1) Narrowing down the scope based on rule - based reasoning: After receiving information from other agents, the diagnostic reasoning agent conducts reasoning according to preset rules. In the software file reading function test, if the rule - matching agent discovers that the file reading operation returns an error code, and the file path and permission information provided by the data - collection agent are both normal, according to the rule that "if there is a file reading error and the path permission is normal, it may be due to incompatible file formats", the diagnostic reasoning agent can initially judge that the defect may occur in the code module related to file format processing, narrowing down the troubleshooting scope from the entire file reading function to the file format processing part.

[0073] (2) Further focusing based on case - based reasoning: With the help of past experience in handling similar defects, the diagnostic reasoning agent can narrow down the scope more precisely. When dealing with the problem of software interface lag, if rule - based reasoning initially determines that it is related to the graphics rendering module, the diagnostic reasoning agent retrieves past similar interface lag cases from the case library and finds that most of them are due to improper texture loading methods. Referring to these cases, the diagnostic reasoning agent further focuses the troubleshooting key points on the code part of texture loading in the graphics rendering module, and deeply checks the parameter settings, loading order, etc. of the texture loading function.

[0074] (3) Precise location based on model - based reasoning: By constructing a software system model and simulating the normal operation of the system, the diagnostic reasoning agent can precisely locate the defect. In a network communication software, a model including the processes of packet sending, transmission, reception, and processing is constructed. When there is a problem of excessively high data transmission latency, the diagnostic reasoning agent inputs the actual network parameters and transmitted data into the model. If the model simulation result shows that such a high latency should not occur in the current network environment, by analyzing the packet transmission path, network congestion control mechanism, etc. in the model, combined with the actual network topology and device status, it is precisely located that a routing configuration error of a certain network node causes the packet transmission to detour, resulting in excessively high latency.

[0075] (4)Method for determining the specific location of a defect: Based on the reasoning result, the diagnostic reasoning agent generates a defect report, which details the defect characteristics, possible causes, and scope of influence, providing repair guidance for developers. In the defect report, clearly indicate the code file, function name, and specific code line where the defect is located. In an order processing module of an e-commerce system, the diagnostic reasoning agent determines that an incorrect multiplication operation in the order amount calculation function leads to an incorrect total order price calculation. The defect report will record the code file path, function name, and the specific code line number where the error occurs. Combining with the structural information of the software system, such as module division, class inheritance relationship, function call hierarchy, etc., the diagnostic reasoning agent can determine the module or system component where the defect is located. In a large enterprise-level application, if a certain business logic error is found, by analyzing the system architecture, it is determined that the error belongs to the cost calculation sub-component under the financial accounting module, facilitating developers to quickly locate and repair the defect.

[0076] The method described in this application further includes feeding back the result of defect location to developers for repair. At the same time, the system can optimize and adjust the rules, models, and algorithms of the multi-agent system according to the repair results and actual situations, improving the diagnostic accuracy and efficiency of the system, so as to better discover and locate defects in subsequent software testing.

[0077] The beneficial effects of this application compared with the prior art include: (1) Facing complex software systems, it is difficult for traditional methods to comprehensively and efficiently collect various relevant data. This method solves this problem by using data collection agents to collect data from multiple levels and components. For example, some specifically detect boundary value problems, and some focus on logical error troubleshooting, thus improving the defect discovery rate. (2) It is difficult to accurately identify software defect characteristics and patterns. Machine learning and other technologies are used to extract features, and rule matching and anomaly detection agents are used for pattern recognition. The method driven by multi-agent collaboration allows different agents to be responsible for testing different modules or business processes respectively, improving the test efficiency and accuracy through collaborative work. (3) Multi-agent collaboration can achieve monitoring and defect diagnosis of different nodes and services in a distributed environment, timely discover and locate possible faults and defects, and feedback them to users for optimization.

[0078] As Figure 2 shown, Figure 2 is a schematic structural diagram of a defect diagnosis and location system provided by an embodiment of this application, including: A definition agent module 610, which is used to define multiple agents. The agents are used to collaboratively drive to test the software system. The agents include a data collection agent, a rule matching agent, an anomaly detection agent, and a diagnostic reasoning agent; A data acquisition module 620, configured to collect data from various levels of the software system according to the data collection agent, and obtain data feature information; A rule matching module 630, configured to match the data feature information according to a preset rule and a case base by the rule matching agent, and identify and determine a rule error pattern; An anomaly detection module 640, configured to identify and detect the data feature information based on a machine learning algorithm by the anomaly detection agent, and identify and determine an anomaly fluctuation pattern; A diagnosis and reasoning module 650, configured to perform diagnosis and reasoning according to the diagnosis and reasoning agent by combining the recognition results of the rule error pattern and the anomaly fluctuation pattern, and determine the defect location.

[0079] As Figure 3 shown, Figure 3 is a schematic structural diagram of a computer-readable storage medium provided by an embodiment of the present application. The computer-readable storage medium 700 of this embodiment includes: a server 710 ( Figure 3 only one is shown), a client 720, and a data recovery program 721 stored in the client 720 and executable on the at least one client 720. The client 720 executes the data recovery program 721 to send a request to the server 710, and the server 710 feeds back a result to implement the steps in the above method embodiment.

[0080] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of the functional units and modules are only for the convenience of mutual distinction and do not limit the protection scope of the present application. The specific working processes of the units and modules in the above system can refer to the corresponding processes in the foregoing method embodiments and will not be described herein again.

[0081] In the above embodiments, the descriptions of the various embodiments have their own emphases. For parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0082] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in combination with the embodiments disclosed in this application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0083] In the embodiments provided in this application, it should be understood that the disclosed device / terminal device and method can be implemented in other ways. For example, the device / terminal device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.

[0084] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0085] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-described embodiment methods of this application, it can also be completed by a computer program instructing relevant hardware. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0086] To implement all or part of the processes in the above-described embodiment methods of this application, it can also be completed by a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above various method embodiments when executed.

[0087] The above-described embodiments are only used to illustrate the technical solutions of this application, rather than to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A defect diagnosis and location method, characterized in that: The method comprises: Define multiple agents, which are used for collaborative driving to test the software system, and the agents include a data collection agent, a rule matching agent, an anomaly detection agent, and a diagnostic reasoning agent; Collect data from various levels of the software system according to the data collection agent to obtain data feature information; According to the rule matching agent, the data feature information is matched according to the preset rules and the case library, and the rule error pattern is identified and determined; According to the abnormal detection agent, the data feature information is identified and detected based on the machine learning algorithm to identify and determine the abnormal fluctuation pattern; The diagnostic reasoning agent performs diagnostic reasoning based on the recognition results of the regular error pattern and the abnormal fluctuation pattern to determine the defect location.

2. The method according to claim 1, characterized in that: The data collection agent collects data from various levels of the software system to obtain data feature information, including: Collect data from various levels of the software system, including execution code, intermediate results, configuration information, and user input data; The data is preprocessed and feature information of the data is extracted to obtain data feature information, wherein the data feature information includes statistical features, structural features and semantic features.

3. The method according to claim 1, characterized in that: The rule error mode includes a logic error mode and an abnormal data mode. The rule matching agent matches the data feature information according to preset rules and a case library to identify and determine the rule error mode, including: Matching the data feature information according to the preset rule, and determining a logic error mode when it is identified that the data feature information does not conform to the preset rule; The data feature information is matched with the case library, and when it is identified that the data feature information matches the defect case in the case library, an abnormal data pattern is determined.

4. The method according to claim 1, characterized in that: The abnormal fluctuation pattern includes an abnormal performance pattern and an abnormal data pattern. The abnormal detection agent identifies and detects the data feature information based on a machine learning algorithm to identify and determine the abnormal fluctuation pattern, including: Learning the distribution and change rules of preset performance indicators based on a machine learning algorithm, identifying performance anomalies in the data feature information, and determining performance anomaly patterns; Based on the machine learning algorithm, abnormal data of the data feature information is identified to determine the abnormal data pattern, wherein the abnormal data includes mutations and deviations from a normal range.

5. The method according to claim 1, characterized in that: The step of performing diagnostic reasoning based on the diagnostic reasoning agent in combination with the recognition results of the regular error pattern and the abnormal fluctuation pattern to determine the defect location includes: Analyzing the correlation between the recognition results of the regular error pattern and the abnormal fluctuation pattern to obtain fusion information; The fused information is subjected to diagnostic reasoning based on an inference algorithm to determine the defect location.

6. The method according to claim 5, characterized in that: The reasoning algorithm includes rule reasoning, case reasoning and model reasoning. The diagnostic reasoning agent performs diagnostic reasoning on the fusion information based on the reasoning algorithm to determine the defect location, including: Based on the rule reasoning, the fusion information is inferred according to a preset rule to determine a first position range of the defect; Retrieving from a case library based on the case reasoning and the first position range of the defect, and determining a second position range of the defect; Based on the model reasoning and the second position range of the defect, a preset simulation model is input to locate the specific position of the defect.

7. The method according to claim 4, characterized in that: The identifying the abnormal data of the data feature information based on the machine learning algorithm and determining the abnormal data pattern includes: Inputting the data feature information into a trained logistic regression model based on a supervised learning algorithm, classifying the data feature information, calculating anomaly probability and screening first abnormal data; Clustering the data feature information based on an unsupervised learning algorithm, analyzing data distribution, and identifying second abnormal data that is not detected by the supervised learning algorithm; The first abnormal data and the second abnormal data are fused to determine an abnormal data pattern.

8. A defect diagnosis and positioning system, characterized in that: The system comprises: An agent definition module is used to define multiple agents, which are used to collaboratively drive to test the software system. The agents include a data acquisition agent, a rule matching agent, an anomaly detection agent, and a diagnostic reasoning agent. A data acquisition module, used to collect data from various levels of the software system according to the data acquisition agent to obtain data feature information; A rule matching module, used to match the data feature information according to preset rules and case libraries based on the rule matching agent, and identify and determine rule error patterns; An anomaly detection module, used to identify and detect the data feature information based on the machine learning algorithm according to the anomaly detection agent, and identify and determine the abnormal fluctuation pattern; The diagnostic reasoning module is used to perform diagnostic reasoning based on the diagnostic reasoning agent in combination with the recognition results of the regular error pattern and the abnormal fluctuation pattern to determine the defect location.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method for improving tobacco storage business data anomaly detection efficiency of AI intelligent analysis

    CN114168580A

  • Fault diagnosis method and device for intelligent operation and maintenance of power supply and storage medium

    CN117787953A

  • Automatic closed-loop test method for real-time embedded software

    CN118860848A

  • Internal combustion engine fault diagnosis and defect detection intelligent agent system and construction method

    CN119397326A

  • Cloud communication abnormity diagnosis method, system and device and storage medium

    CN119676054A

Cited By

  • Multi-agent cooperative abnormal information processing method and device, storage medium and program product

    CN120639482A