Defect Diagnosis and Location Method, System, and Storage Medium

Through the multi-agent collaborative driving method, data collection, rule matching and abnormal detection agents are used, combined with machine learning algorithms, the problem of inefficient defect diagnosis in software testing is solved, and efficient and accurate defect positioning is achieved.

CN120086052BActive Publication Date: 2025-08-01NINETECH INFORMATION TECH (SHENZHEN) CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing software testing methods lack flexibility and adaptability, resulting in inefficient defect diagnosis and inaccurate defect positioning, especially in large-scale software systems.

Method used

The method of multi-agent collaborative driving is adopted, including data collection, rule matching, abnormal detection and diagnostic inference agents, and the software defects are identified and positioned through machine learning algorithms, and data feature information is integrated for comprehensive diagnosis.

Benefits of technology

It improves the efficiency and accuracy of defect diagnosis, can quickly identify defect characteristics and patterns in the software system, reduce manual intervention, and improve the quality of software testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120086052B_ABST
    Figure CN120086052B_ABST
Patent Text Reader

Abstract

The present application relates to a defect diagnosis and location method. Data at each level of the software system is collected by a data collection agent. The rule matching agent matches the data of the software system according to preset rules and a case base, identifies and determines the rule error mode. The anomaly detection agent identifies and detects the data based on a machine learning algorithm, identifies and determines the abnormal fluctuation mode. Finally, according to the diagnosis and reasoning agent, diagnosis and reasoning are carried out by combining the recognition results of the rule error mode and the abnormal fluctuation mode to determine the defect location. Through the collaborative drive of multiple agents, different abnormal modes of the software system are detected. By fusing the recognition results of the abnormal modes for reasoning diagnosis, the defect location is finally determined, which is beneficial to realizing the intelligent diagnosis and accurate location of software testing defects, and improving the efficiency and quality of software testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software testing technologies, and particularly to a method, system, and 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 in ensuring the stability and reliability of the systems. 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 system operation 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 performed 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 all affect the accuracy of defect diagnosis.

[0004] In view of this, there are still many problems in testing the defects of 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] This application provides a method, system, and 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, this application provides a method for defect diagnosis and location, including:

[0007] Defining a plurality of agents, which are used to drive collaboratively 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;

[0008] Collecting data from each layer of the software system according to the data collection agent to obtain data feature information;

[0009] Matching the data feature information according to the preset rules and case base by the rule matching agent to identify and determine the rule error patterns;

[0010] Identifying and detecting the data feature information based on a machine learning algorithm by the anomaly detection agent to identify and determine the abnormal fluctuation patterns;

[0011] Based on the diagnosis inference agent, diagnose and infer according to the recognition results of the rule error pattern and the abnormal fluctuation pattern to determine the defect location.

[0012] Optionally, the data collection agent collects data from all levels of the software system to obtain data feature information, including:

[0013] Collect data from all levels of the software system, where the data includes execution code, intermediate results, configuration information, and user input data;

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

[0015] Optionally, the rule error pattern includes a logical error pattern and an abnormal data pattern. The rule matching agent matches the data feature information according to preset rules and a case library to identify and determine the rule error pattern, including:

[0016] Match 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, determine the logical error pattern;

[0017] Match the data feature information with the case library. When it is recognized that the data feature information matches the defective cases in the case library, determine the abnormal data pattern.

[0018] Optionally, the abnormal fluctuation pattern includes a performance anomaly pattern and an abnormal data pattern. The anomaly detection agent identifies and detects the data feature information based on a machine learning algorithm to identify and determine the abnormal fluctuation pattern, including:

[0019] Learn the distribution and variation law of preset performance indicators based on a machine learning algorithm, identify the performance anomalies in the data feature information, and determine the performance anomaly pattern;

[0020] Identify the abnormal data in the data feature information based on a machine learning algorithm to determine the abnormal data pattern, where the abnormal data includes mutations and deviations from the normal range.

[0021] Optionally, the diagnosis inference agent combines the recognition results of the rule error pattern and the abnormal fluctuation pattern for diagnosis and inference to determine the defect location, including:

[0022] Analyze the association between the recognition results of the rule error pattern and the abnormal fluctuation pattern to obtain fusion information;

[0023] Based on the inference algorithm, perform diagnostic inference on the fused information to determine the defect location.

[0024] Optionally, the inference algorithm includes rule inference, case inference, and model inference. The diagnostic inference agent performs diagnostic inference on the fused information based on the inference algorithm to determine the defect location, including:

[0025] Based on the rule inference, infer the fused information according to the preset rules to judge the first position range of the defect;

[0026] Based on the case inference and the first position range of the defect, retrieve from the case library to judge the second position range of the defect;

[0027] Based on the model inference and the second position range of the defect, input into the preset simulation model to locate the specific position of the defect.

[0028] Optionally, the abnormal data of the data feature information is identified based on the machine learning algorithm to determine the abnormal data pattern, including:

[0029] Based on the supervised learning algorithm, input the data feature information into the trained logistic regression model, classify the data feature information, calculate the abnormal probability and screen the first abnormal data;

[0030] Based on the unsupervised learning algorithm, cluster the data feature information, analyze the data distribution, and identify the second abnormal data not detected by the supervised learning algorithm;

[0031] Fuse the first abnormal data and the second abnormal data to determine the abnormal data pattern.

[0032] In a second aspect, the present application provides a defect diagnosis and location system, and the system includes:

[0033] Define an agent module for defining multiple agents, which are used to cooperate and drive to test the software system. The agents include a data collection agent, a rule matching agent, an anomaly detection agent, and a diagnostic inference agent;

[0034] A data acquisition module for collecting data from all levels of the software system according to the data collection agent to obtain data feature information;

[0035] A rule matching module for matching the data feature information according to the preset rules and the case library by the rule matching agent to identify and determine the rule error pattern;

[0036] Anomaly detection module, configured to perform identification and detection on the data feature information based on a machine learning algorithm according to the anomaly detection agent, and identify and determine an abnormal fluctuation pattern;

[0037] Diagnostic reasoning module, configured to perform diagnostic reasoning based on the identification results of the diagnostic reasoning agent in combination with the rule error pattern and the abnormal fluctuation pattern, and determine the defect location.

[0038] 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 when the processor executes the computer program, the method described above is implemented.

[0039] 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 when the computer program is executed by a processor, the method described above is implemented.

[0040] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the prior art: The present application collects data at all levels of the software system through the data collection agent, which is conducive to comprehensively and efficiently collecting various types of relevant data. Among them, the rule matching agent matches the data of the software system according to the preset rules and the case library, identifies and determines the rule error pattern, and the anomaly detection agent performs identification and detection on the data based on the machine learning algorithm, identifies and determines the abnormal fluctuation pattern. 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 the software defect characteristics and pattern difficulties, and is conducive to improving the efficiency in the defect diagnosis process. Finally, according to the diagnostic reasoning agent, diagnostic reasoning is performed in combination with the identification results of the rule error pattern and the abnormal fluctuation pattern 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. Description of the Drawings

[0041] The drawings here are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present invention, and are used together with the specification to explain the principles of the present invention.

[0042] 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 drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.

[0043] One or more embodiments are exemplarily illustrated by the pictures in the corresponding accompanying drawings. These exemplary illustrations do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements. Unless otherwise stated, the drawings in the figures do not constitute a scale limitation.

[0044] Figure 1 It is a schematic flowchart of a defect diagnosis and localization method provided by an embodiment of the present application;

[0045] Figure 2 It is a schematic structural diagram of a defect diagnosis and localization system provided by an embodiment of the present application;

[0046] Figure 3 It is a schematic structural diagram of a computer-readable storage medium provided by an embodiment of the present application. Detailed implementation manners

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

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

[0049] Figure 1 A defect diagnosis and localization method provided by an embodiment of the present application, the method includes:

[0050] S100, define multiple agents, the agents are used to cooperate and drive 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.

[0051] In the embodiments of the present application, an Agent refers to a program or entity that can autonomously perceive the environment and make decisions. It is commonly found in AI, distributed systems, or software architectures. An Intelligent Agent refers to an entity 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 among Agents 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, a data collection Agent sends the collected data to a rule matching Agent and an anomaly detection Agent for analysis, and a diagnostic reasoning Agent makes a comprehensive judgment based on the results of rule matching and anomaly detection. In the present application, multiple intelligent agents are coordinated to drive different intelligent agents to be responsible for testing different modules or business processes, detecting different abnormal patterns in the software system, which is beneficial to accurately identifying software defect characteristics and pattern difficulties and improving the efficiency in the defect diagnosis process.

[0052] S200. Collect data from various levels of the software system according to the data collection intelligent agent to obtain data feature information.

[0053] Specifically, the step of collecting data from various levels of the software system according to the data collection intelligent agent to obtain data feature information includes:

[0054] S201. Collect data from various levels of the software system, where the data includes execution code, intermediate results, configuration information, and user input data.

[0055] Facing a complex software system, it is difficult for traditional methods to comprehensively and efficiently collect various relevant data. In the embodiments of the present application, the data collection intelligent 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 include 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.

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

[0057] The data collected during software testing may contain noise, missing values, or incorrect information, all of which can 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 incorrect data, improving the quality of the data. Transforming the data can unify data in different formats 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.

[0058] In the embodiments of this application, machine learning and data mining technologies 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.

[0059] 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 vector according to a preset rule library to find the data that conforms to the known defect pattern. The anomaly detection agent, through a trained model, identifies abnormal features 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 patterns, and is beneficial to improving the efficiency in the defect diagnosis process. S300 and S400 will be described one by one below.

[0060] S300, according to the rule matching agent, match the data feature information according to the preset rules and case library, and identify and determine the rule error pattern.

[0061] In the embodiments 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 the construction of preset rules and patterns, which can be analyzed and summarized based on the past fault data and defect reports of the software system.

[0062] Specifically, the rule error pattern includes a logical error pattern and an abnormal data pattern. The step of according to the rule matching agent to match the data feature information according to the preset rules and case library, and identify and determine the rule error pattern includes:

[0063] S301. Match 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, determine the logical error mode.

[0064] In the embodiments of the present application, the logical error mode includes conditional judgment errors, loop logic errors, etc. 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 logical error mode. The rule matching agent can identify such modes by checking the consistency between the code logic structure and the preset correct logic rules.

[0065] In the embodiments of the present application, by identifying the matching of data feature information and preset rules, when it is recognized that the data feature information does not conform to the preset rules, it means that there are conditional judgment errors, logical loop errors, etc. in the data, which is determined to belong to the logical error mode, and at the same time, the logical error result is detected.

[0066] S302. Match the data feature information with the case library. When it is recognized that the data feature information matches the defective cases in the case library, determine the abnormal data mode.

[0067] In the embodiments of the present application, the abnormal data mode includes data missing, data type error, data value exceeding the reasonable range, etc. In database operations, if a certain field should be of integer type but string data is inserted, or a certain key data is lost during transmission, it belongs to the data abnormal mode.

[0068] For example, in a certain e-commerce system, there was a situation where the order status was not updated for a long time after the 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 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 to be an abnormal situation.

[0069] On the other hand, industry norms and best practices are also important sources of rules. Taking financial software as an example, according to the data security norms of the financial industry, it is required that user 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 conforms to industry standards (such as the AES encryption algorithm) during data transmission and storage. If not, it is regarded as abnormal. When the data during the operation of the software system is collected, 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 mode.

[0070] It should be noted that the logical error patterns that the rule matching intelligent body can recognize 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.

[0071] S400. Based on the abnormal detection intelligent body, identify and detect the data feature information based on the machine learning algorithm, and identify and determine the abnormal fluctuation pattern.

[0072] The abnormal fluctuation pattern includes the performance abnormal pattern and the abnormal data pattern. The step of identifying and detecting the data feature information based on the machine learning algorithm by the abnormal detection intelligent body to identify and determine the abnormal fluctuation pattern includes:

[0073] S401. Based on the machine learning algorithm, learn the distribution and change law of the preset performance indicators, identify the performance abnormality in the data feature information, and determine the performance abnormal pattern.

[0074] In the embodiment of the present application, the performance abnormal pattern 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. This is the performance abnormal pattern. The abnormal detection intelligent body uses the machine learning algorithm to learn the distribution and change law of the normal performance indicators, so as to identify such abnormalities.

[0075] S402. Based on the machine learning algorithm, identify the abnormal data in the data feature information, and determine the abnormal data pattern, where the abnormal data includes mutation and deviation from the normal range.

[0076] In the embodiment of the present application, the abnormal data pattern includes data loss, data type error, data value exceeding the reasonable range, etc. The abnormal detection intelligent body can check and identify the type, integrity and value range of the data.

[0077] Specifically, the machine learning algorithm is mainly divided into supervised learning and unsupervised learning. The step of identifying the abnormal data in the data feature information based on the machine learning algorithm and determining the abnormal data pattern includes:

[0078] S4021. Based on the supervised learning algorithm, input the data feature information into the trained logistic regression model, classify the data feature information, calculate the abnormal probability and screen the first abnormal data.

[0079] In the embodiments of the present application, the process of the supervised learning algorithm is as follows: First, the anomaly detection agent first uses 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 of network traffic, request frequency, etc. are all within a certain range. When the rule matching agent triggers a network traffic anomaly rule according to rule matching or case base matching, the anomaly detection agent inputs the network traffic-related data 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 an 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.

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

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

[0082] In the embodiments of the present application, unsupervised learning usually adopts a clustering algorithm 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 areas 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 certain log record cannot be assigned to any existing cluster or is in the low-density area 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.

[0083] The autoencoder is 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 has a large difference 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 malfunction in the image recognition module of the software.

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

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

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

[0087] In the embodiment of this application, the diagnostic reasoning agent is used to comprehensively analyze the results of the rule matching agent and the anomaly detection agent, and use an inference algorithm to conduct in-depth diagnosis to determine the possible causes and locations of defects. The interaction process of specific multiple agents is summarized as follows: The data collected by the data collection agent received by the diagnostic reasoning agent comes 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 section of user login verification code, the rule matching agent presets that the length of the user name should be between 6 and 20 digits. If it detects that the length of the input user name does not conform to this rule, it will transmit this abnormal information to the diagnostic reasoning agent. The anomaly detection agent identifies data anomaly patterns, such as data mutations, deviations from the normal range, etc., using machine learning or statistical analysis methods. When monitoring the software memory usage, the anomaly detection agent discovers that the memory occupancy rises sharply within a short time, far exceeding the normal fluctuation range, and then sends this abnormal pattern information to the diagnostic reasoning agent.

[0088] Specifically, the performing diagnostic reasoning according to the recognition results of the diagnostic reasoning agent combining the rule error pattern and the abnormal fluctuation pattern, and determining the defect location includes:

[0089] S501. Analyze the correlation between the recognition results of the rule error pattern and the abnormal fluctuation pattern to obtain fusion information.

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

[0091] S502. Based on the inference algorithm, perform diagnostic reasoning on the fusion information to determine the defect location.

[0092] In the embodiment of the present application, the diagnostic reasoning intelligent agent uses various inference algorithms, such as rule-based reasoning, case-based reasoning, model-based reasoning, etc., to deeply analyze and reason about the fused information. Through these inference algorithms, the possible range of defects can be gradually narrowed down to determine the specific location and cause of the defects. 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.

[0093] The diagnostic reasoning intelligent agent uses various inference algorithms, such as rule-based reasoning, case reasoning, and model reasoning, etc., to deeply analyze and reason about the fused information. Through these inference algorithms, the possible range of defects can be gradually narrowed down to determine the specific location and cause of the defects. 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.

[0094] Specifically, the step of determining the defect location by the diagnostic reasoning intelligent agent based on the inference algorithm for the fusion information includes:

[0095] S5021. Based on the rule reasoning, infer the fusion information according to the preset rules to judge the first position range of the defect.

[0096] In the embodiment of the present application, the working principle of rule - based reasoning: Rule - based reasoning is a logical deduction based on a series of pre - set rules. These rules are usually expressed in the form of "if (condition), then (conclusion)", and are 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 base. If the conditions of a certain rule are met, the corresponding conclusion can be deduced to determine the first position range of the defect, that is, the possible position range where the defect may occur. The first position range is larger than the second position range and the specific position of the defect. For example: When detecting the file reading and writing function of software, the set rule is "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 there are no problems with the file path and permissions, the diagnostic reasoning agent can preliminarily determine that the problem may lie in the file format based on this rule.

[0097] Applied in the embodiment of the present application, for logical error patterns: After receiving the logical error pattern information identified by the rule - matching agent, the diagnostic reasoning agent uses the rule - based reasoning method. According to the pre - set 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 segment, the diagnostic reasoning agent, based on the normal business logic rules of order processing, such as order status change conditions, commodity inventory deduction logic, etc., reasons that it may be due to incorrect boundary value settings in the conditional judgment, resulting in an abnormal order - processing flow, and then determines the first position range of the defect.

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

[0099] In the embodiment 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 base. Each case in the case base contains information such as problem description, solution, and final effect. By calculating the similarity between the current problem and the cases in the case base, the most similar case or set of cases is found, and then, based on 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.

[0100] For example, when diagnosing the problem of screen flickering in a graphics rendering software, the diagnostic reasoning agent searches in the case library and finds a similar case of screen flickering that was handled in the past. In that 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.

[0101] In the embodiment of the present application, for the performance anomaly mode: the diagnostic reasoning agent adopts a model-based reasoning method. A software performance model is constructed to simulate the performance of the software under different load conditions. When the anomaly detection agent identifies a 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 the database query efficiency, algorithm complexity, etc., it is determined whether the unreasonable database index setting causes the 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.

[0102] S5023, based on the model reasoning and the second position range of the defect, input into a preset simulation model to locate the specific position of the defect.

[0103] In the embodiment of the present application, the working principle of model reasoning: Model-based reasoning is to simulate the normal behavior and operation process of the system by constructing a model of the software system. The model can be a structural model, a functional model, a behavioral model, etc., which reflects the relationship between the components of the software system, the functional implementation method of the system, and the behavioral changes under different conditions. The diagnostic reasoning 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 is a difference between the two, it indicates that there may be a defect in the software system, and the specific position and cause of the defect are determined by analyzing these differences.

[0104] For example, in the test of a network communication software, a network communication model is constructed, including links such as packet sending, transmission, reception, and error handling. When there is a problem of excessive data transmission delay in the actual network communication, relevant network parameters and data transmission situations 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 packet transmission path, congestion control mechanism, etc. in the model, and combine the actual network topology and device status to judge that there may be congestion at a certain network node or a fault in the transmission link.

[0105] In the embodiments of the present application, for the data anomaly mode: a combination of rule-based and case-based reasoning methods is adopted. Rule-based reasoning is used to check whether the data anomaly violates the data rules of the database or software system, and to determine the reasons for data type errors or data values exceeding the range. Case-based reasoning is to search for cases of handling similar data anomalies in the case library and draw on their solutions. If the anomaly detection agent discovers a data missing problem, the diagnostic reasoning agent first determines the possible impact of the data missing on the business function according to the data integrity rules, and then refers to the handling 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 location of the defect and the repair solution.

[0106] 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) Rule-based reasoning to narrow down the scope: After receiving information from other agents, the diagnostic reasoning agent makes inferences based on preset rules. In the file reading function test of the software, 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 determine 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.

[0107] (2) Case-based reasoning for further focusing: With the help of the handling experience of past similar defects, the diagnostic reasoning agent can narrow down the scope more precisely. When dealing with the problem of software interface freezing, if rule-based reasoning initially determines that it is related to the graphics rendering module, the diagnostic reasoning agent retrieves past similar interface freezing 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.

[0108] (3) Model-based reasoning for precise location: 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 data packet sending, transmission, reception, and processing is constructed. When there is a problem of excessive data transmission delay, 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 delay should not occur in the current network environment, by analyzing the data 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 data packet transmission to detour, resulting in excessive delay.

[0109] (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 where the function is located, the 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.

[0110] 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 detect and locate defects in subsequent software testing.

[0111] 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 are dedicated to detecting 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 testing 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.

[0112] 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:

[0113] A defined agent module 610, used to define multiple agents, which 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;

[0114] 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;

[0115] 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;

[0116] 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;

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

[0118] 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 in the figure), a client 720, and a data recovery program 721 stored in the client 720 and executable on 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.

[0119] Those skilled in the art can clearly understand that for the convenience and conciseness of description, only the above-mentioned 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 one 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 each functional unit and module 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 in detail here.

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

[0121] Those of ordinary skill in the art can realize 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 a hardware or software manner 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.

[0122] 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 above-mentioned 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.

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

[0124] When 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 the present 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-described 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.

[0125] To implement all or part of the processes in the above-described embodiment methods of the present 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 of the above-described various method embodiments when executed.

[0126] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present 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 on 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 the present application, and should all be included in the protection scope of the present application.

Claims

1. A defect diagnosis and localization method, characterized in that The method includes: Defining multiple agents, which are used to collaboratively drive the testing of the software system. 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 preset rules and case base by the rule matching agent to identify and determine the rule error pattern; Identifying and detecting the data feature information based on a machine learning algorithm by the anomaly detection agent to identify and determine the abnormal fluctuation pattern; 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; The abnormal fluctuation pattern includes a performance anomaly pattern and an abnormal data pattern. The identifying and detecting the data feature information based on a machine learning algorithm by the anomaly detection agent to identify and determine the abnormal fluctuation pattern includes: Learning the distribution and change law of the preset performance indicators based on a machine learning algorithm to identify the performance anomalies in the data feature information and determine the performance anomaly pattern; Identifying the abnormal data in the data feature information based on a machine learning algorithm to determine the abnormal data pattern, where the abnormal data includes mutations and deviations from the normal range; The identifying the abnormal data in the data feature information based on a machine learning algorithm to determine the abnormal data pattern includes: Inputting the data feature information into a trained logistic regression model based on a supervised learning algorithm to classify the data feature information, calculate the anomaly probability, and screen the first abnormal data; Clustering the data feature information based on an unsupervised learning algorithm, analyzing the data distribution, and identifying the second abnormal data not detected by the supervised learning algorithm; Fusing the first abnormal data and the second abnormal data to determine the abnormal data pattern.

2. The method according to claim 1, characterized in that, The collecting data from various levels of the software system according to the data collection agent to obtain data feature information includes: 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.

3. The method according to claim 1, wherein The rule error pattern includes a logical error pattern and an abnormal data pattern. The matching the data feature information according to the preset rules and case base by the rule matching agent to identify and determine the rule error pattern includes: Matching 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, determining the logical error pattern; Matching the data feature information and the case base. When it is identified that the data feature information matches the defect cases in the case base, determining the abnormal data pattern.

4. The method according to claim 1, wherein The above-mentioned diagnostic reasoning agent combines the recognition results of the rule error pattern and the abnormal fluctuation pattern to perform diagnostic reasoning and determine the defect location, including: Analyze the association between the recognition results of the rule error pattern and the abnormal fluctuation pattern to obtain fusion information; Based on the reasoning algorithm, perform diagnostic reasoning on the fusion information to determine the defect location.

5. The method according to claim 4, wherein The reasoning algorithm includes rule reasoning, case reasoning, and model reasoning. The above-mentioned 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, infer the fusion information according to the preset rules to judge the first position range of the defect; Based on the case reasoning and the first position range of the defect, retrieve from the case library to judge the second position range of the defect; Based on the model reasoning and the second position range of the defect, input it into the preset simulation model to locate the specific position of the defect.

6. A defect diagnosis and location system, characterized in that, The system includes: A defined agent module for defining multiple agents, which are used to cooperate and 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 for collecting data from all levels of the software system according to the data acquisition agent to obtain data feature information; A rule matching module for matching the data feature information according to the rule matching agent according to the preset rules and the case library to identify and determine the rule error pattern; An anomaly detection module for identifying and detecting the data feature information based on the machine learning algorithm according to the anomaly detection agent to identify and determine the abnormal fluctuation pattern; A diagnostic reasoning module for combining the recognition results of the rule error pattern and the abnormal fluctuation pattern according to the diagnostic reasoning agent to perform diagnostic reasoning and determine the defect location; The abnormal fluctuation pattern includes a performance anomaly pattern and an abnormal data pattern. The above-mentioned anomaly detection agent identifies and detects the data feature information based on the machine learning algorithm to identify and determine the abnormal fluctuation pattern, including: Based on the machine learning algorithm, learn the distribution and change law of the preset performance indicators, identify the performance anomalies in the data feature information, and determine the performance anomaly pattern; Based on the machine learning algorithm, identify the abnormal data in the data feature information to determine the abnormal data pattern, where the abnormal data includes mutations and deviations from the normal range; The above-mentioned identifying the abnormal data in the data feature information based on the machine learning algorithm to determine the abnormal data pattern includes: Based on the supervised learning algorithm, input the data feature information into the trained logistic regression model, classify the data feature information, calculate the anomaly probability, and screen the first abnormal data; Based on the unsupervised learning algorithm, cluster the data feature information, analyze the data distribution, and identify the second abnormal data that has not been detected by the supervised learning algorithm; Fuse the first abnormal data and the second abnormal data to determine the abnormal data pattern.

7. 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 5 is implemented.

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

Citation Information

Patent Citations

  • 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