A method, system, and medium for root cause analysis and reproduction of software testing failures.
By capturing assertion execution context and variable snapshot chains in real time during software testing, and combining multiple inference logics, this approach addresses the issues of low intrusion and completeness in data capture, robustness of multi-source evidence fusion, and the semantic gap between static context and dynamic reproduction, thus achieving efficient root cause analysis and reproduction of software test failures.
Patent Information
- Application Number
- CN202611098174.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-11-17
AI Technical Summary
In complex embedded systems and software automation testing, existing technologies struggle to achieve both low-intrusion and complete data capture. It is also difficult to reconcile the objectivity of multi-source diagnostic evidence with the robustness of fusion decision-making. Furthermore, a semantic gap exists between the static capture context and the dynamic, reproducible test environment, making it challenging to analyze and reproduce the root causes of software test failures.
An instrumentation strategy is employed to capture the context information of failed code during assertion execution in real time, forming a variable snapshot chain. Parallel reasoning of multi-dimensional core features is then performed through expert rules, historical pattern matching, and machine learning inference logic to generate an executable replay script to reproduce the failure process.
It enables efficient and automated root cause analysis and reproduction of software test failures, significantly improving software quality and R&D efficiency, reducing the time for location and reproduction, and enhancing the robustness and accuracy of diagnosis.
Smart Images

Figure CN123114944A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software testing technology, and specifically to a method, system, and medium for root cause analysis and reproduction of software testing failures. Background Technology
[0002] Software products offer various services. During software development, each service involves thousands of test cases written by R&D or testing personnel to test its different functions. In the field of software automation testing, assertions are a crucial means of verifying whether the behavior of the system under test meets expectations. With the continuous expansion of testing scale and the increasing complexity of testing scenarios, traditional automated testing frameworks face severe challenges. In complex scenarios such as power terminal testing and protocol conformance testing, the number of test cases can easily reach tens of thousands, resulting in high analysis costs, long processing times, and significant difficulties in locating and reproducing test failures.
[0003] Currently, in complex embedded and software automation testing (such as power terminal protocol testing, protocol conformance testing, and IoT device testing), existing test failure diagnosis and reproduction technologies still face the following unresolved technical problems:
[0004] First, the completeness required for diagnosis and the low intrusiveness of data capture are mutually exclusive. To accurately pinpoint the root cause of test failures, it is necessary to capture multi-dimensional data such as the entire lifecycle of variables and the complete call chain. However, this increases the overhead of test execution, alters the behavior of the system under test, and can even lead to the "Heisenberg effect" (the observation itself interferes with the result). To address this, existing technologies typically use naturally occurring, non-intrusive data (the natural byproducts of test execution, such as logs and traffic replay data) as the data source, but this sacrifices the variable-level completeness required for test diagnosis.
[0005] Secondly, it is difficult to reconcile the objectivity of multi-source diagnostic evidence with the robustness of fusion decision-making. Different root cause reasoning logics each have their own advantages and blind spots, but their reasoning results may contradict each other or have different confidence scales. Therefore, existing technologies, when conducting root cause analysis, either adopt a single reasoning path, perform multi-source fusion at the data level, or conduct linear deep mining. This naturally avoids the problem of "conflicts in multi-source diagnostic evidence (i.e., reasoning results)," but in doing so, it loses the opportunity to improve robustness through the complementarity of different reasoning logics.
[0006] Third, there is a semantic gap between the statically captured context and the dynamically reproducible test environment. Traditional reproduction techniques typically rely on manually reconstructing the environment, constructing data, and setting breakpoints. However, the captured context is static and fragmented, making it difficult to form an executable and debuggable dynamic replay script. To address this, existing reproduction techniques propose constructing new test cases with new parameter combinations in an isolated replay environment and re-executing them. However, this approach can only achieve coarse-grained reproduction at the parameter or scenario level and cannot simulate the series of changes that variables undergo during the test. Therefore, it can only be used to confirm the root cause and cannot assist developers in debugging. Summary of the Invention
[0007] To address the aforementioned technical problems, this invention proposes a method, system, and medium for root cause analysis and reproduction of software testing failures, aiming to overcome the bottleneck in software development efficiency caused by incomplete data, one-sided reasoning of root causes of failures, and difficulties in reproduction during traditional software testing diagnosis and reproduction processes.
[0008] Firstly, this application provides a method for root cause analysis and reproduction of software testing failures, comprising the following steps:
[0009] Capture the context information of failed code during assertion execution in real time;
[0010] An instrumentation strategy is used to track the variable states during the execution of the test script, forming a variable snapshot chain;
[0011] Feature extraction is performed on the context information of the failure code and the variable snapshot chain to obtain multi-dimensional core features;
[0012] Expert rule-based reasoning logic is used to perform deterministic reasoning on the multidimensional core features to obtain the first root cause reasoning result;
[0013] Historical pattern matching reasoning logic is used to perform similarity reasoning on multi-dimensional core features to obtain the second root cause reasoning result;
[0014] Machine learning reasoning logic is used to perform probabilistic prediction reasoning on multidimensional core features to obtain the third root cause reasoning result;
[0015] The evidence is aggregated and sorted for all root cause inference results to obtain a root cause candidate list.
[0016] A replay script is generated based on the failure code context information and variable snapshot chain. The replay script is then executed to reproduce the failure process of verifying root cause candidates.
[0017] Secondly, this application provides a system for analyzing and reproducing the root causes of software testing failures, including:
[0018] Assertion context capturer, used to capture the context information of failed code during assertion execution in real time;
[0019] The variable snapshot chain capturer is used to track the variable state during the execution of test scripts using instrumentation strategies, forming a variable snapshot chain.
[0020] The feature extraction module is used to extract features from the failure code context information and variable snapshot chain to obtain multi-dimensional core features.
[0021] The rule-based reasoning engine is used to perform deterministic reasoning on multi-dimensional core features using expert rule-based reasoning logic to obtain the first root cause reasoning result.
[0022] The pattern matching engine is used to perform similarity reasoning on multi-dimensional core features using historical pattern matching reasoning logic to obtain the second root cause reasoning result.
[0023] The machine learning engine is used to perform probabilistic prediction and reasoning on multi-dimensional core features using machine learning reasoning logic to obtain the third root cause reasoning result.
[0024] The reasoning result aggregation module is used to aggregate and sort all root cause reasoning results to obtain a root cause candidate list.
[0025] The fast replay module is used to generate replay scripts based on failure code context information and variable snapshot chains, and execute the replay scripts to reproduce the failure process of verifying root cause candidates.
[0026] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements a method for root cause analysis and reproduction of software testing failures as described above.
[0027] The beneficial technical effects of the present invention include at least the following:
[0028] 1. This paper proposes a method, system, and medium for root cause analysis and reproduction in software testing. By constructing a complete and collaborative technical solution based on precise capture of failure code context information and low-intrusion variable snapshot chain capture, with multi-level inference evidence fusion as the core, and automatic generation of debuggable replay scripts and root cause candidate lists as the closed loop, this paper transforms the root cause analysis and reproduction process in software testing from a fragmented and time-consuming process heavily reliant on human experience into a highly automated, intelligent, and systematic engineering practice, thereby significantly improving software quality and development efficiency. Specifically, firstly, automated capture logic is implanted at assertion execution points, combined with stack frame filtering algorithms for precise location. Selective instrumentation and incremental storage strategies are employed to capture full lifecycle changes with low intrusion at key locations such as variable declaration, assignment, and comparison, forming a variable snapshot chain. This combination avoids the Heisenberg effect and performance degradation caused by full recording while preserving the complete variable-level trajectory, achieving an ideal balance between "completeness and low intrusion." Secondly, the captured heterogeneous context is transformed into multi-dimensional structured core features, providing a unified input for the subsequent three parallel inference logics. The parallel inference logic employs expert rule-based reasoning for deterministic matching, historical pattern matching for similarity comparison, and machine learning reasoning for probabilistic prediction, each independently outputting root cause category and confidence level from different perspectives. This multi-source evidence is then aggregated and sorted to form a root cause candidate list. This approach retains the complementary advantages of each inference logic while avoiding blind spots and conflicts inherent in single-source reasoning through evidence-level fusion, significantly improving diagnostic robustness. Finally, addressing the semantic gap between the static capture context and the dynamic reproducible environment, an executable and debuggable replay script is generated based on the captured failure code context information and variable snapshot chain. This script simulates the key data flow that led to the failure, allowing developers to reproduce the failure process without manually rebuilding the environment, constructing data, or setting breakpoints, completely breaking the limitations of traditional static fragmented contexts.
[0029] 2. Addressing the contradiction between the completeness required for diagnosis and the low invasiveness of data capture in existing technologies, this application creatively employs an optimized design of "key point instrumentation + real-time writing + incremental storage." Without affecting the main testing flow, capture is only performed at key change points in the variable's lifecycle (variable assignment, comparison, invocation, etc.), forming a continuous trajectory. Furthermore, adjacent snapshot nodes with the same value are merged and deduplicated, rather than being fully recorded. This ensures that the length of the snapshot chain is strictly equal to the number of variable value changes, not the number of captures, thus significantly compressing the data volume. Real-time writing avoids memory accumulation, allowing the solution to be seamlessly integrated into high-speed test execution processes. Simultaneously, the timestamps at the capture points naturally sort the data, eliminating the computational overhead of subsequent sorting. Therefore, while obtaining the complete lifecycle trajectory of the variable from initialization to failure (ensuring completeness), the impact on test performance is kept to a very small extent (low invasiveness).
[0030] 3. Addressing the technical challenge of reconciling the objectivity of multi-source diagnostic evidence with the robustness of fusion decision-making, this application creatively employs a unique design of "parallel reasoning with multiple inference logics + confidence fusion based on the quantity and diversity of evidence sources." This effectively addresses evidence conflicts and noise, enhancing diagnostic robustness. Specifically, the design involves three parallel and complementary mechanisms: rule-based reasoning logic covers known deterministic scenarios, pattern matching covers historically recurring scenarios, and machine learning covers unknown novel scenarios, achieving full coverage of failure scenarios. It is precisely because this application designs three inference logics with different principles to operate in parallel that subsequent evidence aggregation can leverage the complementarity and redundancy of multi-source evidence to output more accurate and robust root cause candidates than any single inference logic. At the same time, the original evidence (including confidence level and source) of each reasoning logic output is retained. By aggregated evidence and calculated comprehensive confidence level, the number of evidence and the diversity of sources are fully utilized to correct bias. This design cleverly balances "depth" and "breadth", making the final root cause candidate ranking more robust, significantly reducing the overall misjudgment rate, and having very strong interpretability.
[0031] 4. Addressing the semantic gap between the statically captured context and the dynamically reproducible test environment, this application uses the variable snapshot chain captured during the data acquisition phase as a "blueprint." It precisely identifies the fundamental operation causing variable anomalies by identifying the source types of changes in the snapshot chain and specifically simulates this operation, rather than broadly modifying parameters. This reduces the granularity of reproduction from the "parameter level" to the "variable state level," bridging the semantic gap from "static recording" to "dynamic execution," and forming a closed-loop verification with the root cause reasoning results obtained from the preceding steps. That is, the replay script does not blindly reproduce the entire test process, but rather simulates data changes related to the most likely root cause based on the ranking in the root cause candidate list. This makes the replay process itself a verification of the root cause hypothesis—if the replay successfully reproduces the failure, the root cause candidate is confirmed; if it fails to reproduce, the system automatically tries the next candidate, achieving a closed loop of "reasoning → verification → feedback." Developers no longer need to manually set up the environment or construct data. They can simply execute the generated replay script to step through the breakpoints and observe the variable states, just like being at the original test site. This significantly improves debugging efficiency and fundamentally solves the two major technical pain points of traditional reproduction: time-consuming and difficult to verify root causes.
[0032] Other features and advantages of the present invention will be disclosed in detail in the following detailed description and accompanying drawings. Attached Figure Description
[0033] The invention will be further described below with reference to the accompanying drawings:
[0034] Figure 1 This is a flowchart of the root cause analysis and reproduction method for software testing according to an embodiment of the present invention.
[0035] Figure 2 This is a schematic diagram of the system structure for root cause analysis and reproduction of software testing failures according to an embodiment of the present invention. Detailed Implementation
[0036] The technical solutions of the embodiments of the present invention will be explained and described below with reference to the accompanying drawings. However, the following embodiments are only preferred embodiments of the present invention and not all of them. Other embodiments obtained by those skilled in the art based on the embodiments in the implementation methods without creative effort are all within the protection scope of the present invention.
[0037] In the following description, terms such as “inner,” “outer,” “upper,” “lower,” “left,” and “right” are used only to indicate orientation or positional relationship for the convenience of describing the embodiments and simplifying the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention.
[0038] Example 1:
[0039] Please see the appendix Figure 1 , Figure 1 This document illustrates a flowchart of a method for analyzing and reproducing the root causes of software testing failures, provided in one embodiment of this specification.
[0040] like Figure 1 As shown, the root cause analysis and reproduction method for software testing failures can include at least the following steps:
[0041] S1 captures the context information of failed codes during assertion execution in real time.
[0042] In this embodiment, the failure code context information refers to the complete context information when the test execution process assertion fails, including the source code context, call stack, and hardware and software environment parameters during test runtime.
[0043] Understandably, in traditional automated testing frameworks, when an assertion fails, the system typically only outputs a simple error message (such as "AssertionError: Expected 0x0000, got 0xE001"), along with a call stack pointing to the implementation file within the assertion framework. Developers need to analyze the lengthy call stack to find the call point in the business code, open the source file, scroll to the vicinity of the suspected failure line number, and combine this with checking logs and recalling the code structure to deduce the failure location—a time-consuming and laborious process. This embodiment, however, by embedding automated capture logic at the assertion execution point, elevates the ability to locate assertion failures from "passively recording results" to "actively and intelligently capturing precise context," and, combined with a stack frame filtering algorithm, achieves sub-second and sub-line-level precise location of the failure position.
[0044] Specifically, in this embodiment, the failure code context information during assertion execution is captured in real time, including:
[0045] S11: When the test script executes any assertion statement, obtain the complete call chain of the current thread.
[0046] In this embodiment, when the test script executes any assertion statement (e.g., `assert response_code==0x0000`), the assertion context capture logic is automatically activated. This logic immediately obtains the complete call chain of the current thread, resulting in an ordered list containing all active stack frames, each corresponding to a function call level. This call chain records the complete execution path from the test entry point to the current assertion point.
[0047] S12 uses a stack frame filtering algorithm based on filename suffix matching to filter the stack frames of the assertion module itself in the complete call chain, and takes the stack frame of the first non-assertion module as the actual caller.
[0048] In this embodiment, the stack frame filtering algorithm based on filename suffix matching is implemented as follows: Each frame in the call stack list is traversed sequentially, and the source filename corresponding to the current stack frame is checked to see if it ends with a typical filename suffix of the assertion module (such as _assert.py, assert_lib.py, etc.). If a match is found, the stack frame is determined to belong to the internal implementation of the assertion module itself and is skipped; otherwise, the stack frame is immediately returned as the actual caller. If no non-assertion module stack frame is found after traversing the entire call stack, a null value is returned.
[0049] It is understood that the stack frame filtering algorithm based on filename suffix matching in this embodiment does not rely on hard-coded module names, but is based on a general pattern of filename suffixes. Therefore, it can adapt to the naming differences of different testing frameworks (such as pytest, unittest, JUnit, etc.) and has good versatility.
[0050] S13, extract the source file path and the failure line number (i.e. the line number where the assertion statement is located) from the actual caller.
[0051] The source file path and the failure line number information precisely indicate the location of the assertion failure in the business code, rather than the call within the assertion framework.
[0052] S14: Read the corresponding source file based on the source file path, extract the code snippets before and after the preset number of failed line numbers, mark the failed lines in the extracted code snippets, and obtain the failure code context information.
[0053] For example, with a preset line number (i.e., context line number parameter) of 5 and the failure line being line 28, the code from line 23 to line 33 is extracted. At the same time, in the extracted code snippet, line 28 is marked as the failure line (e.g., by special comments or color marking) so that it can be visually displayed in the subsequent diagnostic report.
[0054] Understandably, this embodiment creatively captures and extracts "noise" stack frames from the assertion module during assertion execution by matching filename suffixes, directly reaching the actual caller of the business code. This avoids redundant internal call chain pollution within the framework, accurately locates the failure point of the business code, extracts code snippets before and after the failure line, provides developers with "what you see is what you get" context information, reduces the amount of invalid data captured, and significantly shortens the time for locating the failure location.
[0055] S2 employs an instrumentation strategy to track the variable states during the execution of the test script, forming a variable snapshot chain.
[0056] In this embodiment, the variable snapshot chain is used to track the complete lifecycle changes of specified variables in the test script. The variable snapshot chain automatically captures the values of variables at different points in time by performing low-intrusive instrumentation at key code locations such as variable declaration, assignment, and comparison, forming a continuous "snapshot chain." This chain clearly records every step of the variable's change process from its initial value to its final failure value.
[0057] Understandably, in traditional automated testing, when a test fails, developers can only see the final value of the variable at the time of the assertion failure, but cannot know how that variable changed during the test execution. For example, a response code variable might have a final value of 0xE001, but was it wrong from the beginning, or was it incorrectly assigned after a certain API call? This lack of information makes root cause localization extremely difficult, often requiring developers to repeatedly add logs and rerun the test, consuming a significant amount of time (30-60 minutes for a single failure). Furthermore, attempting to record all variable changes would incur huge performance overhead and storage pressure, and could even alter the behavior of the system under test (e.g., the Heisenberg effect). To address this, this embodiment employs a clever design combining selective instrumentation with incremental storage, thereby achieving complete capture of the entire lifecycle of variables without significantly impacting test performance.
[0058] Specifically, in this embodiment, an instrumentation strategy is used to track the variable states during the execution of the test script, forming a variable snapshot chain, including:
[0059] S21 identifies the key code locations of the monitored variables from the test script and uses them as instrumentation points.
[0060] For example, the specific implementation methods for identifying monitoring variables in this embodiment include, but are not limited to, the following three, and this embodiment does not limit them:
[0061] Method 1: Explicit list based on initialization configuration. Method 1 relies on pre-specification by the developer and is the most direct and basic way to identify monitored variables. Specifically, during system startup or test case loading, developers explicitly specify the list of variable names to be monitored through configuration files (such as JSON or YAML format), command-line parameters, or a graphical interface. For example, in power terminal registration testing, developers can configure the monitoring variable `monitored_variables:["response_code","terminal_id"]`.
[0062] Method 2: Inferring the Variable's Change Path During Testing from the Source of Changes in Snapshot Nodes. Method 2 is a bottom-up identification method that does not rely on pre-specification by developers. Instead, it analyzes snapshot nodes captured during test execution to deduce monitorable variables worth paying attention to. Specifically, first, at the start of the test, a general "lightweight probe" is installed at all possible instrumentation points (such as all assignment statements, function call return points, and assertion points). This probe only records the variable name and the source of change, but not the specific value (to reduce initial overhead). Second, when a critical event occurs during test execution, the probe is activated and records relevant information. Then, the system records each critical event as a "variable-event" record, including the variable name, event type, timestamp, and associated code line. By sorting by timestamp, the change path of each variable during the test can be constructed. For example, the change path of the variable `response_code` might be: initialization (line 10) → interface return assignment (line 25) → assertion failure (line 28). Finally, the system scores each variable according to the following rules, and variables with high scores are automatically added to the list of monitored variables.
[0063] Method 3: Utilizing snapshot chain data analysis algorithms to identify change points and detect abnormal patterns, automatically marking high-frequency changes and high-risk variables. Method 3 is an intelligent identification method based on historical data and statistical analysis, suitable for scenarios with a certain amount of existing test execution data, and capable of discovering potential problematic variables.
[0064] Furthermore, these three methods for identifying and monitoring variables are not mutually exclusive and can work together: Method 1 provides basic human prior knowledge to ensure that key variables are not overlooked. Method 2 automatically discovers potentially important variables in the early stages of test execution, compensating for the shortcomings of manual configuration. Method 3, based on long-term data accumulation, identifies abnormal patterns and high-risk variables that are difficult for humans to foresee, enabling continuous optimization. Together, these three methods constitute a progressive variable identification system from "human guidance" to "automatic discovery" and then to "intelligent learning," capable of adapting to test scenarios at different levels of maturity.
[0065] The instrumentation points include, but are not limited to, the declaration of monitored variables, variable assignment statements, comparison operations, function call returns, etc.
[0066] S22, insert snapshot capture code for the monitored variables at the instrumentation point to form the modified test script.
[0067] It is understood that the snapshot capture code for instrumentation in this embodiment only targets the monitored variables and does not interfere with other code logic, ensuring low invasiveness.
[0068] S23 executes the modified test script. Whenever the instrumentation point is reached, the snapshot capture code is triggered to capture the value of the current monitored variable and generate a snapshot node.
[0069] Each snapshot node represents a valid change and can include fields such as the capture timestamp, the name of the monitored variable, the current value of the monitored variable, the source of the change (marking the reason for the change, such as variable initialization, interface return assignment, assertion failure point, etc.), the call stack depth reflecting the execution context, and the associated code line number that triggered the capture. These snapshot nodes are generated naturally in the order of capture time, and the system maintains a list of nodes in memory in ascending order of timestamps to ensure the natural correctness of the order.
[0070] S24. After each snapshot node is generated, an incremental storage strategy is used to store the snapshot nodes in real time to form a time-series database.
[0071] On the one hand, in this embodiment, each snapshot node is written to the time-series database immediately after its generation, rather than being written in batches after the test ends. This real-time storage strategy prevents memory overflow and avoids caching all nodes in memory during test execution, making it particularly suitable for long-running tests. Furthermore, it supports real-time analysis, allowing subsequent root cause analysis to begin analyzing the captured data before the test is even finished, achieving near real-time diagnostics.
[0072] On the other hand, this embodiment employs an incremental storage strategy when writing snapshot nodes to the time-series database. This is achieved by recording only the changes in variable values relative to the previous capture, rather than writing the complete state each time. Specifically, it merges and deduplicates adjacent snapshot nodes with the same value. Here, "adjacent" refers to two nodes that are consecutive in time. For example, if a variable is assigned the value 0xE001 at time t1, and then reads it again at time t2 (without any other assignment operations in between) and triggers a snapshot, but the value is still 0xE001, then the node at time t2 will not be written because its value is the same as at time t1. This merging and deduplication is completed before writing; that is, before writing a new node, the system first queries the value of the last node to which the variable has been written. If the value is the same, the writing is skipped.
[0073] S25, arrange all snapshot nodes in the time series database according to the capture time order to form a variable snapshot chain for each monitored variable.
[0074] For example, a variable snapshot chain can be represented as: S(v,T)={ }, where S(v,T) represents the sequence of snapshot nodes generated by the monitored variable v within the test execution duration T. This represents the i-th snapshot node, where n is the total number of snapshot nodes in the snapshot chain.
[0075] Understandably, this embodiment addresses the contradiction between the completeness required for diagnosis and the low invasiveness of data capture in existing technologies. Through an optimized design of "key point instrumentation + real-time writing + incremental storage," it captures data only at critical points in the variable's lifecycle (variable assignment, comparison, invocation, etc.) without affecting the main testing flow, forming a continuous trajectory. Furthermore, it merges and deduplicates adjacent snapshot nodes with the same value, rather than recording all data, ensuring the snapshot chain length is strictly equal to the number of variable value changes, not the number of captures. This significantly compresses the data volume. Real-time writing avoids memory accumulation, allowing the solution to be seamlessly integrated into high-speed test execution flows. Simultaneously, it utilizes the natural sorting of timestamps at the capture moment, eliminating the computational overhead of subsequent sorting. Thus, while obtaining the complete lifecycle trajectory of a variable from initialization to failure (ensuring completeness), the impact on test performance is kept to a very small extent (low invasiveness). Unlike the "post-event" log analysis of existing technologies, the variable snapshot chain formed in this embodiment is a "in-event" variable-level tracking, which enables developers to trace every step of the variable's change process from the initial value to the final failure value, just like playing back a video. This "full lifecycle tracking" concept fundamentally changes the information foundation of test diagnosis.
[0076] Furthermore, before feature extraction in S3, this embodiment can first standardize the multi-dimensional information data and then store it in a structured manner, specifically including four core storage databases:
[0077] 1. Context Database: Used to store the failure code context information when a test fails, including source code context, call stack, environment parameters, etc.
[0078] 2. Time Series Database: This database is specifically designed to store the change chain data of monitored variables. Furthermore, this embodiment employs a "key point instrumentation + real-time writing + incremental storage" design to write snapshot nodes into the time series database, while simultaneously creating an index using the variable name as the primary key. This index is an inverted index structure that maps each variable name to the physical location (or time range) of all its snapshot nodes in the database. Thus, when it is necessary to retrieve the complete snapshot chain of a monitored variable later, all snapshot nodes of that monitored variable in the time series database can be quickly located directly through the variable name index and returned in ascending order of timestamps, without needing to scan the entire database.
[0079] 3. Expert rule base: Stores diagnostic rules defined by experts in the field. Each rule in the expert rule base includes feature triggering conditions, expert-predefined root cause categories, and confidence levels.
[0080] 4. Historical Pattern Library: Stores historical failure patterns and their corresponding root cause information. Each pattern in the historical pattern library includes a multi-dimensional feature vector of the corresponding historical failure case, a verified root cause category, and the historical pattern matching success rate, providing data support for subsequent pattern matching root cause inference.
[0081] Subsequently, the complete context data packet related to the failed session is received from the data storage layer formed by the structured storage, and then feature extraction is performed.
[0082] S3 extracts features from the failure code context information and variable snapshot chain to obtain multi-dimensional core features.
[0083] It is understandable that feature extraction is the first stage of intelligent root cause analysis in this embodiment. Its task is to transform the captured raw, heterogeneous multidimensional contextual information (i.e., failure code context information and variable snapshot chain) into six-dimensional structured core features, providing a unified input for the subsequent three parallel inference logics.
[0084] Optionally, the multidimensional core features may include error type features, error code features, call chain features, variable snapshot chain features, and may also include time features and environmental features.
[0085] The error type feature reflects the type of failure, such as assertion failure, timeout, type error, network anomaly, etc. Error type features can be represented using one-hot encoding or category indexing; for example, error_type=0 indicates assertion failure. The error code feature reflects the specific error identifier and can be extracted from the failure code context information. For protocol testing scenarios, the error code might be a hexadecimal number (e.g., 0xE001); for API testing, it might be an HTTP status code (e.g., 404, 500) or a business error code. The error code feature is stored as a string or integer. The call chain feature reflects the function call relationship at the time of failure, extracted from the call stack information provided by the failure code context information, including call depth, call path (a sequence of function names from the test entry point to the failure point, which can be encoded as a fixed-length sequence), and module affiliation (the name of the module where the failure occurred, represented by one-hot encoding). The variable snapshot chain features reflect the change trajectory and anomaly patterns of key variables, including the number of changes, the magnitude of changes, outlier markers (i.e., whether the final value of the variable belongs to a predefined set of outliers, such as an error code list), the rate of change, and the sequence of change sources. These indicators are combined into a fixed-length feature vector. The time features reflect the time point of failure and its temporal correlation with other events, including the failure time point, relative execution time (the time difference from the start of the test to the failure), event interval, and time period characteristics (which time of day the failure occurred). The time features are normalized (e.g., divided by the total test duration) to ensure their values range from 0 to 1. The environment features reflect the differences in the operating environment at the time of failure, including host identifier, operating system version, dependent library versions, and configuration parameters. The environment features are converted into numerical vectors using hash encoding or one-hot encoding for processing by machine learning inference logic.
[0086] It is understandable that feature extraction in this embodiment is not an isolated preliminary step; it forms an organic whole with the subsequent "multi-dimensional parallel reasoning" and "evidence fusion and ranking." Specifically, the three reasoning logics (expert rules, historical pattern matching, and machine learning) are different, but they all need to make judgments based on the same facts. Feature extraction covers the nature of errors (error type, error code), variable behavior (variable snapshot chain), execution path (call chain), temporal correlation (temporal features), and environmental differences (environmental features), enabling each reasoning logic to analyze from its own strengths without bias due to missing information. For example, by extracting variable behavior features such as the number of changes, the magnitude of changes, and the sequence of change sources through the variable snapshot chain, the reasoning logic can distinguish between two completely different root cause scenarios: "the variable was wrong from the beginning" and "the variable was incorrectly assigned a value midway." Moreover, the extracted features complement each other, allowing the reasoning logic to cross-validate root cause hypotheses from multiple dimensions. For example, if the rule engine suspects "terminal not registered" based on error code 0xE001, and the variable pattern feature shows that the value comes from an interface return rather than a local assignment, the confidence level is further increased. Conversely, if the variable pattern shows that the value is a local calculation error, the rule engine's confidence level will decrease. This multi-dimensional verification significantly reduces the false positive rate. Without unified feature extraction, each inference logic needs to parse the raw context data itself, which not only leads to redundant calculations but may also result in inconsistent interpretations due to different parsing methods. The feature extraction layer transforms the raw data into structured features in one go, and the three inference logics share the same set of features, ensuring consistency of inference input and inference efficiency.
[0087] S4. Expert rule reasoning logic is used to perform deterministic reasoning on the multidimensional core features to obtain the first root cause reasoning result.
[0088] Historical pattern matching reasoning logic is used to perform similarity reasoning on multi-dimensional core features to obtain the second root cause reasoning result;
[0089] Machine learning reasoning logic is used to perform probabilistic prediction reasoning on multidimensional core features to obtain the third root cause reasoning result.
[0090] Understandably, in this embodiment, step S4 is the second stage of intelligent root cause analysis. Following the six-dimensional core feature vector output from the feature extraction stage, three independent inference logics operate in parallel. Each logic infers the root cause from a different perspective, outputting its own root cause category and its confidence level. The expert rule inference logic transforms the diagnostic experience of domain experts into executable rules, performing deterministic matching on the features of the current failure and quickly outputting high-confidence root cause candidates. The historical pattern matching inference logic compares the similarity of the features of the current failure with historical failure cases, finding the most similar failure patterns from past experience and outputting their corresponding root causes as candidates. The machine learning inference logic utilizes the implicit non-linear patterns in historical data to perform probability prediction on the features of the current failure, outputting the probability distribution of each root cause category.
[0091] On the one hand, in this embodiment, expert rule-based reasoning logic is used to perform deterministic reasoning on the multidimensional core features to obtain the first root cause reasoning result, including:
[0092] A1 matches the currently failed multidimensional core feature with the feature triggering conditions of each rule in the expert rule base one by one. When all feature triggering conditions of a rule match the currently failed multidimensional core feature, the rule is considered triggered.
[0093] In the preceding steps, an expert rule base has been built to store diagnostic rules defined by experts in the field. Each rule in the expert rule base includes a feature triggering condition (composed of a feature condition expression, such as the error type feature being "assertion failure" and the error code feature being "0xE001", the expression being: error_type=="assertion failure" AND error_code contains "0xE001"), an expert-predefined root cause category (a predefined root cause description, such as "the terminal has not completed the pre-registration process"), and a confidence level (a fixed value preset by the expert, with the confidence level value between 0 and 1).
[0094] Furthermore, to enhance the robustness of the rules, fuzzy matching can be used to determine the triggering conditions of some features. Specifically, for numerical features (such as time difference and number of changes), operators such as >, <, and between are supported. For example, time_diff>5000 indicates a time difference exceeding 5 seconds. For string features such as error codes and error messages, operators such as contain, startswith, and regex are supported. For example, error_code contains “0xE0” matches all error codes starting with 0xE0. In call chain features, the * wildcard is supported to match any function name. For example, call_chain matches “*send_request*” matches any call path containing send_request.
[0095] A2, each triggered rule is treated as an independent piece of evidence, and the source of the evidence, the root cause category corresponding to the evidence, and the confidence level are recorded as the first root cause reasoning result.
[0096] For each triggered rule, its predefined root cause category and confidence level are directly output. For example, if the rule RULE_698_001 is matched with a confidence level of 0.85, the output is {Source of Evidence: "Rule Reasoning", Root Cause Category: "Terminal Registration Process Issue", Confidence Level: 0.85}. When multiple rules point to different root causes, the system does not arbitrarily choose one side. Instead, it outputs all triggered rules as independent evidence, which is then used by the subsequent fusion stage to make a comprehensive judgment based on the quantity and diversity of evidence sources, thus avoiding the one-sidedness of rule reasoning.
[0097] Furthermore, if multiple rules point to the same root cause category, they are merged into a single piece of evidence, with the highest confidence level (or a weighted average) used, and all rule IDs involved are noted in the evidence source. This merging strategy helps reduce redundancy in subsequent fusion stages.
[0098] On the other hand, in this embodiment, historical pattern matching reasoning logic is used to perform similarity reasoning on multi-dimensional core features to obtain the second root cause reasoning result, including:
[0099] B1 calculates the similarity between the current failed multidimensional core features and the multidimensional feature vectors of each pattern in the historical pattern library, and uses the obtained similarity value as the initial confidence level.
[0100] In the initial steps, a historical pattern library has been built to store historically occurring failure patterns and their corresponding root cause information. Each pattern in the historical pattern library includes a multi-dimensional feature vector corresponding to the historical failure case, a verified root cause category, and the historical pattern's matching success rate. After each diagnosis, if the developer confirms the true root cause type, the feature vector of the current failure is combined with the confirmed root cause to form a new pattern, which is then stored in the historical pattern library. Simultaneously, if the similarity between the new pattern and an existing pattern exceeds a threshold (e.g., 0.95), it is considered a duplicate pattern, and only the "historical pattern matching success rate" of the existing pattern is updated, avoiding redundant storage and maintaining the timeliness of the pattern library.
[0101] The similarity calculation involves comparing the current failed multidimensional core features with the multidimensional feature vectors of each pattern in the historical pattern library. This can be achieved using an existing weighted cosine similarity formula, with weights preset based on the importance of the feature dimensions (e.g., variable pattern features have higher weights, while time features have lower weights). The similarity value is between 0 and 1. Furthermore, to improve efficiency, an Approximate Nearest Neighbor (ANN) search algorithm (such as HNSW or FAISS) can be used, reducing the time complexity from O(N) to O(logN). Even with a pattern library size in the millions, traversal and retrieval can be completed in milliseconds, allowing the historical pattern library to expand infinitely without impacting performance and accumulating massive amounts of historical experience for long-term operation.
[0102] B2 selects the top K patterns with the highest similarity as evidence and outputs the corresponding root cause category and the matching success rate of historical patterns.
[0103] K can be configured manually, with a default value of 3. For each selected pattern, the system outputs its corresponding root cause category, initial confidence level (similarity value), and historical pattern matching success rate.
[0104] B3, based on the matching success rate of historical patterns, calibrates the initial confidence level, and records the source of evidence, the root cause category corresponding to the evidence, and the calibrated confidence level as the second root cause inference result.
[0105] Specifically, considering the matching success rate of historical patterns, the initial confidence of the output is calibrated: calibrated confidence = initial confidence × (0.5 + 0.5 × matching success rate of historical patterns).
[0106] For example, if the historical pattern P_2025_12_015 is matched with a similarity of 0.82, the output would be {Source of Evidence: "Historical Pattern Matching", Root Cause Category: "Terminal Registration Process Issue", Confidence: 0.82}.
[0107] Understandably, this embodiment calibrates similarity by incorporating historical matching success rates, thus lowering the confidence of patterns that are "similar but have poor historical performance" and increasing the confidence of patterns that are "slightly less similar but have high historical accuracy." This calibration mechanism complements the confidence of rule-based reasoning, jointly improving the reliability of the diagnosis.
[0108] On the other hand, in this embodiment, machine learning inference logic is used to perform probabilistic prediction inference on multi-dimensional core features to obtain the third root cause inference result, including:
[0109] C1. Construct a classification prediction model. The input of the classification prediction model is multi-dimensional core features, and the output is the predicted probability of different root cause categories.
[0110] This embodiment supports multiple classification prediction models. Those skilled in the art can choose the optimal architecture based on the data scale and feature dimensions, and this embodiment does not impose any limitations on this. For example, when the training sample size is in the thousands to hundreds of thousands, gradient boosting trees (LightGBM, XGBoost) can be used. As an alternative, when the feature dimension is high (>100) and there is a lot of noise, the Bagging mechanism of random forests can effectively prevent overfitting. When the training sample size exceeds millions, deep neural networks (MLPs) can be used, employing ReLU activation function and Dropout regularization to capture deeper nonlinear relationships. Furthermore, to improve the stability and generalization ability of prediction, stacking ensemble can be used, that is, using LightGBM, random forests, and MLPs as base learners, using a logistic regression as a meta-learner, and taking the output probabilities of the three base learners as input to learn the optimal weighted combination, so that the final prediction result combines the interpretability of trees and the expressive power of neural networks.
[0111] C2 uses the multidimensional feature vectors of all patterns in the historical pattern library and the root cause categories verified in reality as the training set, and uses the training set to pre-train the classification prediction model.
[0112] Each failure case (i.e., pattern) stored in the historical pattern library contains a multi-dimensional feature vector and a verified root cause category. These cases constitute the training set for supervised learning. All verified failure cases are periodically extracted from the historical pattern library and divided into training and validation sets according to a preset ratio.
[0113] Furthermore, to address the issue of insufficient training samples during the cold start phase, this embodiment also utilizes an expert rule base as auxiliary data to generate synthetic training samples. Specifically, for each expert rule, a feature vector that meets the triggering condition is generated in reverse based on that condition. For example, if the rule requires error_type == "assertion failed" and error_code contains "0xE001", then multiple sets of feature vectors that meet this condition are randomly generated (random perturbations can be added to non-critical features within the allowed range), and the root cause category defined by the rule is used as the label. The confidence level defined by the rule (e.g., 0.85) is used as a soft label, rather than a hard label (0 or 1), which allows the model to not only know "which class the sample belongs to" during learning, but also "what probability this class is correct," thereby improving the model's probability calibration capability. This "rule-guided data augmentation" method enables the classification prediction model to achieve acceptable accuracy in the early stages of deployment, without waiting for data accumulation.
[0114] For example, pre-training a classification prediction model using a training set can be achieved by: employing weighted cross-entropy loss as the loss function, assigning higher weights to minority root causes to alleviate class imbalance; automatically searching for optimal hyperparameters using Bayesian optimization, including maximum tree depth, learning rate, subsampling ratio, and Dropout ratio; and optimizing the macro-average F1 score on the validation set. Finally, the pre-trained classification prediction model is loaded into memory.
[0115] C3 takes the currently failed multidimensional core features as input to the pre-trained classification prediction model and outputs the predicted probability of each root cause category as the confidence level.
[0116] C4. Select the root cause category with the highest predicted probability as evidence, and record the source of the evidence, the root cause category corresponding to the evidence, and the confidence level as the third root cause inference result.
[0117] For example, if the root cause category with the highest predicted probability is selected as the terminal registration process problem, with a predicted probability of 0.77, the output would be {Source of Evidence: "Machine Learning", Root Cause Category: "Terminal Registration Process Problem", Confidence: 0.77}.
[0118] Furthermore, this embodiment can also be designed with a continuous optimization mechanism: after each diagnosis, if the developer confirms the true root cause category, the classification prediction model immediately adds the current feature and the true label as a new sample to the online cache. When the number of cached samples reaches a preset threshold (e.g., 100), an incremental training is triggered, making the classification prediction model more and more accurate with use and adapting to constantly changing test scenarios.
[0119] Since the confidence scores of the three reasoning logics are calculated as follows: the confidence score of rule reasoning comes from the rule definition, the confidence score of pattern matching is the similarity score, and the confidence score of machine learning is the prediction probability, all three ensure that the output confidence score value is within the range of 0 to 1 through methods such as condition matching, similarity calculation, or probability prediction. Therefore, no additional normalization operation is required when calculating the comprehensive confidence score.
[0120] S5: Aggregate and sort all the root cause reasoning results to obtain a root cause candidate list.
[0121] It is understood that in this embodiment, step S5 is the third stage of intelligent root cause analysis, which integrates multi-source evidence (i.e., root cause reasoning results) into a unified and ranked root cause candidate list, providing developers with the most reliable diagnostic suggestions.
[0122] Specifically, in this embodiment, evidence aggregation and sorting are performed on all root cause reasoning results to obtain a root cause candidate list, including:
[0123] S51. Construct an aggregate dictionary based on all root cause reasoning results. The key of the aggregate dictionary is the root cause (string), and the value of the aggregate dictionary is aggregate information. The aggregate information includes the sum of confidence scores (floating-point numbers) of all evidence supporting the corresponding root cause, the number of evidence supporting the corresponding root cause (integer), and the deduplicated set of evidence sources (set, the elements of which are "rule reasoning", "historical pattern matching", and "machine learning").
[0124] In this case, even if a certain reasoning logic outputs multiple pieces of evidence (such as expert rule reasoning logic triggering multiple rules at the same time, or historical pattern matching reasoning logic outputting the first K patterns), each piece of evidence is added to the aggregate dictionary as an independent entry.
[0125] Specifically, for each piece of evidence, it is determined whether the root cause type of the evidence already exists in the aggregate dictionary. If it does, the number of evidences supporting that root cause is incremented by 1, the confidence level of the evidence is added to the sum of the confidence levels of all supporting evidence, and the source of the evidence is added to the deduplication set of evidence sources. If it does not exist, a new entry is created in the aggregate dictionary, the number of evidences supporting the corresponding root cause is set to count=1, the total confidence level of the evidence is set to total_confidence, and the source of the evidence is used as the deduplication set of evidence sources sources.
[0126] For example, suppose the three pieces of evidence for all root cause inference results are: {Evidence Source: "Rule-based Inference", Root Cause Category: "Terminal Not Registered", Confidence: 0.85}, {Evidence Source: "Historical Pattern Matching", Root Cause Category: "Terminal Registration Process Issue", Confidence: 0.82}, and {Evidence Source: "Machine Learning", Root Cause Category: "Terminal Not Registered", Confidence: 0.78}. Then the constructed aggregate dictionary will have two entries:
[0127] Key 1: "Terminal not registered": count=2, total_confidence=0.85+0.78=1.63, sources={"Rule-based reasoning", "Machine learning"}
[0128] Key 2: "Terminal registration process issue": count=1, total_confidence=0.82, sources={"pattern matching"}
[0129] S52, the average of the sum of the confidence levels of the evidence supporting the corresponding root cause is taken to obtain the basic confidence level of the corresponding root cause.
[0130] S53, divide the number of pieces of evidence supporting the corresponding root cause by the total number of all pieces of evidence to calculate the normalized value of the number of pieces of evidence for the corresponding root cause.
[0131] S54. Divide the number of evidence sources (values 1-3) in the deduplication set of evidence sources by the total number of evidence sources to calculate the source diversity normalization value of the corresponding root cause.
[0132] S55, for each root cause in the aggregate dictionary, the comprehensive confidence level is calculated based on the basic confidence level, the normalized value of the number of evidences, and the normalized value of the source diversity of the corresponding root cause.
[0133] For example, the formula for calculating the overall confidence level can be expressed as: Overall Confidence Level = (Base Confidence Level × 0.4) + (Normalized Value of Evidence Quantity × 0.3) + (Normalized Value of Source Diversity × 0.3). The weighting coefficients 0.4, 0.3, and 0.3 can be set based on experience, and this embodiment does not impose any limitations on them.
[0134] S56. Sort all root causes in the aggregate dictionary in descending order of comprehensive confidence, and transform each sorted root cause into a structured root cause candidate to form a root cause candidate list.
[0135] Each sorted entry is formatted as a structured root cause candidate, and each root cause candidate may include a sorting number, a root cause candidate description, a comprehensive confidence level, a number of pieces of evidence supporting the root cause, a number of sources of evidence, and a base confidence level.
[0136] Understandably, the core concept of this embodiment lies in elevating the fusion of multi-source heterogeneous evidence from the existing "decision-level voting" to "evidence-level quantitative aggregation." Existing technologies often employ simple majority voting or weighted averaging, ignoring the diversity and quantity of evidence sources. This embodiment, however, designs a three-factor weighted fusion model, introducing two dimensions: evidence quantity normalization and source diversity normalization. This allows the output of parallel inference to be aggregated fairly, robustly, and interpretably. The final fusion result not only reflects the average quality of the evidence but also its broad support and credibility (source diversity). When a root cause receives support from multiple different inference logics, even if the confidence of each logic is low, its overall confidence will significantly increase; conversely, if only one logic supports it but has a high confidence, its overall confidence will not be excessively amplified. This design cleverly balances "depth" and "breadth," making the final root cause candidate ranking more robust and effectively preventing misjudgments from a single logic from dominating the result. At the same time, each root cause candidate provides detailed information such as overall confidence level, number of evidence sources, number of evidence sources, and basic confidence level. Developers can clearly see "why this root cause candidate is ranked first"—whether it is because of abundant and wide-ranging evidence, or because the confidence level of a certain reasoning logic is particularly high, exhibiting strong interpretability.
[0137] Understandably, this embodiment addresses the technical challenge of reconciling the objectivity of multi-source diagnostic evidence with the robustness of fusion-based decision-making. It creatively employs a unique design of "parallel reasoning with multiple reasoning logics + confidence fusion based on the quantity and diversity of evidence sources" to effectively address evidence conflicts and noise, thereby improving diagnostic robustness. Specifically, it first integrates three different paradigms of reasoning logic—rule-based reasoning, historical pattern matching, and machine learning—into a single system. Multi-perspective cross-validation compensates for the inherent blind spots of a single reasoning logic. Rule-based reasoning excels at handling known, deterministic failure patterns but is ineffective for new scenarios not covered by the rules. Pattern matching excels at identifying recurring failures but has low matching accuracy for entirely new, unseen failure types. Machine learning can learn non-linear relationships from data and generalize to unknown scenarios, but requires a large amount of training data and may produce errors due to data bias. Using only one of these methods will inevitably fail in certain scenarios. Therefore, this embodiment designs for all three to work in parallel and complement each other. Rule-based reasoning covers known deterministic scenarios, pattern matching covers historically recurring scenarios, and machine learning covers unknown, novel scenarios, achieving full coverage of failure scenarios. Because this embodiment designs three inference logics based on different principles to operate in parallel, the subsequent evidence aggregation can leverage the complementarity and redundancy of multi-source evidence to output more accurate and robust root cause candidates than any single inference logic. Secondly, when different data sources point to different root causes (e.g., logs show "timeout," but variable snapshots show "abnormal values"), existing technologies cannot effectively determine which is the true root cause, often leading to misjudgments. Unlike simple voting or weighted averaging, this embodiment retains the original evidence (including confidence level and source) output by each inference logic. Through evidence aggregation and comprehensive confidence level calculation, it fully utilizes the quantity and diversity of evidence sources for correction, significantly reducing the overall misjudgment rate.
[0138] Furthermore, this embodiment can also generate a structured diagnostic report based on the root cause candidate list and display the analysis results through visual charts.
[0139] S6. Generate a replay script based on the failure code context information and variable snapshot chain, and execute the replay script to reproduce the failure process of verifying root cause candidates.
[0140] Understandably, this embodiment automatically generates executable and debuggable replay scripts for root cause candidates in the root cause candidate list, simulating the key data flow that led to the failure to verify the accuracy of the root cause. The success of this embodiment relies on comprehensive capture in the front-end data acquisition phase and accurate reconstruction in the back-end data storage phase. The data acquisition phase achieves a balance between "completeness" and "low invasiveness" through a refined capture strategy (variable snapshot chain capture and assertion context capture working together, designing a low-intrusion full lifecycle capture mechanism), providing a high-quality, low-redundancy data foundation for subsequent intelligent analysis. Without the multi-dimensional context information provided in the first two phases, the replay script cannot be generated. It is precisely this seamless integration of the three that frees developers from the time-consuming work of environment setup and data preparation, allowing them to focus on verifying the problem itself.
[0141] Specifically, in this embodiment, generating a replay script based on the failure code context information and the variable snapshot chain includes:
[0142] S61, retrieve the failure line number and the test path from the start of the test to the failure line number from the failure code context information;
[0143] S62, obtain the complete snapshot node sequence of each monitored variable from the variable snapshot chain.
[0144] Each snapshot node includes a timestamp, the value of the monitored variable, and the type of change source. It may also include the call stack depth and the associated line of code.
[0145] S63, based on the root cause candidate list, identify the key sources of change that need to be reproduced.
[0146] For example, if the root cause candidate in the root cause candidate list is "interface return assignment", then focus on the source of change of the "interface call return" type; if the root cause candidate is "variable initialization error", then focus on the source of change of the "variable initialization" type.
[0147] S64, traverse the sequence of snapshot nodes for all monitored variables and filter out snapshot nodes whose change source type matches the key change source.
[0148] In this embodiment, the snapshot chain of all monitored variables is traversed, and each snapshot node is analyzed and judged. The selection criterion is: the type of change source of the snapshot node is consistent with the key change source pointed to by the root cause candidate.
[0149] S65 configures corresponding simulation data based on the different change source types of the selected snapshot nodes. The simulation data includes the simulation target, simulation code, and simulation return value.
[0150] For example, taking the primary change source type as an example, the implementation of different simulation data configuration logic based on the different change source types of the selected snapshot nodes can be as follows:
[0151] 1. If the change source type is "interface call return", then extract the interface name (which can be obtained from the call stack or associated code line) and return value (snapshot value) from the snapshot node. Generate mock code: In the replay script, use a helper function to intercept the call to this interface and return the snapshot value. For example, if the interface is parse_response() and the return value is 0xE001, then generate mock_interface_return("parse_response",0xE001).
[0152] 2. If the change source type is "variable initialization," then extract the initial value and initialization location (corresponding code line) of the variable. Generate simulation code: In the replay script, directly assign the snapshot value at the variable declaration point, instead of the initial value in the original code. For example, if the original code is response_code=None, then change it to response_code=0xE001.
[0153] 3. If the change source type is "assignment statement", then extract the rvalue expression of the assignment operation (which can be inferred from the change source field or associated code line in the snapshot node) and the value after assignment. Generate simulation code: In the replay script, force the variable to be set to the snapshot value at the assignment statement, or modify the rvalue expression. For example, if the original code is response_code=parse_response(data), then change it to response_code=0xE001.
[0154] 4. If the change source type is "assertion failure point", then extract the variables and their values involved in the assertion. Generate simulation code: In the replay script, set the value of the variable before the assertion to the value at which the assertion fails, so that the assertion will definitely fail. For example, if the original assertion is assert response_code==0x0000, then insert response_code=0xE001 before the assertion.
[0155] 5. If the change source type is "function parameter passing", then extract the function name and the passed parameter value. Generate simulation code: In the replay script, when calling this function, force the snapshot value to be passed as the parameter.
[0156] The process involves generating corresponding simulated return values based on the snapshot node's value and variable type (numeric, string, boolean, enumeration, etc.). Complex types (such as structs and objects) are represented using JSON serialization. The simulated data configuration is stored in a simulated configuration dictionary, with keys representing the simulated target (interface name, variable name, line number, etc.) and values representing the simulated return values. This simulated configuration dictionary is written to the header of the replay script in JSON format as the script's initialization data. The script loads this configuration first during runtime and then applies the simulated logic.
[0157] In this embodiment, the generated replay script contains three core auxiliary functions used to implement the simulation logic:
[0158] 1. Simulate interface return function: `mock_interface_return(interface_name, return_value)` — intercepts calls to the specified interface and makes it return a preset value. The underlying implementation can be achieved through monkey patching or the proxy pattern.
[0159] 2. Function to store mock values: store_mock_value(variable_name, value) — Stores the mock return value in the global mock storage for the test code to read at runtime.
[0160] 3. Function to get mock value: get_mock_value(variable_name) — This function is called by the test code at runtime to get the value of the mocked variable, replacing the variable reading operation in the original code.
[0161] It is understandable that the simulation data generation strategy in this embodiment does not simply fill the script with captured variable values. Instead, it traverses the snapshot chain, identifies nodes where the source of change is an "interface call," automatically generates code to simulate the return value of the interface, and configures it in the global simulation storage. Simultaneously, breakpoints are automatically set based on the failure location, and helper functions are generated to intercept real calls. The key to this step is that the variable snapshot chain captured during the data acquisition phase is not only used for root cause analysis but also directly used as a "blueprint" for generating the replay script. The "change source type" recorded in the variable snapshot chain (such as interface return, assignment, assertion) determines the simulation data generation strategy. This seamless mapping from "captured data" to "replay script" eliminates the enormous workload of manually understanding logs and manually writing simulation data in traditional methods. Without a complete variable snapshot chain on the front end, there would be no automated replay on the back end.
[0162] S66 uses the test path from the start of the test to the line number of the failure as the main body of the replay script. Based on the line number of the failure, it inserts breakpoints, simulated data, and predefined debugging helper functions on the corresponding line of the replay script to generate the replay script.
[0163] In this embodiment, the replay script replicates the core logic of the original test script. Code irrelevant to failure (such as other test cases and irrelevant assertions) is pruned, retaining only the test path from the start of the test to the failure line number. Breakpoints, simulated data, and predefined debugging helper functions are inserted at key locations. This embodiment sets breakpoints on the corresponding lines of the replay script based on the failure location (i.e., the failure line number obtained from the failure code context information). Breakpoints support three step control modes: single-step, step-in, and step-out. Single-step executes one line of code at a time; step-in enters the function call; and step-out exits the current function. Simultaneously, the replay script pauses execution at the breakpoints, allowing developers to observe the status of all monitored variables (by outputting variable values through helper functions).
[0164] It is understood that this embodiment automatically generates an independently executable test replay script based on the complete context information (especially the variable snapshot chain) captured in steps S1 and S2. This replay script can simulate key data that leads to failure (such as simulating interface error values) and automatically set breakpoints at the failure location. Developers do not need to rebuild complex test environments and prepare data; they can simply execute this script to reproduce the failure scenario within minutes (rather than the traditional hours or even days) and supports step-by-step debugging, thereby quickly verifying the root cause.
[0165] Specifically, the execution process of the replay script is as follows: The script runs at a preset speed (default 1.0x speed, adjustable). The script automatically pauses when it reaches a breakpoint, entering interactive debugging mode. Developers can use step controls to execute the code line by line, observe the state changes of each variable, and compare them with records in the snapshot chain. The system automatically highlights areas that are inconsistent with the original snapshot values. Next, it compares the failure phenomena observed during the replay process with the descriptions of root cause candidates. If, after the replay script executes, the variable values, call chains, and error messages observed at the breakpoints are consistent with the expectations of the root cause candidate, then the root cause candidate is considered "reproduced and verified successfully." If it fails, the system automatically tries the next root cause candidate (in descending order of overall confidence), generates a new replay script, and executes it.
[0166] Furthermore, a reproduction verification report can be generated based on the execution results of the replay script. The reproduction verification report includes the root cause candidates and their overall confidence level, the execution results of the replay script (success / failure), the state comparison of variables (original snapshot value vs. replay value), and the final conclusion (root cause confirmed to be effective / root cause needs to be optimized).
[0167] Understandably, to address the semantic gap between the statically captured context and the dynamically reproducible test environment, this embodiment uses the variable snapshot chain captured during the data acquisition phase as a "blueprint." It precisely identifies the fundamental operation causing variable anomalies by identifying the type of change source in the snapshot chain and specifically simulates that operation, rather than broadly modifying parameters. This reduces the granularity of reproduction from the "parameter level" to the "variable state level," bridging the semantic gap from "static recording" to "dynamic execution," and forming a closed-loop verification with the root cause reasoning results obtained from the preceding steps. That is, the replay script does not blindly reproduce the entire test process, but rather simulates data changes related to the most likely root cause based on the ranking in the root cause candidate list. This makes the replay process itself a verification of the root cause hypothesis—if the replay successfully reproduces the failure, the root cause candidate is confirmed; if it fails to reproduce, the system automatically tries the next candidate, achieving a closed loop of "reasoning → verification → feedback." Developers no longer need to manually set up the environment or construct data. They can simply execute the generated replay script to step through the breakpoints and observe the variable states, just like being at the original test site. This significantly improves debugging efficiency and fundamentally solves the two major technical pain points of traditional reproduction: time-consuming and difficult to verify root causes.
[0168] Example 2:
[0169] This embodiment only applies to comparisons with... Figure 1 The differences between the two embodiments will be described in the following descriptions. The technical concepts of the remaining designs are similar to those of the first embodiment, and will not be repeated here.
[0170] Furthermore, while performing evidence aggregation in S5 to obtain the root cause candidate list, this embodiment also includes the following steps:
[0171] A multi-dimensional failure profile is constructed based on historical failure data, and trend prediction is performed.
[0172] Specifically, the root cause candidate list and multi-dimensional failure profile construct a comprehensive view of failure from both micro and macro perspectives. The implementation method for constructing the failure profile is as follows:
[0173] First, extract the execution records of all test cases within the current analysis timeframe (e.g., 30 days) from the data storage layer, including metadata such as the execution result (success / failure), execution time, module, and runtime environment for each test case. Then, calculate global metrics for the failure data, including the number of failed test cases within the timeframe, the success rate, and the average time interval from failure occurrence to root cause identification.
[0174] Next, we will conduct in-depth analysis of the failure data from four dimensions:
[0175] 1. Time dimension: Analyze the distribution and cyclical patterns of failures within a day or week, thereby decomposing the time series into long-term trends, seasonal components, and residuals, and quantifying the contribution of each component;
[0176] 2. Module Dimension: Analyze which functional modules (such as user services, protocol parsing, and data storage) are high-failure areas, and the dependencies between modules. For example, calculate the co-occurrence frequency of failed test cases between different modules, construct a module association matrix, and discover which modules frequently fail simultaneously. Combined with the system architecture's call relationship graph, analyze whether failures propagate along the dependency chain (e.g., if the "protocol parsing module" fails, the "data storage module" also fails).
[0177] 3. Environment dimension: Analyze the distribution of failed test cases in different runtime environments (such as operating system version, dependency library version, host type);
[0178] 4. Variable dimension: Statistically analyze the monitoring variables involved in all failed test cases, sort them by frequency of occurrence, analyze which variables frequently cause anomalies, analyze the co-occurrence relationship between variables, and identify the combination anomaly patterns between variables (i.e., variable pairs or groups of variables that cause anomalies at the same time).
[0179] Then, after the independent analysis of the four dimensions is completed, cross-insight analysis is performed to combine and correlate the results of the analysis from different dimensions, revealing hidden patterns that could not be revealed by a single dimension. Cross-insight analysis includes the following four sub-stages:
[0180] 1. Triggering Timing: Cross-analysis is automatically triggered after all parallel analyses across the four dimensions are completed. The system integrates the statistical data obtained from each dimension into a unified cross-analysis context, ensuring that the data from all dimensions are aligned within the same time window.
[0181] 2. Analysis Object Stage: Combine the analysis results of each dimension in pairs or in multiple dimensions to form cross-analysis pairs. Common cross-combinations include: module dimension and time dimension (cross-combining module distribution, module association, and dependency chain analysis results with hourly, daily, weekly, trend, and periodic patterns results from the time dimension. For example, analyzing whether the failure rate of the "User Service Module" is significantly higher between 2 PM and 4 PM than at other times); environment dimension and module dimension (cross-combining environment distribution, configuration differences, and version impact results from the environment dimension with module distribution results from the module dimension. For example, analyzing whether the failure rate of the "Protocol Parsing Module" is higher in the "Linux Environment" than in the "Windows Environment"); variable dimension and module dimension (cross-combining variable combination anomaly patterns from the variable dimension with module association results from the module dimension. For example, finding that "anomalies in the variable session_token" are always accompanied by failures in the "Authentication Module"); and time dimension and environment dimension (cross-combining periodic patterns from the time dimension with version impact results from the environment dimension. For example, finding that "after each Wednesday release, the failure rate of the new version of the dependency library spikes in the 'container environment'").
[0182] 3. Example Analysis Stage: Statistical significance tests (such as chi-square test or Fisher's exact test) are used to determine whether the associations in the crossover combinations are statistically significant.
[0183] For example, taking a cross-analysis of "module dimension and time dimension": the system detected 120 failures in the "user service module" between 2 PM and 4 PM, while the average number of failures in other time periods was 30. Hypothesis testing showed that the p-value for this difference was less than 0.01, indicating that the association was statistically significant. Further analysis revealed possible causes: 2 PM to 4 PM is a peak business period, with increased concurrent requests. The user service module may experience timeouts or resource contention due to excessive load, leading to a higher failure rate. Therefore, it is inferred that "high concurrent pressure during peak hours" is a potential root cause.
[0184] 4. Results Output Stage: Write all the structured results found in the cross-analysis into the “Cross-Insight” field of the profile. Each insight includes: related dimensions (such as “module dimension and time dimension”), specific findings (such as “the failure rate of the user service module is significantly higher between 2-4 pm than other time periods (120 times vs 30 times, p<0.01)”), inferred reasons (such as “high concurrency pressure during peak periods”), and optimization suggestions (such as “it is recommended to expand the capacity of the user service module or introduce a rate limiting mechanism”).
[0185] Understandably, this embodiment elevates the analysis of test failures from "single-point event diagnosis" to "systemic health assessment." It reveals the structural, cyclical, and interconnected patterns behind failures through a multi-dimensional, comprehensive profile, achieving a shift from passive response to proactive prevention. Traditional test diagnosis focuses on "why did this fail?", while this invention, by constructing a multi-dimensional failure profile, answers deeper questions such as "when, in which modules, in what environments, and under what combinations of variables is failure more likely to occur?" and "what hidden connections exist between these factors?" This enables developers to discover systemic risks at a macro level, pinpoint underlying causes from hidden connections, and take preventative measures in advance.
[0186] The implementation of trend prediction based on historical failure data involves building a time-series prediction model based on historical failure data, calculating trend coefficients, seasonality coefficients, and periodicity coefficients, and then predicting the number of failures in the short term (7 days) and long term (30 days). When the predicted number of failures exceeds a threshold, an anomaly warning is triggered, and the warning signal is proactively pushed to the testing team and developers via email, instant messaging, or system alarm channels. The analysis results of "time period distribution," "daily distribution," "weekly distribution," and "periodic patterns" in the multi-dimensional failure profile can be directly used to calculate the seasonality and periodicity coefficients for trend prediction. For example, if the profile finds that "the failure rate is highest on Wednesdays," the trend prediction will set the seasonality coefficient for Wednesday to a value higher than 1, making the prediction results more realistic.
[0187] Furthermore, this embodiment can also generate a structured diagnostic report based on the root cause candidate list, multi-dimensional failure profiles, and trend predictions. The analysis results are displayed through visual charts, and intelligent alarms are proactively pushed through an alarm notification service based on the severity of the failure and trend predictions. In this embodiment, the construction of multi-dimensional failure profiles and trend predictions do not operate in isolation but together constitute the three-dimensional diagnostic capability of the intelligent analysis layer. Specifically, the time dimension analysis in the failure profile provides a crucial historical data foundation for trend prediction. The failure profile identifies current high-risk combinations (such as "the user service module has a high failure rate between 2-4 PM") and predicts future failure peaks. The combination of these two aspects allows the diagnostic report to not only explain "why it failed this time?" but also warn "where failures might occur in the future?". The system can trigger targeted proactive alarms before a large-scale outbreak of problems, achieving an upgrade from "passive response" to "proactive prevention." This three-dimensional analysis of "space (multi-dimensional profile) × time (trend prediction)" makes diagnosis no longer limited to a single failure event, thus truly realizing a paradigm shift from "passive response" to "proactive prevention."
[0188] Example 3:
[0189] Please see the appendix Figure 2 , Figure 2 This is a schematic diagram of a system structure for root cause analysis and reproduction of software testing failures, provided as an embodiment of this specification.
[0190] like Figure 2 As shown, the software testing failure root cause analysis and reproduction system may include at least:
[0191] Assertion Context Capture 1 is used to capture the context information of failed codes during assertion execution in real time;
[0192] Variable snapshot chain capturer 2 is used to track the variable state during the execution of the test script using an instrumentation strategy, forming a variable snapshot chain;
[0193] Feature extraction module 3 is used to extract features from the failure code context information and variable snapshot chain to obtain multi-dimensional core features.
[0194] Rule-based reasoning engine 4 is used to perform deterministic reasoning on multi-dimensional core features using expert rule-based reasoning logic to obtain the first root cause reasoning result;
[0195] Pattern matching engine 5 is used to perform similarity reasoning on multi-dimensional core features using historical pattern matching reasoning logic to obtain the second root cause reasoning result;
[0196] Machine learning engine 6 is used to perform probabilistic prediction reasoning on multi-dimensional core features using machine learning reasoning logic to obtain the third root cause reasoning result;
[0197] The reasoning result aggregation module 7 is used to aggregate and sort all root cause reasoning results to obtain a root cause candidate list.
[0198] The fast replay module 8 is used to generate a replay script based on the failure code context information and variable snapshot chain, and execute the replay script to reproduce the failure process of verifying root cause candidates.
[0199] It is understood that the technical concept of the software testing failure root cause analysis and reproduction system provided in this embodiment is similar to the technical concept of the aforementioned software testing failure root cause analysis and reproduction method, and will not be repeated here.
[0200] Another embodiment of this specification provides a computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform one or more steps in the above-described method embodiments. The constituent modules of the above-described electronic device, if implemented as software functional units and used as independent downstream task predictions or applications, can be stored in the computer-readable storage medium.
[0201] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this specification are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0202] The above description is merely a preferred embodiment disclosed in this application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of protection involved in this disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-disclosed concept.
[0203] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
Claims
1. A method for failure root cause analysis and reproduction of software testing, characterized in that, Includes the following steps: Capture the context information of failed code during assertion execution in real time; An instrumentation strategy is used to track the variable states during the execution of the test script, forming a variable snapshot chain; Feature extraction is performed on the context information of the failure code and the variable snapshot chain to obtain multi-dimensional core features; Expert rule-based reasoning logic is used to perform deterministic reasoning on the multidimensional core features to obtain the first root cause reasoning result; Historical pattern matching reasoning logic is used to perform similarity reasoning on multi-dimensional core features to obtain the second root cause reasoning result; Machine learning reasoning logic is used to perform probabilistic prediction reasoning on multidimensional core features to obtain the third root cause reasoning result; The evidence is aggregated and sorted for all root cause inference results to obtain a root cause candidate list. A replay script is generated based on the failure code context information and variable snapshot chain. The replay script is executed to reproduce the failure process of verifying root cause candidates.
2. The method for root cause analysis and reproduction of software testing failures as described in claim 1, characterized in that, Capture failure code context information in real time during assertion execution, including: When the test script executes any assertion statement, obtain the complete call chain of the current thread; A stack frame filtering algorithm based on filename suffix matching is used to filter the stack frames of the assertion module itself in the complete call chain, and the stack frame of the first non-assertion module is taken as the actual caller. Extract the source file path and the line number of the failure from the actual caller; Read the corresponding source file based on the source file path, extract the code snippets before and after the preset number of failed line numbers, mark the failed lines in the extracted code snippets, and obtain the failure code context information.
3. The method for root cause analysis and reproduction of software testing failures as described in claim 1, characterized in that, An instrumentation strategy is used to track the variable states during the execution of the test script, forming a variable snapshot chain, including: Identify the key code locations of monitored variables from the test script and use them as instrumentation points; Insert snapshot capture code for the monitored variables at the instrumentation point to form the modified test script; The modified test script is executed, and whenever it reaches an instrumentation point, the snapshot capture code is triggered to capture the value of the currently monitored variable and generate a snapshot node. After each snapshot node is generated, an incremental storage strategy is used to store the snapshot node in real time to form a time-series database. Arrange all snapshot nodes in the time series database in order of capture time to form a variable snapshot chain for each monitored variable.
4. The method for root cause analysis and reproduction of software testing failures as described in claim 3, characterized in that, A replay script is generated based on the failure code context information and variable snapshot chain, including: Obtain the failure line number and the test path from the start of the test to the failure line number from the failure code context information; Obtain the sequence of snapshot nodes for each monitored variable from the variable snapshot chain. Each snapshot node includes a timestamp, the value of the monitored variable, and the type of change source. Identify key sources of change that need to be reproduced based on the root cause candidate list; Traverse the sequence of snapshot nodes for all monitored variables and filter out snapshot nodes whose change source type matches the key change source. Configure corresponding simulation data based on the different change source types of the selected snapshot nodes. The simulation data includes the simulation target, simulation code, and simulation return value. The test path from the start of the test to the line number of the failure is used as the main body of the replay script. Based on the line number of the failure, breakpoints, simulated data, and predefined debugging helper functions are inserted into the corresponding line of the replay script to generate the replay script.
5. The method for root cause analysis and reproduction of software testing failures as described in claim 1, characterized in that, Using expert rule-based reasoning logic, deterministic reasoning is performed on the multidimensional core features to obtain the first root cause reasoning result, including: Construct an expert rule base. Each rule in the expert rule base includes feature triggering conditions, expert-predefined root cause categories, and confidence levels. The current failed multidimensional core feature is matched one by one with the feature triggering conditions of each rule in the expert rule base. When all the feature triggering conditions of a rule match the current failed multidimensional core feature, the rule is considered to be triggered. Each triggered rule is treated as an independent piece of evidence, and the source of the evidence, the root cause category corresponding to the evidence, and the confidence level are recorded as the first root cause inference result.
6. The method for root cause analysis and reproduction of software testing failures as described in claim 1, characterized in that, Historical pattern matching reasoning logic is used to perform similarity reasoning on multi-dimensional core features to obtain the second root cause reasoning results, including: Construct a historical pattern library. Each pattern in the historical pattern library includes a multi-dimensional feature vector of the corresponding historical failure case, a root cause category verified by real data, and the matching success rate of the historical pattern. The similarity between the current failed multidimensional core feature and the multidimensional feature vector of each pattern in the historical pattern library is calculated, and the obtained similarity value is used as the initial confidence score. Select the top K patterns with the highest similarity as evidence, and output the corresponding root cause category and the matching success rate of historical patterns; The initial confidence level is calibrated based on the matching success rate of historical patterns. The source of evidence, the root cause category corresponding to the evidence, and the calibrated confidence level are recorded as the second root cause inference result.
7. The method for root cause analysis and reproduction of software testing failures as described in claim 6, characterized in that, Machine learning reasoning logic is used to perform probabilistic prediction reasoning on multidimensional core features to obtain the third root cause reasoning results, including: Construct a classification prediction model. The input of the classification prediction model is multi-dimensional core features, and the output is the predicted probability of different root cause categories. The multidimensional feature vectors of all patterns in the historical pattern library and the root cause categories verified in reality are used as the training set to pre-train the classification prediction model. Input the currently failed multidimensional core features into the pre-trained classification prediction model, and output the predicted probability of each root cause category as the confidence level. The root cause category with the highest predicted probability is selected as evidence, and the source of the evidence, the root cause category corresponding to the evidence, and the confidence level are recorded as the third root cause inference result.
8. The method for root cause analysis and reproduction of software testing failures as described in claim 7, characterized in that, Evidence is aggregated and ranked from all root cause inference results to obtain a root cause candidate list, including: An aggregate dictionary is constructed based on all root cause inference results. The key of the aggregate dictionary is the root cause, and the value of the aggregate dictionary is aggregate information. The aggregate information includes the sum of the confidence scores of all evidence supporting the corresponding root cause, the number of pieces of evidence supporting the corresponding root cause, and the deduplicated set of evidence sources. The base confidence level of the corresponding root cause is obtained by averaging the sum of the confidence levels of the evidence supporting the corresponding root cause. Based on the number of pieces of evidence supporting the corresponding root cause, the normalized value of the number of pieces of evidence for the corresponding root cause is calculated. Based on the deduplication set of evidence sources, the source diversity normalization value of the corresponding root cause is calculated. For each root cause in the aggregate dictionary, the overall confidence level is calculated based on the base confidence level, the normalized value of the number of evidences, and the normalized value of the source diversity for the corresponding root cause. All root causes in the aggregate dictionary are sorted in descending order of overall confidence, and each sorted root cause is transformed into a structured root cause candidate, forming a root cause candidate list.
9. A failure root cause analysis and reproduction system for software testing, characterized by, include: Assertion context capturer, used to capture the context information of failed code during assertion execution in real time; The variable snapshot chain capturer is used to track the variable state during the execution of test scripts using instrumentation strategies, forming a variable snapshot chain. The feature extraction module is used to extract features from the failure code context information and variable snapshot chain to obtain multi-dimensional core features. The rule-based reasoning engine is used to perform deterministic reasoning on multi-dimensional core features using expert rule-based reasoning logic to obtain the first root cause reasoning result. The pattern matching engine is used to perform similarity reasoning on multi-dimensional core features using historical pattern matching reasoning logic to obtain the second root cause reasoning result. The machine learning engine is used to perform probabilistic prediction and reasoning on multi-dimensional core features using machine learning reasoning logic to obtain the third root cause reasoning result. The reasoning result aggregation module is used to aggregate and sort all root cause reasoning results to obtain a root cause candidate list. The fast replay module is used to generate replay scripts based on failure code context information and variable snapshot chains, and execute the replay scripts to reproduce the failure process of verifying root cause candidates.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, When the computer program is executed by the processor, it implements the method for root cause analysis and reproduction of software testing failures as described in any one of claims 1 to 8.
