System self-monitoring and repairing method and system based on knowledge graph
By building a system self-monitoring and repair method based on knowledge graph, the self-monitoring and repair problems of products without front-end pages are solved, the intelligent repair of the automated testing system is realized, and the efficiency and accuracy of the testing process are improved.
Patent Information
- Application Number
- CN202511241985.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-02
- Publication Date
- 2025-10-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies cannot effectively self-monitor and repair products without front-end pages. Self-healing methods waste historical data and cannot perform self-testing in the R&D stage through automated scripts.
Build a system self-monitoring and repair method based on knowledge graph, including automated testing knowledge graph construction, test scoring model, error content classification and annotation, root cause analysis and repair strategy formulation, repair execution and update, and use natural language processing and Git management to achieve automated repair.
It realizes intelligent repair of automated testing systems, reduces labor maintenance costs, improves test process efficiency, has dynamic learning capabilities, improves error handling capabilities and repair success rates, and reduces the need for manual intervention.
Smart Images

Figure CN120803791A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of system repair, in particular to a system self-monitoring repair method and system based on a knowledge graph. BACKGROUND
[0002] The basic concept of a knowledge graph is a knowledge base that represents entities, relationships, and attributes in a graphical form. It enables computers to better understand and process human language by representing knowledge in a structured manner. Entities, relationships, and attributes can be processed and reasoned through a series of algorithms and models, enabling computers to automatically acquire, reason, and generate new knowledge. Existing repair methods start from the front end, make judgments and self-heal, and are more suitable for products with front-end pages. They cannot cover products without front-end pages, nor can they perform self-testing during the development stage through automated scripts. Moreover, the self-healing method recalculates each time, wasting historical data and hindering the accumulation of self-healing experience.
[0003] In summary, there is a need for a system self-monitoring repair method and system based on a knowledge graph to address the shortcomings of existing technology. SUMMARY
[0004] To address the shortcomings of existing technology, the present application provides a system self-monitoring repair method and system based on a knowledge graph, aiming to solve the above problems.
[0005] To achieve the above purpose, the present application provides the following technical solution: a system self-monitoring repair method based on a knowledge graph, comprising the following steps:
[0006] Step S1: Construct an automated testing knowledge graph. Extract knowledge from interface documents, database tables, and test scripts to construct a knowledge graph of the entire automated testing script.
[0007] Step S2: Construct an automated testing scoring model. Run the automated testing script and perform scoring.
[0008] Step S3: Obtain error content generated by running the automated testing script. Classify and label the error content through natural language processing.
[0009]
[0009] Step S4: Analyze and find the corresponding error root cause based on the error content and knowledge graph. Develop a corresponding repair strategy based on the error root cause.
[0010] Step S5: Locate the error root cause, execute the repair process, modify the test script, introduce Git management, automatically submit the repair script to Git, form a new version, and generate a change record.
[0011] Step S6: Re-run the new version of the script to check the running results. If there is an error, execute steps S2 to S5 until the error is fixed.
[0012] Optionally, the step S1 of constructing the automated test knowledge graph is implemented by the following method:
[0013] Step A1: Define the target and scope of the knowledge graph, and associate the semantics between the interface, database and test script.
[0014] Step A2: Knowledge extraction, extract the knowledge related to the establishment of the knowledge graph from the interface document, database table structure and test script.
[0015] Step A3: Knowledge fusion and ontology modeling, build a unified semantic model, define classes and relationships, unify naming conventions, perform semantic similarity matching, and introduce unique identifiers.
[0016] Step A4: Knowledge storage and graph database construction, convert the extracted knowledge into node and edge files, import them through the import tool or write them using the driver program, and build the corresponding knowledge graph by combining the graph database.
[0017] Optionally, the step S2 is implemented by the following method:
[0018] Step B1: Define error levels and scoring standards, and establish an error severity classification table to assign basic scores to different types of errors.
[0019] Step B2: Collect test execution result data, collect test logs, interface response bodies and status codes, assertion failure information and exception stacks from the automated test framework.
[0020] Step B3: Use a rule engine or regular expression to match keywords for each failed record to determine the severity level.
[0021] Step B4: Use the weighted total score method to comprehensively score the individual problem score and problem quantity impact.
[0022] Step B5: Determine according to the comprehensive score and set threshold value, and automatically push the notification.
[0023] Optionally, the step S3 is implemented by the following method:
[0024] Standardize the original error script, establish an extensible error classification ontology, and select a classification method according to the data volume and accuracy requirements to classify each error content with multi-dimensional tags.
[0025] Optionally, the classification method includes:
[0026] Adopt regular expression or keyword list matching, or machine learning classification, or lack of labeled data clustering classification;
[0027] Machine learning classification:
[0028] The cleaned text is vectorized, and a classification model is trained by labeled data to output the predicted category and confidence.
[0029] Optionally, the repair strategy in step S4 is formulated by the following way:
[0030] Extract the key entities and semantic categories in the error report, match them with the nodes in the knowledge graph, extract the context dependency chain, perform logical reasoning based on error type, service dependency, and configuration information to generate error root cause, and match the predetermined repair strategy library according to the error root cause type.
[0031] Optionally, the repair in step S5 is performed by the following way:
[0032] Determine the error type of the repair, select the corresponding code modification template according to the error type, locate the error position based on the root cause analysis result and the mapping relationship of the knowledge graph, use the script to parse and modify the error code, after modifying the script, automatically execute the Git operation, and generate a structured change log.
[0033] Optionally, the step S6 is implemented by the following way:
[0034] Re-execute the updated script, collect the running results, evaluate the new failures, judge the repair possibility, introduce the repair success rate and repair time consumption, and optimize the repair strategy.
[0035] A system self-monitoring and repairing system based on a knowledge graph, which adopts the system self-monitoring and repairing method based on a knowledge graph, includes a knowledge graph construction module, a test scoring module, an error content classification and labeling module, a root cause analysis and strategy repair module, and a repair execution and update module.
[0036] The knowledge graph construction module is used to extract information from interface documents, database tables, and test scripts to construct a knowledge graph of the entire automated test script.
[0037] The test scoring module is used to define error levels and scoring standards, collect test execution result data, use a rule engine or regular expression to match keywords for each failure record to determine the severity level, and use a weighted total score method for comprehensive scoring.
[0038] Optionally, the error content classification and labeling module is used to obtain error content generated by running the automated test script, classify and label these contents through natural language processing technology.
[0039] A root cause analysis and strategy repair module is used to find the corresponding error root cause based on the error content and knowledge graph analysis, and formulate the corresponding repair strategy accordingly;
[0040] A repair execution and update module is used to locate according to the error root cause, execute the repair process, change the test script, and introduce Git management, automatically submit the repair script to Git to form a new version, and generate a change record.
[0041] The beneficial effects of the present application are:
[0042] 1、In the present application, the specific content of the script is managed by the knowledge graph, so that the code, documents, change records, etc. form a whole, and the knowledge reasoning is carried out by the knowledge graph, so that the repair model is shaped, the automatic repair function of the whole automatic test script is realized, it is more intelligent, manual debugging of the script is not needed every time, the manpower maintenance cost of the automatic test system is reduced, and the running of the automatic test script can be monitored by combining the scoring model, so that the efficiency of the whole software test process is improved;
[0043] 2、In the present application, the error information is classified by using natural language processing technology, the error type can be more accurately located, and the corresponding repair strategy is provided. This method can not only handle the error conditions that cannot be covered by rules, but also combine historical records for repair, and after continuous training, the accuracy will be higher and higher, the system has the ability of dynamic learning and updating, with the increase of the number of uses, it can continuously optimize its repair strategy by analyzing the successful repair cases in the past, the system can also simulate the effectiveness of the repair scheme to avoid invalid repair, and further improve the repair success rate;
[0044] 3、In the present application, not only the severity of the error is evaluated, but also the repair complexity, historical repair time and other dimensions are considered to comprehensively evaluate the repair effect, the user can score the repair result, feed back to the knowledge graph and the scoring model, form a closed loop optimization, and continuously improve the accuracy and adaptability of the system. The self-monitoring repair method based on the knowledge graph not only improves the error handling capability and efficiency in the automatic test process, but also reduces the demand for manual intervention, realizes the automation and intelligentization of the test process. BRIEF DESCRIPTION OF DRAWINGS
[0045] Figure 1 It is a method flowchart of the present application.
[0046] Figure 2 It is a system structure schematic diagram of the present application. DETAILED DESCRIPTION
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.
[0048] As shown in Figure 1 A knowledge graph-based system self-monitoring repair method comprises the following steps:
[0049] I. Constructing an automated test knowledge graph
[0050] According to the interface document, the database table, the test script and the like, knowledge is extracted, and a knowledge graph of the entire automated test script is constructed, and the page is visualized.
[0051] Entity: interface, interface parameter, environment configuration, error information, etc.
[0052] Attribute: name of interface parameter, parameter value size, specific content of error information, error code, etc.
[0053] Relationship: In this case, it refers to the limitation, dependency relationship, historical change operation, parameter mapping and the like of the interface parameters.
[0054] In the interface document, the url, the input parameter, the parameter rules, the return value, the request method and the like of the interface can be obtained. In the database table, the definition and the value source of the field can be obtained. In the test script, the execution case of the corresponding parameter can be matched, the error information can be summarized, and other column documents can be matched. According to the information, after information collection, extraction and modeling, each interface will form its own knowledge graph.
[0055] The automated test knowledge graph is constructed by the following ways:
[0056] Step A1: defining the target and range of the knowledge graph, and associating the semantics between the interface, the database and the test script;
[0057] Step A2: knowledge extraction, extracting the knowledge related to the establishment of the knowledge graph from the interface document, the database table structure and the test script;
[0058] Step A3: knowledge fusion and ontology modeling, constructing a unified semantic model, defining classes and relationships, unifying naming specifications, performing semantic similarity matching, and introducing a unique identifier;
[0059] Step A4: Knowledge storage and graph database construction, convert the extracted knowledge into node and edge files, import through import tools or write with driver programming, and build the corresponding knowledge graph with the graph database.
[0060] II. Build an automated test scoring model, run automated test scripts, and score them;
[0061] According to the keywords and response codes of all error contents after executing the script, different scores are assigned, the higher the score, the more serious the problem, and then the number of problems is weighted, the more serious problems, the greater the proportion, and finally a score is obtained, which is the score of this script run. When the score reaches a certain value, a warning message can be pushed to the user, prompting that manual intervention and backtracking may be needed to improve the quality of the development process.
[0062] The following methods are implemented:
[0063] Step B1: Define error level and scoring standard, establish error severity classification table, and assign basic score to different types of errors;
[0064] Step B2: Collect test execution result data, collect test logs, interface response body and status code, assertion failure information and exception stack from the automated test framework;
[0065] Step B3: Use rule engine or regular expression to match keywords for each failure record to determine the severity level;
[0066] Step B4: Use weighted total score method to score individual problems and problem quantity;
[0067] Step B5: According to the comprehensive score and the set threshold, automatically push the notification.
[0068] III. Obtain the error content generated by running the automated test script, classify and label the error content through natural language processing;
[0069] Standardize the original error script, establish an extensible error classification ontology, and select a classification method according to data volume and accuracy requirements to classify each error content with multiple dimensional labels.
[0070] The classification method uses the following methods:
[0071] Use regular expressions or keyword list matching, or use machine learning classification, or use clustering classification when there is a lack of labeled data;
[0072] Machine learning classification:
[0073] The cleaned text is vectorized, and a classification model is trained using labeled data to output the predicted category and confidence
[0074] After running the automated test script and generating an error report, the error content is classified using natural language processing. The error is classified into five categories (text classification) using named entity recognition and semantic role labeling.
[0075] There are mainly five categories:
[0076] 1. Interface change: parameter name change, input parameter structure change, return value structure change, etc. For example, user_id is changed to userId, the upper limit of day is changed from 100 to 200, etc. According to the error report after running.
[0077] 2. Dependency service exception: third-party interface, open source tool, etc. is unavailable, or the return format of upstream and downstream interfaces is abnormal, etc. According to the error report after running.
[0078] 3. Data dependency problem: database structure change, test data pollution or loss, etc. For example, database records are deleted, according to the error report after running.
[0079] 4. Environment difference: code version upgrade leads to environment configuration change.
[0080] 5. Others: other unclassified errors.
[0081] Four, according to the error content and knowledge graph, analyze and find out the corresponding error root cause, and formulate the corresponding repair strategy according to the error root cause;
[0082] Formulate repair strategies through the following ways:
[0083] Extract key entities and semantic categories from error messages and match them with nodes in the knowledge graph. Extract context dependency chains, perform logical reasoning based on error types, service dependencies, and configuration information, generate error root causes, and match predetermined knowledge graph repair strategy library based on error root cause types.
[0084] According to the error root cause, different repair strategies are executed:
[0085] 1. Interface change: according to the keywords in the error information, locate the specific parameter name change or input parameter structure change, return value change, etc. After locating the error point, modify the corresponding input parameter or expected return result.
[0086] 2. Dependency service exception: according to the error information, determine whether the third-party interface or upstream interface is abnormal, etc. After locating the error point, determine the reason for the error of the interface, and modify the current interface.
[0087] 3. Data dependency issue: Locate the cause of the data error report. If the database structure changes, modify the input parameters or verify the value structure. If the test data is contaminated or missing, recreate the data.
[0088] 4. Environmental differences: Environmental configuration belongs to high-privilege users and can be changed. Therefore, execute the push mechanism to notify the user to confirm whether the environmental configuration has been changed.
[0089] 5. Others: Execute the push mechanism to notify the user to manually change the script.
[0090] Five, according to the error root cause, execute the repair process, change the test script, introduce Git management, automatically submit the repair script to Git, form a new version, and generate a change record.
[0091] Determine the type of error to be repaired, select the corresponding code modification template according to the error type, locate the error position according to the root cause analysis result and the mapping relationship of the knowledge graph, use the script to analyze and modify the error code, and automatically execute the Git operation after modifying the script to generate a structured change log.
[0092] According to the error cause positioning of step four, execute the repair process, change the test script, and introduce git management. The repair script is automatically submitted to git to form a new version and generate a change record. The repair process is shown in step four.
[0093] For example, an interface error "user_id does not exist", the repair code locates the specific keyword in the knowledge graph, and through knowledge reasoning it can be located to userID. Combined with the interface change record, it can be obtained that user_id has been changed to userID. Because the script user_id is modified to userID, the script repair is completed.
[0094] The repair steps are recorded in detail in the event for subsequent backtracking.
[0095] After repair, update the change record related content to the graph.
[0096] If it is determined that the error cannot be self-healed, it is pushed to the user to prompt the user to manually solve it.
[0097] Six, re-run the new version script, check the running result, if there is an error, execute steps two to five until the repair is completed.
[0098] After the update is completed, the script is run again to check the running result, and other debugging needs to be completed except for the problems that cannot be automatically repaired, if there is an error, a round of repair is performed again, the running result is collected, the new failure is evaluated, the repair possibility is judged, the repair success rate and repair time consumption are introduced, and the repair strategy is optimized.
[0099] The repair success rate, time consumption and other indicators are counted to optimize the repair strategy and project management.
[0100] As shown in Figure 2 The system self-monitoring and repairing system based on the knowledge graph adopts the system self-monitoring and repairing method based on the knowledge graph, and comprises a knowledge graph construction module, a test scoring module, an error content classification and labeling module, a root cause analysis and strategy repairing module and a repairing execution and updating module.
[0101] The knowledge graph construction module is used for extracting information from interface documents, database tables and test scripts to construct the knowledge graph of the entire automated test script.
[0102] The test scoring module is used for collecting test execution result data by defining error levels and scoring standards, using a rule engine or a regular expression to match keywords of each failure record to determine the severity level, and adopting a weighted total score method to comprehensively score.
[0103] The error content classification and labeling module is used for obtaining error content generated by running the automated test script, classifying and labeling these contents through natural language processing technology.
[0104] The root cause analysis and strategy repairing module is used for finding out corresponding error root causes based on error content and knowledge graph analysis, and formulating corresponding repair strategies.
[0105] The repairing execution and updating module is used for positioning according to the error root cause, executing the repair process, changing the test script, introducing Git management, automatically submitting the repair script to Git to form a new version, and generating a change record.
[0106] The present application manages the specific content of the script in the form of a knowledge graph, integrates code, documents, change records and the like into a whole, performs knowledge reasoning in the form of a knowledge graph, shapes a repair model, realizes the automatic repair function of the entire automated test script, is more intelligent, does not need manual debugging of the script each time, reduces the manpower maintenance cost of the automated test system, and can monitor the running of the automated test script in combination with the scoring model, thereby improving the efficiency of the entire software test process.
[0107] By using natural language processing technology to classify error information, the error type can be accurately located, and the corresponding repair strategy can be provided. This method can not only handle error conditions that cannot be covered by rules, but also combine historical records for repair. After continuous training, the accuracy will be higher and higher. The system has the ability of dynamic learning and updating. With the increase of the number of uses, it can continuously optimize its repair strategy by analyzing the successful repair cases in the past. The system can also simulate the effectiveness of the repair scheme to avoid invalid repair and further improve the repair success rate.
[0108] The application not only evaluates based on the severity of the error, but also considers multiple dimensions such as repair complexity, historical repair time consumption, etc. to comprehensively evaluate the repair effect. Users can score the repair result and feed back to the knowledge graph and scoring model to form a closed-loop optimization, continuously improving the accuracy and adaptability of the system. The self-monitoring repair method based on the knowledge graph not only improves the error handling capability and efficiency in the automatic testing process, but also reduces the need for manual intervention, achieving automation and intelligentization of the testing process.
[0109] The above is only a preferred embodiment of the present application and is not intended to limit the present application. Any modification, equivalent replacement or improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A system self-monitoring and repair method based on knowledge graph, characterized in that: The following steps are involved: Step S1: Construct an automated test knowledge graph, extract knowledge based on interface documents, database tables, and test scripts, and construct a knowledge graph for the entire automated test script; Step S2: Build an automated test scoring model, run the automated test script, and score; Step S3: Obtain the error content generated by running the automated test script, classify the error content through natural language processing, and annotate it; Step S4: Analyze and find the corresponding error root cause based on the error content and knowledge graph, and formulate a corresponding repair strategy based on the error root cause; Step S5: Locate the root cause of the error, execute the repair process, modify the test script, introduce Git management, automatically submit the repair script to Git, form a new version, and generate a change record; Step S6: Re-run the new version script and check the running results. If there is an error, execute steps S2 to S5 until the repair is completed.
2. The system self-monitoring and repair method based on knowledge graph according to claim 1 is characterized in that: In step S1, the automated testing knowledge graph is constructed in the following manner: Step A1: Clarify the goals and scope of the knowledge graph and associate the semantics between interfaces, databases, and test scripts; Step A2: Knowledge extraction: extracting knowledge related to building a knowledge graph from interface documents, database table structures, and test scripts; Step A3: Knowledge fusion and ontology modeling: building a unified semantic model, defining classes and relationships, unifying naming conventions, performing semantic similarity matching, and introducing unique identifiers; Step A4: Knowledge storage and graph database construction: convert the extracted knowledge into node and edge files, import them through import tools or write them using driver programming, and build the corresponding knowledge graph in combination with the graph database.
3. The system self-monitoring and repair method based on knowledge graph according to claim 1 is characterized in that: The step S2 is implemented in the following manner: Step B1: Define error levels and scoring criteria, establish an error severity grading table, and assign basic scores to different types of errors; Step B2: Collect test execution result data, including test logs, interface response bodies and status codes, assertion failure information, and exception stack from the automated testing framework; Step B3: Use a rule engine or regular expression to perform keyword matching on each failure record to determine the severity level; Step B4: Use the weighted total score method to comprehensively score the scores of individual questions and the impact of the number of questions; Step B5: Make a judgment based on the comprehensive score and the set threshold, and automatically push notification.
4. The system self-monitoring and repair method based on knowledge graph according to claim 1 is characterized in that: The step S3 is implemented in the following manner: Standardize the original error reporting script, establish an extensible error classification ontology, select the classification method according to the data volume and accuracy requirements, and label each error report content with a multi-dimensional label.
5. The system self-monitoring and repair method based on knowledge graph according to claim 1 is characterized in that: The classification methods include: Use regular expressions or keyword list matching, or machine learning classification, or cluster classification in the absence of labeled data; Machine Learning Classification: The cleaned text is vectorized, and the classification model is trained by annotating the data to output the predicted category and confidence level.
6. The system self-monitoring and repair method based on knowledge graph according to claim 1 is characterized in that: In step S4, a repair strategy is formulated in the following manner: Extract key entities and semantic categories from the error report, match them with nodes in the knowledge graph, extract the context dependency chain, perform logical reasoning based on the error type, service dependency, and configuration information, generate the root cause of the error, and match the predetermined knowledge graph repair strategy library based on the root cause type.
7. The system self-monitoring and repair method based on knowledge graph according to claim 1 is characterized in that: The repair is performed in step S5 in the following manner: Identify the error type to be repaired, select the corresponding code modification template based on the error type, locate the error based on the root cause analysis results and the mapping relationship of the knowledge graph, use script parsing to modify the error code, and after modifying the script, automatically execute Git operations to generate a structured change log.
8. The system self-monitoring and repair method based on knowledge graph according to claim 1 is characterized in that: The step S6 is implemented in the following manner: Re-execute the updated script, collect the running results, evaluate the new failure, determine the possibility of repair, introduce the repair success rate and repair time, and optimize the repair strategy.
9. A system self-monitoring and repairing system based on knowledge graph, which adopts the system self-monitoring and repairing method based on knowledge graph as described in any one of right balls 1-8, characterized in that: It includes a knowledge graph construction module, a test scoring module, an error content classification and annotation module, a root cause analysis and strategy repair module, and a repair execution and update module; The knowledge graph construction module is responsible for extracting information from interface documents, database tables, and test scripts to build the knowledge graph of the entire automated test script; The test scoring module is used to define error levels and scoring criteria, collect test execution result data, use rule engines or regular expressions to perform keyword matching on each failure record to determine the severity level, and use weighted total score method to comprehensively score.
10. The system self-monitoring and repairing system based on knowledge graph according to claim 9 is characterized in that: The error content classification and annotation module is used to obtain the error content generated by running the automated test script, classify the content through natural language processing technology, and annotate it; The root cause analysis and strategy repair module is used to find the corresponding error root cause based on the error content and knowledge graph analysis, and formulate corresponding repair strategies accordingly; The repair execution and update module is used to locate the root cause of the error, execute the repair process, change the test script, and introduce Git management, automatically submit the repair script to Git, form a new version, and generate a change record.
Citation Information
Patent Citations
Script quality detection method and computing equipment
CN115640236A
Test script generation method and device of test case and electronic equipment
CN118092881A
Knowledge graph automatic updating method based on natural language processing technology
CN118607623A
Software test result analysis system
CN120508501A