UI script layered self-healing method
By constructing business process graphs and four-dimensional element fingerprints, page changes are detected and differentiatedly propagated, solving the problem of delayed self-healing timing of UI automated test scripts in CI/CD mode. This enables the prediction and pre-repair of page changes before the test script is executed, improving testing efficiency and repair accuracy.
Patent Information
- Application Number
- CN202611548011.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-08
- Publication Date
- 2026-11-06
AI Technical Summary
Existing UI automated test scripts in CI/CD mode suffer from locator failure due to frequent page iterations, resulting in delayed self-healing, lack of pre-prediction and pre-repair capabilities, inability to effectively assess the impact of page changes, and lack of business process semantic modeling and global cascading failure prevention for dependent scripts.
By constructing a business process graph and four-dimensional element fingerprints, page changes are detected, differentiated propagation is carried out along the heterogeneous relationship graph, risk classification and pre-repair are performed, and when the location fails, dimensional root cause attribution is performed, minimum scope repair is carried out, and global verification is achieved.
Predict and fix page changes before test script execution, accurately analyze the scope of impact of changes, reduce computational overhead, avoid cascading failures, and improve testing efficiency and repair accuracy.
Smart Images

Figure CN123048353A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a layered self-healing method for UI scripts. Background Technology
[0002] With the rapid iteration of web and mobile applications, UI (User Interface) automated testing has become a crucial means of ensuring software quality. UI automated test scripts identify page elements through locators and simulate user actions to verify business processes. However, in Continuous Integration / Continuous Deployment (CI / CD) models, front-end pages are frequently updated, and the DOM (Document Object Model) structure, visual styles, displayed text, and business processes of page elements often change. This causes the locators of the original test scripts to become ineffective, leading to a large number of test script failures.
[0003] To address the above issues, existing solutions still have the following technical shortcomings: (1) The self-healing mechanism is delayed and lacks the ability to predict and repair in advance. Existing self-healing solutions are all post-event remediation modes, that is, the self-healing repair process is only triggered after a location failure occurs during the execution of the test script. In this mode, the script has already failed to execute and the test process has been interrupted. It is impossible to predict the possible impact of page changes and complete the repair in advance before the script is executed, resulting in low test execution efficiency in the CI / CD pipeline. Even minor changes can cause a large number of script failures.
[0004] (2) Lack of semantic modeling of business processes. Existing technologies do not consider the business process dependencies across pages. For elements that are highly similar in appearance and text but have different business meanings (such as multiple "submit" buttons corresponding to different business scenarios), it is easy to cause matching errors. In addition, existing technologies usually fuse multi-dimensional features into a single vector, which cannot independently update or compare features of each dimension, making it difficult to support fine-grained dimension-level failure attribution.
[0005] (3) The analysis of the scope of impact of changes is too broad. When assessing the scope of impact of page changes, the existing technology usually adopts a simple full-page marking or fixed radius diffusion method. This broad method either misses the truly affected elements or includes a large number of irrelevant elements in the scope of impact, resulting in excessive calculation overhead and insufficient accuracy of subsequent repair.
[0006] (4) Failure attribution is black-boxed, and the scope of repair lacks minimization constraints. After locating the failure, the existing technology cannot break it down to specific dimensions for deviation quantification and root cause localization. Accordingly, the existing repair schemes usually perform full-dimensional recalculation or full-script regeneration, which results in an excessively large repair scope. This not only incurs high computational costs but also easily introduces new fingerprint database pollution problems due to over-repair.
[0007] (5) Only the currently failing script is repaired, lacking global cascading failure prevention for dependent scripts. Existing self-healing solutions typically only repair the single script that fails to execute, without considering that a change to one element may affect multiple test scripts that depend on that element. When the repaired element is shared by multiple scripts in the business process, after repairing the current script, other dependent scripts may still fail in subsequent executions, leading to cascading failures. Summary of the Invention
[0008] In view of the above, it is necessary to provide a layered self-healing method for UI scripts, which aims to solve the problems of delayed self-healing timing and unreasonable repair strategies in UI scripts.
[0009] A layered self-healing method for UI scripts, the layered self-healing method for UI scripts includes: Run historical test scripts and collect historical execution trajectory data of the historical test scripts; Based on the historical execution trajectory data, a business process graph is constructed, and a four-dimensional element fingerprint is constructed. Construct a heterogeneous relationship graph based on the business process diagram and the four-dimensional element fingerprint; In response to UI page change events, detect each initial changed element based on the four-dimensional element fingerprint; Starting with each initial changed element, differential propagation is performed along the heterogeneous relationship graph to obtain each affected element; Perform risk-based pre-repair for each affected element to obtain pre-repair results; Execute the current test script and locate the target element based on the pre-repair results; When location fails, perform dimension-level root cause attribution to obtain the failure determination result; Based on the principle of minimum scope repair, repair is performed according to the failure determination result to obtain the repair result; The repair results are propagated, and after propagation is complete, a global verification of the dependent scripts is performed to obtain the self-healed UI script.
[0010] A UI script layered self-healing device, the UI script layered self-healing device comprising: The acquisition unit is used to run historical test scripts and acquire historical execution trajectory data of the historical test scripts; The construction unit is used to construct a business process graph and a four-dimensional element fingerprint based on the historical execution trajectory data. The construction unit is also used to construct a heterogeneous relationship graph based on the business process graph and the four-dimensional element fingerprint; The detection unit is used to detect each initially changed element based on the four-dimensional element fingerprint in response to UI page change events. A propagation unit is used to propagate differentially along the heterogeneous relationship graph, starting from each initial changed element, to obtain each affected element; The pre-repair unit is used to perform risk-level pre-repair based on each affected element and obtain the pre-repair result; The positioning unit is used to execute the current test script and locate the target element based on the pre-repair result; The execution unit is used to perform dimension-level root cause attribution and obtain the failure determination result when the localization fails. The repair unit is used to perform repair based on the failure determination result according to the principle of minimum scope repair, and obtain the repair result; The verification unit is used to propagate the repair results and, after propagation, to perform global verification of the dependent scripts to obtain the self-healing UI script.
[0011] A computer device, the computer device comprising: A memory for storing at least one instruction; and a processor for executing the instructions stored in the memory to implement the UI script layered self-healing method.
[0012] A computer-readable storage medium storing at least one instruction that is executed by a processor in a computer device to implement the UI script layered self-healing method.
[0013] As can be seen from the above technical solutions, this invention can construct a business process graph based on historical execution trajectory data to capture cross-page and cross-script business causal relationships and data flow dependencies; construct a four-dimensional element fingerprint, considering cross-page business process dependencies, and support fine-grained dimensional-level failure attribution; respond to UI page change events, detect each initial changed element based on the four-dimensional element fingerprint, and capture page changes from the code submission stage before the test script is executed, solving the problem of delayed self-healing timing; starting from each initial changed element, perform differentiated propagation along the heterogeneous relationship graph to obtain each affected element, solving the problem of coarse analysis of the scope of change impact; and execute based on each affected element. Risk-based pre-repair enables targeted repairs before test script execution, upgrading self-healing from post-event remediation to pre-event defense. Executing the current test script and locating target elements based on pre-repair results avoids unnecessary full self-healing repair chains. When location fails, dimensional-level root cause attribution is performed to obtain failure determination results, avoiding black-box failure attribution. Based on the principle of minimum scope repair, repairs are performed according to failure determination results, significantly reducing computational overhead. Propagating repair results and performing global verification of dependent scripts after propagation to obtain the self-healed UI script allows for pre-verification of all scripts dependent on the element before the actual script execution encounters an error, improving repair effectiveness. Attached Figure Description
[0014] Figure 1 This is a flowchart of a preferred embodiment of the UI script layered self-healing method of the present invention.
[0015] Figure 2 This is a functional block diagram of a preferred embodiment of the UI script layered self-healing device of the present invention.
[0016] Figure 3 This is a schematic diagram of the structure of a computer device that implements a preferred embodiment of the UI script layered self-healing method of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0018] like Figure 1 The diagram shown is a flowchart of a preferred embodiment of the UI script layered self-healing method of the present invention. The order of the steps in this flowchart can be changed, and some steps can be omitted, depending on different requirements.
[0019] The UI script layered self-healing method is applied to one or more computer devices. The computer device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0020] The computer device can be any electronic product that can interact with the user, such as a personal computer, tablet computer, smartphone, personal digital assistant (PDA), interactive network television (IPTV), smart wearable device, etc.
[0021] The computer equipment may also include network equipment and / or user equipment. The network equipment includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers.
[0022] The server can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0023] Artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0024] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0025] The network in which the computer device is located includes, but is not limited to, the Internet, wide area network, metropolitan area network, local area network, and virtual private network (VPN).
[0026] S10, run the historical test script and collect the historical execution trajectory data of the historical test script.
[0027] In this embodiment, the historical test script is a historical script that operates on the same UI (User Interface) page as the current test script.
[0028] In this embodiment, the historical execution trajectory data can be collected using a collection probe embedded within the automated test execution framework.
[0029] Specifically, the historical execution trajectory data may include, but is not limited to, the following types of data: 1) Page navigation sequence: Records the URL (Uniform Resource Locator) pattern before and after each navigation; 2) Element operation sequence: Records the operation type (click, input, select, navigate), target element identifier, and operation timestamp; 3) Interface call sequence: Records the interface input parameters and the interface response messages; 4) Changes in application status; 5) The correspondence between elements, pages, operation results, and test scripts.
[0030] In this embodiment, the collected historical execution trajectory data can be normalized and cleaned, including: for DOM (Document Object Model) trees, removing randomly dynamically generated attributes from the front end and performing tag standardization processing; for visual screenshots, unifying the resolution; for raw text, performing word segmentation and stop word filtering; recording the system application state set before and after the operation; and filtering invalid trajectories generated by abnormal script crashes, etc.
[0031] In this embodiment, a mapping table between elements, locators, and test scripts can be established and maintained, including: recording the locator inside each test script, the unique identifier of the page element pointed to by the locator, establishing a bidirectional index, and providing underlying mapping for subsequent graph construction, influence range tracing, and reverse lookup of dependent scripts.
[0032] In this embodiment, snapshots of historical pages from multiple version iterations can also be collected to provide samples for subsequent offline pre-training of four-dimensional fingerprints.
[0033] S11, construct a business process graph and a four-dimensional element fingerprint based on the historical execution trajectory data.
[0034] In this embodiment, the steps of constructing a business process graph and a four-dimensional element fingerprint based on the historical execution trajectory data include: Business operation nodes are extracted from the historical execution trajectory data, and cross-page business association edges are constructed based on the jump relationship between different historical execution trajectory data to obtain the business process graph; Extract the document object model structure, visual layout, text semantics, and business process of each UI page element as four-dimensional features; The four-dimensional features are converted into mutually independent sub-vectors to obtain the four-dimensional element fingerprint.
[0035] The business operation node can be in the form of a quintuple, including: operation type (such as click, input, selection, navigation, etc.), input and output data dependency (such as the source of input parameters and the destination of output data), operation preconditions (such as page state assertions and data ready conditions), state transition function (used to describe the application state transition before and after the operation is executed), and node metadata (such as page URL pattern, element XPath, and operation timestamp).
[0036] The cross-page business association edges are established based on the sequential relationships, co-occurrence relationships, and interface data flows in different script trajectories. For example, if a script performs operation A on Page A and then navigates to Page B, and the state of element B within Page B has a data flow dependency with the input data of operation A, then a directed business association edge is constructed from operation A to element B. The weight of the edge is the association confidence score, which is the proportion of the frequency of this causal relationship among multiple trajectories out of the total number of trajectories.
[0037] The business process graph can transform the execution trajectory of discrete single test scripts into a formalized and computable business process graph, thereby capturing cross-page and cross-script business causal relationships and data flow dependencies. This distinguishes it from local contexts within a page, enabling cross-page business semantic modeling and providing a graph structure foundation for subsequent reverse tracing of dependent scripts.
[0038] The four-dimensional element fingerprint includes: (1) DOM structure sub-vectors: encode tag hierarchy, tag type, and attribute structure; (2) Visual feature sub-vectors: encoding element color, size, and layout position; (3) Text semantic sub-vector: The encoded element displays the semantic vector of the text; (4) Business process sub-vectors: The node identities, prerequisite operation dependencies, and cross-page data flow relationships embedded in the business process graph are extracted from the business process graph.
[0039] Each dimension's sub-vectors can be compared and updated independently.
[0040] The four-dimensional element fingerprint differs from the ordinary multi-dimensional fingerprint that is fused as a whole. It takes the cross-page semantics of the business process as the fourth dimension and splits it into sub-vectors that can be updated independently, providing a basis for subsequent processing.
[0041] In this embodiment, a binding relationship can be established between elements and test script locators.
[0042] In this embodiment, a fingerprint database can be used to record the baseline four-dimensional sub-vector of each element (hereinafter referred to as the baseline four-dimensional element fingerprint), while retaining a version snapshot.
[0043] In other embodiments, a two-level retrieval mechanism can be used to perform the matching of the four-dimensional element fingerprints: the first level uses 64-bit SimHash (Local Sensitive Hash) fingerprints to perform coarse recall of elements, quickly filtering a large set of candidate elements; the second level uses a 128-dimensional fusion vector to perform semantic-level fine ranking of the coarse recall results, completing accurate matching. The two-level retrieval is linked to the page change level: minor changes directly perform fine ranking, moderate changes first perform coarse recall and then fine ranking, and severe changes further combine the heterogeneous relationship graph for disambiguation based on fine ranking.
[0044] In other embodiments, the fingerprint model upon which the four-dimensional element fingerprint relies can be trained using a course-based self-supervised contrastive learning method that is UI change-aware: training is progressively graded according to the difficulty of the change. The first stage applies style-level enhancements (fine-tuning of color, font size, and spacing); the second stage applies structure-level enhancements (insertion, deletion, and position adjustment of document object model nodes); and the third stage applies business-level enhancements (reorganization of business process nodes and modification of cross-page navigation logic). Each stage converges before moving to the next. During training, pairs of elements in the business process graph with the same operation type but different business nodes can be used as hard-to-bear samples, and the weight of the contrastive loss on these hard-to-bear samples can be increased, enabling the fingerprint model to learn the distinguishing features of the business dimension.
[0045] S12, construct a heterogeneous relationship diagram based on the business process diagram and the four-dimensional element fingerprint.
[0046] In this embodiment, constructing a heterogeneous relationship graph based on the business process graph and the four-dimensional element fingerprint includes: Each UI page element is identified as a node, and attribute data for each node is generated based on the four-dimensional element fingerprint. Parent and child nodes are determined based on the document object model structure tree, and parent-child relationship edges are constructed based on the parent and child nodes; Construct business process adjacency edges based on the UI page elements corresponding to adjacent business operation nodes in the business process graph; Identify elements that are disambiguation anchors when locating each UI page element according to the historical test script, and construct anchor dependency edges; The heterogeneous relationship graph is generated based on the nodes, the parent-child relationship edges, the business process adjacency relationship edges, and the anchor point dependency relationship edges. Among them, the parent-child relationship edge, the business process adjacency relationship edge, and the anchor point dependency relationship edge have different propagation attenuation coefficients.
[0047] For example, the decay coefficient of parent-child relationship edges is 0.75, the decay coefficient of business process adjacency relationship edges (edges composed of elements corresponding to directly adjacent business nodes in the business process graph) is 0.45, and the decay coefficient of anchor point dependency relationship edges (edges composed of elements that are disambiguation anchors when locating historical test scripts) is 0.3.
[0048] The heterogeneous relationship graph provides a graph structure foundation for the propagation of subsequent changes and the incremental propagation of repair results.
[0049] S13, in response to the UI page change event, detect each initial change element according to the four-dimensional element fingerprint.
[0050] In this embodiment, the UI page change event refers to the change in the front-end code of the application under test, which may include a code commit event or a build event.
[0051] In this embodiment, detecting each initial change element based on the four-dimensional element fingerprint includes: Extract the page structure before and after the change, and calculate the normalized edit distance of the document object model structure tree based on the page structure to obtain the structure change index; Based on the four-dimensional element fingerprint, the weighted offset of the full-page element fingerprint before and after the change is calculated to obtain the feature drift index; Each initial changed element is located based on the mapping relationship between the code change location and each UI page element, the structural change index, and the feature drift index; Specifically, for each initial changed element, when the structural change index is less than a first structural threshold and the feature drift index is less than a first drift threshold, the page change level of the initial changed element is determined to be mild; when the structural change index is greater than or equal to a second structural threshold, or the feature drift index is greater than or equal to a second drift threshold, the page change level of the initial changed element is determined to be severe; in other cases, the page change level of the initial changed element is determined to be moderate.
[0052] Wherein, the first structural threshold is less than the second structural threshold; the first drift threshold is less than the second drift threshold.
[0053] It can listen for front-end code commit events and retrieve the source code of the versions before and after the changes.
[0054] This can be achieved by using a static DOM parsing engine to parse the pages before and after the changes, and serializing them into an ordered tag tree. A tree edit distance algorithm is then used to calculate the normalized edit distance of the DOM tree, and normalized to a specific value. The interval is used to obtain a structural change index that characterizes the severity of changes in the overall page structure.
[0055] This involves iterating through all registered elements on the page, calculating the weighted cosine distance between the four-dimensional fingerprint vectors before and after the change, and taking the weighted average to obtain the feature drift index.
[0056] Specifically, by using the mapping relationship between the code change location and each UI page element, the structural change index, and the feature drift index, the element directly modified in this code commit, i.e. the source element that directly changed, can be located as each initial change element.
[0057] For dynamic pages, a runtime component tree or DOM can be obtained through construction or controlled rendering, and a mapping between code change locations and page elements can be established.
[0058] The following formula can be used to determine the level of page change: ; in, This indicates a change in page level; Indicates structural change indicators; Indicates the first structural threshold; Indicates the feature drift index; Indicates the first drift threshold; Indicates the second structural threshold; Indicates the second drift threshold; Dynamic adjustments can be made based on historical self-healing results using Bayesian posterior regression.
[0059] The above embodiments enable the capture of page changes during the code submission phase, even before the test script is executed, and the location of the direct source of change—each initial changed element—can be identified. Furthermore, by quantifying the severity of page changes using both structural changes and feature drift metrics, the passive approach of only recognizing changes after a traditional script failure is overcome.
[0060] S14, starting from each initial changed element, perform differential propagation along the heterogeneous relationship graph to obtain each affected element.
[0061] In this embodiment, the differential propagation along the heterogeneous relationship graph, starting from each initial changed element, yields each affected element including: The initial risk value of each initial change element is determined based on its page change level; the initial risk value is the highest for initial change elements with a severe page change level, and the initial risk value is the lowest for initial change elements with a mild page change level. Starting from each initial changed element, with the initial risk value as the starting point, the risk value is iteratively propagated along the edges of the heterogeneous relationship graph; wherein, for each edge traversed, the risk value is attenuated using the propagation attenuation coefficient corresponding to the relationship type to which the edge belongs; The cumulative risk values received by each node in the heterogeneous relationship graph are summed to obtain the cumulative risk value of each node; The UI page elements corresponding to nodes whose cumulative risk value is greater than the risk threshold are identified as each affected element.
[0062] Furthermore, the attenuation coefficients configured earlier based on different edge types (such as parent-child relationship edges) can be reused. For example, the propagation process can be characterized by the following formula: ; This represents the change propagation strength obtained by element e, with values ranging from 1 to 2. ; This represents the initial propagation strength of the root element, which is mapped according to the page change level (e.g., 1.0 for severe, 0.7 for moderate, and 0.4 for mild, with severe > moderate > mild); d represents the number of hops in the propagation path from the root node to the current element e. The type of relation traversed by the k-th hop in the propagation path. The corresponding decay coefficient, such as the parent-child relationship edge in the DOM. The slowest decay and widest propagation range, business process adjacency edges Anchor dependency edge It has the fastest decay rate and the smallest propagation range.
[0063] When the propagation intensity At that time, the corresponding propagation path is directly cut off, and it no longer continues to spread outward.
[0064] The risk value is a quantitative indicator representing the probability that a UI element will fail to locate itself due to a page change. A higher risk value indicates a higher likelihood that the UI element will be impacted by the page change and that subsequent script execution will fail to locate it. The initial risk value can be mapped from the page change level, and the higher the risk level, the greater the likelihood of the UI element failing to locate itself due to the page change. moderate Mild.
[0065] In the above embodiments, instead of simply marking all elements on the entire page as affected elements, a differentiated attenuation is based on three types of relationships: DOM, business logic, and anchor points, distinguishing the strength of the impact of different relationships. Anticipating which elements and test scripts will be affected by the change during the CI / CD (Continuous Integration / Continuous Deployment) code submission phase, while ensuring the integrity of the relationships and controlling computational costs, is the core of proactive prediction and self-healing.
[0066] S15, perform risk-based pre-repair for each affected element to obtain the pre-repair results.
[0067] In this embodiment, a corresponding layered self-healing strategy is determined based on the page change level of each affected element, and pre-repair is performed on the positioning logic of each affected element according to the layered self-healing strategy to obtain each pre-repair result. For elements whose page change level is mildly affected, a locator update strategy is adopted to synchronously update the locators of the associated test scripts. For elements affected by page changes of a moderate level, a graph-assisted localization and layer-by-layer disambiguation strategy is adopted. Candidate elements are recalled based on the heterogeneous relationship graph, and the localization logic is re-determined after layer-by-layer disambiguation in the order of local document object model adjacency anchors, global business data anchors, and historical operation trajectory anchors. For elements whose page change level is severely affected, a business process reconstruction and full propagation update strategy is adopted. The local subgraph of the business process graph is reconstructed and the mapping relationship between business nodes and page elements is rebound. The sub-vectors and positioning logic of each dimension of the affected elements are fully updated, and the update results are propagated to each element and graph node within the affected range of the heterogeneous relationship graph.
[0068] In another implementation, the failure risk value of each affected element can be calculated based on preset weight coefficients (i.e., the weighted sum of structural change indicators, feature drift indicators and business centrality scores), and high, medium and low risk levels can be divided according to preset classification thresholds: high risk level adopts full fingerprint rematch repair strategy, medium risk level adopts local feature offset correction strategy, and low risk level keeps the original element positioning logic unchanged and retains runtime self-healing fallback.
[0069] The business centrality score can be obtained by calculating the node importance of the business process graph based on the PageRank algorithm, and is used to characterize the importance of the business.
[0070] Specifically, when the failure risk value is greater than or equal to the preset high threshold, it is determined to be high risk; when the failure risk value is less than the preset low threshold, it is determined to be low risk; and the rest are medium risk.
[0071] The failure risk value can be calculated according to the following formula: ; This is an index for the structural change of element e. Let B(e) be the feature drift index of element e, and let B(e) be the business centrality score of element e in the business process graph. Let α, β, and γ be the weight coefficients and let α+β+γ=1.
[0072] Different risk levels correspond to different tiered self-healing strategies, including: (1) High risk level: Recalculate the changed four-dimensional fingerprint, only update the changed dimension sub-vectors, and keep the original values of the benchmark library unchanged for the other dimension sub-vectors; update the benchmark fingerprint library and modify the locators of the corresponding affected test scripts in a synchronous manner; (2) Medium risk level: Generate a set of candidate fingerprints and locators under the change page, and store them in the pre-candidate fingerprint cache and locator cache; when the test script runs to locate, it will prioritize matching the pre-candidate fingerprints in the cache and will not modify the baseline fingerprint database. (3) Low risk level: only mark the risk, do not modify the fingerprint database or the script locator, and retain runtime self-healing as a backup.
[0073] The pre-repair results can be in the form of a script failure risk report, which includes, but is not limited to: a list of pages affected by this change, a list of affected elements, and a list of associated scripts. The scripts are sorted according to business priority and marked as pre-repair scripts, cached candidate fingerprint scripts, and risk-only marked scripts. An estimated execution success rate is also included for delivery testers to review.
[0074] Through the above embodiments, high-risk elements and core business scripts can be pre-fixed before test script execution, reducing test interruptions caused by location failures in scenarios with minor changes. Among them, medium-risk elements use cached candidate fingerprints, which can avoid the side effects of excessive repair caused by frequent modification of the baseline fingerprint library; low-risk elements are only marked as risky, leaving runtime self-healing as a fallback, upgrading self-healing from post-event remediation to pre-event defense.
[0075] S16, execute the current test script and locate the target element based on the pre-repair results.
[0076] In this embodiment, locating the target element based on the pre-repair result includes: For page elements that fail to locate in the current test script, retrieve the locator from each pre-fix result and attempt to relocate them. When the location is not matched, the pre-candidate fingerprint cache in each pre-repair result is used for matching; If no match is found, obtain the baseline four-dimensional element fingerprint of the page element, and match the baseline four-dimensional element fingerprint with the real-time four-dimensional element fingerprint of each page element in the current UI page to obtain the candidate element set and the matching confidence of each candidate element. When the maximum matching confidence of each candidate element is less than the preset global positioning success confidence threshold, the runtime positioning is determined to have failed. When the maximum matching confidence is greater than or equal to the preset global positioning success confidence threshold, the candidate element corresponding to the maximum matching confidence is confirmed as the target element, and the runtime positioning is determined to be successful.
[0077] The baseline four-dimensional element fingerprint is the four-dimensional sub-vector of the page element before the current change, recorded in the fingerprint database. The real-time four-dimensional element fingerprint is calculated in real time based on the structure, visual layout, text semantics, and business process characteristics of the current page element. When runtime location fails, no candidate element is identified as the target element, and subsequent attribution and repair are performed with reference to the baseline four-dimensional element fingerprint.
[0078] In other embodiments, when the difference between the highest and second-highest matching confidence in the candidate element set is less than the minimum gap threshold, a hierarchical multi-anchor disambiguation method can be adopted: the matching confidence of the candidate elements is weighted and corrected layer by layer according to the hierarchical order of local document object model neighborhood anchors, global business data anchors, and historical operation trajectory anchors; the next level of anchor calculation is started only when the difference between the highest and second-highest matching confidence after the previous level of correction is still less than the minimum gap threshold, until the candidate gap is widened or all three levels of anchors have been calculated.
[0079] The above embodiments can effectively identify genuine location failure scenarios. For minor, gradual page changes, matching is directly achieved through pre-repair, candidate caching, and four-dimensional element fingerprinting, avoiding unnecessary triggering of the full self-healing repair chain. Simultaneously, it can distinguish between scenarios where script location truly fails and scenarios where minor page changes still result in successful matching, reducing ineffective self-healing overhead.
[0080] S17, when location fails, perform dimension-level root cause attribution to obtain failure determination results.
[0081] In some implementations, the execution of dimensional-level root cause attribution to obtain failure determination results includes: When runtime location fails, the candidate element with the highest matching confidence in the candidate element set is determined as the candidate element to be verified. The current features of the candidate element to be verified are compared with the baseline four-dimensional element fingerprint of the page element to construct a four-dimensional deviation vector; Using the four dimensions corresponding to the four-dimensional deviation vector as dimension nodes, directed edges are constructed according to the preset causal relationship between dimensions, and edge weights representing the deviation transmission amount are assigned to each directed edge to obtain a causal directed graph between dimensions; For each dominant dimension and its corresponding subordinate dimension in the causal directed graph between dimensions, when the deviation of the dominant dimension is greater than the high deviation threshold, there exists a directed edge from the dominant dimension to the subordinate dimension, and the ratio between the deviation of the subordinate dimension and the deviation of the dominant dimension is less than the cascading threshold, the failure determination result is determined to be a cascading failure. When the deviations of more than a preset number of dominant dimensions are all greater than the high deviation threshold, and there are no directed edges between the dimensions that have deviations, or the ratios corresponding to each dominant dimension are greater than or equal to the cascading threshold, the failure determination result is determined to be an independent failure.
[0082] The deviations of each dimension in the four-dimensional deviation vector are normalized to the [0,1] interval to form a vector: the structural dimension deviation is the normalized edit distance of the DOM subtree before and after the change; the visual dimension deviation is the weighted difference of color, size, and layout position features; the text semantic dimension deviation is the cosine distance between text semantic vectors; and the business process dimension deviation is quantified according to the degree of change of the target element's node identity and the dependence of its preceding operations in the business process graph.
[0083] Using the four dimensions corresponding to the four-dimensional deviation vector as dimension nodes, and constructing edges based on the four-dimensional deviation vector, a causal directed graph between dimensions is obtained. For each dominant dimension and its corresponding subordinate dimension in the causal directed graph between dimensions, when the deviation of the dominant dimension is greater than the high deviation threshold and the ratio between the deviation of the subordinate dimension and the deviation of the dominant dimension is less than the cascading threshold, the failure determination result is determined to be a cascading failure. When the deviations of more than a preset number of dominant dimensions are all greater than the high deviation threshold, and the ratio corresponding to each dominant dimension is greater than or equal to the cascading threshold, the failure determination result is determined to be an independent failure.
[0084] The directed edges in the inter-dimensional causal directed graph are constructed based on preset causal relationships between dimensions: changes in the structural dimension can cause deviations in the visual and textual semantic dimensions, and changes in the business process dimension can cause deviations in the structural and textual semantic dimensions. The edge weight of each directed edge represents the amount of deviation propagation caused by the causal relationship. When the deviation of the dominant dimension is greater than the high deviation threshold, and the ratio between the deviation of the subordinate dimension and the deviation of the dominant dimension is less than the cascading threshold, the directed edge is determined to be a valid causal propagation edge.
[0085] The weights of the directed edges are obtained statistically based on historical repair records: for each preset causal edge, the transmission ratio of the subordinate dimension deviation and the dominant dimension deviation under the causal relationship in history is statistically analyzed and used as the initial value of the edge weight, which is continuously updated with the repair results through Bayesian posterior analysis; when a cascade failure is determined, it is also checked whether the difference between the observed subordinate dimension deviation and the dominant dimension deviation and the edge weight product is within a preset tolerance range. If it exceeds the tolerance range, it is determined that the deviation is not transmitted by the causal relationship and is re-attributed as an independent failure.
[0086] When the deviation values of multiple dimensions are close, the following formula for calculating attribution confidence is introduced: The attribution confidence score is used to determine the dominant dimension. For the maximum dimensional deviation, The second largest dimensional bias; when If the value is greater than or equal to 0.3, it is determined to be a single-dimensional dominant value; otherwise, it is determined to be a multi-dimensional joint change.
[0087] For example, the element to be located is the "Submit Order" button on the shopping cart page. In this front-end iteration, its DOM layer was moved from the deep container to the main page, and the layout position was changed accordingly, but the text semantics and business process remained unchanged. The attribution results show a structural dimension deviation of 0.7 and a visual dimension deviation of 0.4, both higher than the high deviation threshold of 0.5. A preset causal edge exists between the structural dimension and the visual dimension, with a historical edge weight of 0.6. The product of the dominant dimension deviation and the edge weight is 0.42. The observed visual dimension deviation of 0.4 is within the tolerance range of ±0.1, and the ratio of visual dimension deviation to structural dimension deviation is approximately 0.57, which is less than the cascading threshold of 0.8. Therefore, it is determined to be a cascading failure with the structural dimension as the dominant dimension. The minimum range repair only reconstructs the DOM subtree mapping and updates the structural subvector. After repair, the visual dimension deviation is recalculated and reduced to 0.1, which is lower than the residual deviation threshold of 0.2. The cascading propagation is eliminated, and no further visual dimension repair is needed. The rematch confidence reaches the preset global positioning success confidence threshold, confirming the target element and updating the positioning information. If the visual dimension deviation is still 0.35 after repair, which is greater than or equal to the residual deviation threshold, it indicates that there are independent changes in the visual dimension. Continue to perform local correction on the visual dimension and then re-evaluate.
[0088] In the case of cascading failure, it indicates that the deviation of the subordinate dimension is initially determined to be caused by the root cause change. The subordinate dimension is not repaired separately first. After the dominant dimension is repaired, the deviation of the subordinate dimension is recalculated, and then it is decided whether additional repair is needed.
[0089] In the case of independent failure, it means that both dimensions have undergone substantial changes and both need to be repaired.
[0090] In the above embodiments, unlike the scheme that relies solely on the overall comprehensive matching score for black-box judgment, this embodiment breaks down the error into four independent dimensions for deviation quantification. This further distinguishes between cascading failures (changes in one dimension leading to shifts in other dimensions) and multi-dimensional independent failures, which can accurately locate the root cause of the failure and provide a decision-making basis for the next step of targeted repair with the smallest scope, avoiding indiscriminate recalculation across all dimensions.
[0091] S18, Based on the principle of minimum scope repair, perform repair according to the failure determination result to obtain the repair result.
[0092] In this embodiment, the repair based on the minimum scope repair principle and the failure determination result includes the following repair results: When the failure determination result is the cascade failure, the dominant dimension is repaired, and the deviation of the subordinate dimension is recalculated after the repair is completed; When the recalculated deviation is less than the residual deviation threshold, the dependent dimension is no longer repaired; When the recalculated deviation is greater than or equal to the residual deviation threshold, continue to repair the dependent dimension; When the failure determination result is the independent failure, the changed dimensions are repaired in descending order of deviation; After each round of repair is completed, matching is re-executed based on the updated four-dimensional element fingerprint. When the maximum matching confidence is greater than or equal to the preset global positioning success confidence threshold and the deviation of each dimension is lower than the repair completion threshold, the corresponding candidate element is confirmed as the target element, and the positioning information of the page element is updated to obtain the repair result.
[0093] Specifically, for cascading failures, only the dominant dimension that is the root cause is repaired first. After repair, the deviation of subordinate dimensions is recalculated: if it is less than the residual deviation threshold, it is considered that the cascading propagation has been eliminated along with the root cause and no further repair is needed; if it is still greater than or equal to the residual deviation threshold, it indicates that there is an independent change in the subordinate dimension, and the subordinate dimension continues to be repaired. For independent failures, the dimensions that have actually changed are repaired in descending order of deviation. Only the sub-vectors of the changed dimensions are updated, while the sub-vectors of other dimensions retain their original values in the baseline library, and no full-dimensional recalculation is performed.
[0094] The minimum repair actions corresponding to each failure mode may include, but are not limited to: 1) Structural Restructuring: Rebuild the DOM subtree mapping and update the locator; only update the DOM dimension subvectors; 2) Copywriting iteration: Only update the semantic sub-vector of the text; call the thesaurus to expand the text matching range; DOM, visual, and business dimension sub-vectors all remain unchanged; 3) Style drift: Only update the visual feature sub-vectors; adjust the tolerance ranges for color, size, and layout; keep other dimensions unchanged; 4) Business restructuring: Triggers partial subgraph reconstruction of the business process graph, rebinding the mapping relationship between business nodes and page elements; only updates business process subvectors; when the deviation of the business dimension exceeds the threshold and other dimensions cannot be explained and fail, the large language model is called as needed to assist in business semantic reasoning. 5) Joint Changes: Repair the two changed dimensions in descending order of deviation; after repairing each dimension, re-evaluate the deviations of the remaining dimensions; 6) Comprehensive restructuring: Execute the complete three-level self-healing process, recalculate multiple dimensions, and partially restructure the business graph.
[0095] After each round of repair is completed, the deviations of each dimension for the corresponding element are recalculated. If all deviations are below the repair completion threshold, the repair is considered successful; otherwise, the next dimension to be repaired is processed. If the deviations still do not meet the threshold after all processing is completed, the repair is marked as failed.
[0096] If a repair fails, the baseline four-dimensional element fingerprint and locator before the repair are restored (i.e., the repair action is rolled back). The page element is added to the manual review list, and the propagation of the repair result and global verification of dependent scripts are not triggered to avoid spreading unverified repairs to related elements and dependent scripts. Conversely, if the repair is successful and the target element is confirmed, the locator of the page element is updated to point to the confirmed target element. The baseline four-dimensional element fingerprint of that element in the fingerprint database is updated synchronously, and a version snapshot is retained. Then, propagation and global verification of dependent scripts are performed.
[0097] In the above embodiments, the traditional black-box full-scale repair can be upgraded to dimension-level minimal-range targeted repair, which only modifies the dimension sub-vectors that have actually changed, avoiding unnecessary full-dimensional recalculation. In cascading failure scenarios, only the root cause dimension is repaired, and subordinate dimensions are automatically eliminated as the root cause is repaired, significantly reducing computational overhead and minimizing the risk of fingerprint database contamination caused by over-repair.
[0098] S19, propagate the repair results, and after propagation is complete, perform global verification of dependent scripts to obtain the self-healed UI script.
[0099] In this embodiment, the process of propagating the repair result and performing a global validation of the dependent scripts after propagation to obtain the self-healed UI script includes: The target element that has been successfully repaired and confirmed is used as the root node for propagation, and breadth-first propagation is performed along the edges of the heterogeneous relationship graph. Among them, the propagation intensity is attenuated by the corresponding attenuation coefficient for each edge, and the corresponding propagation path is truncated when the propagation intensity is less than the propagation termination threshold. Only the elements corresponding to the propagation paths whose propagation intensity is greater than or equal to the propagation termination threshold are propagated. After the propagation is completed, starting from the business operation node corresponding to the repaired target element, all reachable nodes are traversed in reverse along the incoming edges of the business process graph, and all associated test scripts on the traversal path are collected. Obtain the business centrality score of each element corresponding to each associated test script in the business process graph; The corresponding elements are pre-verified for location based on the business centrality scores from high to low to obtain the pre-verification results; wherein, the location pre-verification only performs location matching calculations and does not fully execute the test script; Perform self-healing processing on the corresponding elements based on the pre-verification results; Integrate all the elements after self-healing to obtain the UI script.
[0100] One approach to communication can be similar to the differentiated communication mentioned earlier, which will not be elaborated here.
[0101] Only the dimension sub-vectors affected by this change are recalculated; the entire page and all elements are not recalculated.
[0102] By employing restricted propagation, the consistency problem of simultaneous changes to related elements after a single element is repaired can be resolved. This embodiment avoids brute-force full-page recalculation, significantly reducing computational overhead while ensuring the consistency of fingerprints for related elements.
[0103] The step of performing self-healing processing on the corresponding elements based on the pre-verification results includes: 1) If the confidence level of the target element in the script matches the security threshold, the script is risk-free and requires no modification. 2) If the confidence level is less than the security threshold: prioritize reusing the fingerprint updated by this restricted propagation and synchronously update the location information of the script; 3) If the confidence level is still lower than the safety threshold after the propagation and update, add the script to the manual review checklist and output a prompt to the tester.
[0104] By performing global validation of dependent scripts, it overcomes the limitation of traditional self-healing methods that only fix the currently erroneous script. It identifies the potential for cascading failures caused by single-point element changes, where "fixing one leads to a whole host of failures." Before a script actually executes and causes an error, it pre-validates all scripts that depend on that element and synchronizes scripts that can be automatically repaired. For cases that cannot be automatically repaired, a manual checklist is generated to prevent batch cascading failures from the source.
[0105] In this embodiment, information from each pre-repair and each runtime self-healing event throughout the entire chain can also be completely stored in the original repair feedback record library.
[0106] The recorded fields may include: change level determination criteria, four-dimensional deviation vector, candidate set screening records, multi-level anchor disambiguation score, attribution determination results, failure mode, selected repair strategy, repair success or failure marker, repair time, number of heterogeneous propagation update coverage elements, associated script pre-verification results, and failure root causes of repair failure scenarios.
[0107] Based on the original feedback records, a structured natural language self-healing interpretable reasoning report can be generated for manual review and troubleshooting.
[0108] Through the above embodiments, the entire self-healing decision-making process can be fully preserved, solving the problem of the self-healing system being a black box and unexplainable. This provides original feedback data sources for subsequent adaptive tuning of system parameters and model iteration, and can also assist manual personnel in quickly locating the root cause of self-healing failure, thereby reducing operation and maintenance costs.
[0109] As can be seen from the above technical solutions, this invention can construct a business process graph based on historical execution trajectory data to capture cross-page and cross-script business causal relationships and data flow dependencies; construct a four-dimensional element fingerprint, considering cross-page business process dependencies, and support fine-grained dimensional-level failure attribution; respond to UI page change events, detect each initial changed element based on the four-dimensional element fingerprint, and capture page changes from the code submission stage before the test script is executed, solving the problem of delayed self-healing timing; starting from each initial changed element, perform differentiated propagation along the heterogeneous relationship graph to obtain each affected element, solving the problem of coarse analysis of the scope of change impact; and execute based on each affected element. Risk-based pre-repair enables targeted repairs before test script execution, upgrading self-healing from post-event remediation to pre-event defense. Executing the current test script and locating target elements based on pre-repair results avoids unnecessary full self-healing repair chains. When location fails, dimensional-level root cause attribution is performed to obtain failure determination results, avoiding black-box failure attribution. Based on the principle of minimum scope repair, repairs are performed according to failure determination results, significantly reducing computational overhead. Propagating repair results and performing global verification of dependent scripts after propagation to obtain the self-healed UI script allows for pre-verification of all scripts dependent on the element before the actual script execution encounters an error, improving repair effectiveness.
[0110] like Figure 2 The diagram shown is a functional block diagram of a preferred embodiment of the UI script layered self-healing device of the present invention. The UI script layered self-healing device 11 includes a collection unit 110, a construction unit 111, a detection unit 112, a propagation unit 113, a pre-repair unit 114, a positioning unit 115, an execution unit 116, a repair unit 117, and a verification unit 118. The module / unit referred to in this invention refers to a series of computer program segments that can be executed by a processor and perform a fixed function, and are stored in memory. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0111] The acquisition unit 110 is used to run historical test scripts and acquire historical execution trajectory data of the historical test scripts; The construction unit 111 is used to construct a business process graph and a four-dimensional element fingerprint based on the historical execution trajectory data. The construction unit 111 is also used to construct a heterogeneous relationship graph based on the business process graph and the four-dimensional element fingerprint; The detection unit 112 is used to detect each initial changed element according to the four-dimensional element fingerprint in response to UI page change events; The propagation unit 113 is used to propagate differentially along the heterogeneous relationship graph, starting from each initial changed element, to obtain each affected element; The pre-repair unit 114 is used to perform risk-level pre-repair according to each affected element to obtain a pre-repair result; The positioning unit 115 is used to execute the current test script and locate the target element according to the pre-repair result; The execution unit 116 is used to perform dimension-level root cause attribution when the localization fails, and obtain the failure determination result. The repair unit 117 is used to perform repair based on the failure determination result according to the principle of minimum scope repair, and obtain the repair result. The verification unit 118 is used to propagate the repair result and, after propagation, to perform global verification of the dependent script to obtain the self-healing UI script.
[0112] As can be seen from the above technical solutions, this invention can construct a business process graph based on historical execution trajectory data to capture cross-page and cross-script business causal relationships and data flow dependencies; construct a four-dimensional element fingerprint, considering cross-page business process dependencies, and support fine-grained dimensional-level failure attribution; respond to UI page change events, detect each initial changed element based on the four-dimensional element fingerprint, and capture page changes from the code submission stage before the test script is executed, solving the problem of delayed self-healing timing; starting from each initial changed element, perform differentiated propagation along the heterogeneous relationship graph to obtain each affected element, solving the problem of coarse analysis of the scope of change impact; and execute based on each affected element. Risk-based pre-repair enables targeted repairs before test script execution, upgrading self-healing from post-event remediation to pre-event defense. Executing the current test script and locating target elements based on pre-repair results avoids unnecessary full self-healing repair chains. When location fails, dimensional-level root cause attribution is performed to obtain failure determination results, avoiding black-box failure attribution. Based on the principle of minimum scope repair, repairs are performed according to failure determination results, significantly reducing computational overhead. Propagating repair results and performing global verification of dependent scripts after propagation to obtain the self-healed UI script allows for pre-verification of all scripts dependent on the element before the actual script execution encounters an error, improving repair effectiveness.
[0113] like Figure 3 The diagram shown is a structural schematic of a computer device that implements a preferred embodiment of the UI script layered self-healing method of the present invention.
[0114] The computer device 1 may include a memory 12, a processor 13, and a bus (the arrow in the figure represents the bus), and may also include a computer program stored in the memory 12 and executable on the processor 13, such as a UI script layered self-healing program.
[0115] Those skilled in the art will understand that the schematic diagram is merely an example of computer device 1 and does not constitute a limitation on computer device 1. Computer device 1 can be either a bus topology or a star topology. Computer device 1 may also include more or fewer other hardware or software than shown in the diagram, or different component arrangements. For example, computer device 1 may also include input / output devices, network access devices, etc.
[0116] It should be noted that the computer device 1 described is merely an example. Other existing or future electronic products that are adaptable to this invention should also be included within the scope of protection of this invention and are incorporated herein by reference.
[0117] The memory 12 includes at least one type of readable storage medium, such as flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the computer device 1, such as a portable hard drive of the computer device 1. In other embodiments, the memory 12 can be an external storage device of the computer device 1, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., equipped on the computer device 1. Furthermore, the memory 12 can include both internal and external storage units of the computer device 1. The memory 12 can be used not only to store application software and various types of data installed on the computer device 1, such as the code of UI script layered self-healing programs, but also to temporarily store data that has been output or will be output.
[0118] In some embodiments, the processor 13 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits packaged with the same or different functions, including combinations of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 13 is the control unit of the computer device 1, connecting various components of the computer device 1 via various interfaces and lines. It executes programs or modules stored in the memory 12 (e.g., executing UI scripts, layered self-healing programs, etc.) and calls data stored in the memory 12 to perform various functions of the computer device 1 and process data.
[0119] The processor 13 executes the operating system of the computer device 1 and various installed applications. The processor 13 executes the applications to implement the steps in the various UI script layered self-healing method embodiments described above, for example... Figure 1 The steps are shown.
[0120] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of performing specific functions, which describe the execution process of the computer program in the computer device 1. For example, the computer program may be divided into a data acquisition unit 110, a data construction unit 111, a detection unit 112, a propagation unit 113, a pre-repair unit 114, a location unit 115, an execution unit 116, a repair unit 117, and a verification unit 118.
[0121] The integrated unit implemented as a software functional module described above can be stored in a computer-readable storage medium. This software functional module, stored in a storage medium, includes several instructions to cause a computer device (which may be a personal computer, computer equipment, or network device, etc.) or processor to execute portions of the UI script layered self-healing method described in the various embodiments of this invention.
[0122] If the modules / units integrated in the computer device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware devices. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above.
[0123] The computer program includes computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory, etc.
[0124] Furthermore, the computer-readable storage medium may primarily include a stored program area and a stored data area, wherein the stored program area may store the operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of blockchain nodes, etc.
[0125] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.
[0126] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, in... Figure 3 The bus is represented by only one straight line, but this does not mean that there is only one bus or one type of bus. The bus is configured to enable communication between the memory 12 and at least one processor 13, etc.
[0127] Although not shown, the computer device 1 may also include a power supply (such as a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 13 through a power management device, thereby enabling functions such as charging management, discharging management, and power consumption management. The power supply may also include one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The computer device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be described in detail here.
[0128] Furthermore, the computer device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is typically used to establish communication connections between the computer device 1 and other computer devices.
[0129] Optionally, the computer device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the computer device 1 and to display a visual user interface.
[0130] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0131] It will be understood by those skilled in the art that Figure 3 The structure shown does not constitute a limitation on the computer device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0132] Combination Figure 1 The memory 12 in the computer device 1 stores multiple instructions to implement a UI script layered self-healing method, and the processor 13 can execute the multiple instructions to achieve: Run historical test scripts and collect historical execution trajectory data of the historical test scripts; Based on the historical execution trajectory data, a business process graph is constructed, and a four-dimensional element fingerprint is constructed. Construct a heterogeneous relationship graph based on the business process diagram and the four-dimensional element fingerprint; In response to UI page change events, detect each initial changed element based on the four-dimensional element fingerprint; Starting with each initial changed element, differential propagation is performed along the heterogeneous relationship graph to obtain each affected element; Perform risk-based pre-repair for each affected element to obtain pre-repair results; Execute the current test script and locate the target element based on the pre-repair results; When location fails, perform dimension-level root cause attribution to obtain the failure determination result; Based on the principle of minimum scope repair, repair is performed according to the failure determination result to obtain the repair result; The repair results are propagated, and after propagation is complete, a global verification of the dependent scripts is performed to obtain the self-healed UI script.
[0133] Specifically, the processor 13's implementation method for the above instructions can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0134] It should be noted that all the data involved in this case was legally obtained.
[0135] If any AI models, software tools, or components not belonging to this company appear in the embodiments of this invention, they are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this invention has been obtained by an entity authorized (with the knowledge and consent) or fully authorized by all parties through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.
[0136] Unless otherwise specified, the network models used in this embodiment are all general models with a general structure, and are trained and fine-tuned using data related to this embodiment, so as to be applicable to this embodiment.
[0137] In the several embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0138] This invention can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This invention can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This invention can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0139] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0140] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0141] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0142] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0143] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices described in this invention can also be implemented by a single unit or device through software or hardware. Terms such as "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A layered self-healing method for UI scripts, characterized in that, The UI script layered self-healing method includes: Run historical test scripts and collect historical execution trajectory data of the historical test scripts; Based on the historical execution trajectory data, a business process graph is constructed, and a four-dimensional element fingerprint is constructed. Construct a heterogeneous relationship graph based on the business process diagram and the four-dimensional element fingerprint; In response to UI page change events, detect each initial changed element based on the four-dimensional element fingerprint; Starting with each initial changed element, differential propagation is performed along the heterogeneous relationship graph to obtain each affected element; Perform risk-based pre-repair for each affected element to obtain pre-repair results; Execute the current test script and locate the target element based on the pre-repair results; When location fails, perform dimension-level root cause attribution to obtain the failure determination result; Based on the principle of minimum scope repair, repair is performed according to the failure determination result to obtain the repair result; The repair results are propagated, and after propagation is complete, a global verification of the dependent scripts is performed to obtain the self-healed UI script.
2. The UI script layered self-healing method as described in claim 1, characterized in that, The steps of constructing a business process graph and a four-dimensional element fingerprint based on the historical execution trajectory data include: Business operation nodes are extracted from the historical execution trajectory data, and cross-page business association edges are constructed based on the jump relationship between different historical execution trajectory data to obtain the business process graph; Extract the document object model structure, visual layout, text semantics, and business process of each UI page element as four-dimensional features; The four-dimensional features are converted into mutually independent sub-vectors to obtain the four-dimensional element fingerprint.
3. The UI script layered self-healing method as described in claim 2, characterized in that, The step of constructing a heterogeneous relationship graph based on the business process diagram and the four-dimensional element fingerprint includes: Each UI page element is identified as a node, and attribute data for each node is generated based on the four-dimensional element fingerprint. Parent and child nodes are determined based on the document object model structure tree, and parent-child relationship edges are constructed based on the parent and child nodes; Construct business process adjacency edges based on the UI page elements corresponding to adjacent business operation nodes in the business process graph; Identify elements that are disambiguation anchors when locating each UI page element according to the historical test script, and construct anchor dependency edges; The heterogeneous relationship graph is generated based on the nodes, the parent-child relationship edges, the business process adjacency relationship edges, and the anchor point dependency relationship edges. Among them, the parent-child relationship edge, the business process adjacency relationship edge, and the anchor point dependency relationship edge have different propagation attenuation coefficients.
4. The UI script layered self-healing method as described in claim 3, characterized in that, The step of detecting each initial change element based on the four-dimensional element fingerprint includes: Extract the page structure before and after the change, and calculate the normalized edit distance of the document object model structure tree based on the page structure to obtain the structure change index; Based on the four-dimensional element fingerprint, the weighted offset of the full-page element fingerprint before and after the change is calculated to obtain the feature drift index; Each initial changed element is located based on the mapping relationship between the code change location and each UI page element, the structural change index, and the feature drift index; Specifically, for each initial changed element, when the structural change index is less than a first structural threshold and the feature drift index is less than a first drift threshold, the page change level of the initial changed element is determined to be mild; when the structural change index is greater than or equal to a second structural threshold, or the feature drift index is greater than or equal to a second drift threshold, the page change level of the initial changed element is determined to be severe; otherwise, the page change level of the initial changed element is determined to be moderate. Wherein, the first structural threshold is less than the second structural threshold; the first drift threshold is less than the second drift threshold.
5. The UI script layered self-healing method as described in claim 4, characterized in that, Starting with each initially changed element, differential propagation is performed along the heterogeneous relationship graph to obtain each affected element, including: The initial risk value of each initial change element is determined based on its page change level; the initial risk value is the highest for initial change elements with a severe page change level, and the initial risk value is the lowest for initial change elements with a mild page change level. Starting from each initial changed element, with the initial risk value as the starting point, the risk value is iteratively propagated along the edges of the heterogeneous relationship graph; wherein, for each edge traversed, the risk value is attenuated using the propagation attenuation coefficient corresponding to the relationship type to which the edge belongs; The cumulative risk values received by each node in the heterogeneous relationship graph are summed to obtain the cumulative risk value of each node; The UI page elements corresponding to nodes whose cumulative risk value is greater than the risk threshold are identified as each affected element.
6. The UI script layered self-healing method as described in claim 4, characterized in that, The pre-repair process, which involves performing risk-based classification for each affected element, yields the following pre-repair results: The corresponding layered self-healing strategy is determined based on the page change level of each affected element, and the positioning logic of each affected element is pre-repaired according to the layered self-healing strategy to obtain each pre-repair result. For elements whose page change level is mildly affected, a locator update strategy is adopted to synchronously update the locators of the associated test scripts. For elements affected by page changes of a moderate level, a graph-assisted localization and layer-by-layer disambiguation strategy is adopted. Candidate elements are recalled based on the heterogeneous relationship graph, and the localization logic is re-determined after layer-by-layer disambiguation in the order of local document object model adjacency anchors, global business data anchors, and historical operation trajectory anchors. For elements whose page change level is severely affected, a business process reconstruction and full propagation update strategy is adopted. The local subgraph of the business process graph is reconstructed and the mapping relationship between business nodes and page elements is rebound. The sub-vectors and positioning logic of each dimension of the affected elements are fully updated, and the update results are propagated to each element and graph node within the affected range of the heterogeneous relationship graph.
7. The UI script layered self-healing method as described in claim 1, characterized in that, The step of locating the target element based on the pre-repair result includes: For page elements that fail to locate in the current test script, retrieve the locator from each pre-fix result and attempt to relocate them. When the location is not matched, the pre-candidate fingerprint cache in each pre-repair result is used for matching; If no match is found, obtain the baseline four-dimensional element fingerprint of the page element, and match the baseline four-dimensional element fingerprint with the real-time four-dimensional element fingerprint of each page element in the current UI page to obtain the candidate element set and the matching confidence of each candidate element. When the maximum matching confidence of each candidate element is less than the preset global positioning success confidence threshold, the runtime positioning is determined to have failed. When the maximum matching confidence is greater than or equal to the preset global positioning success confidence threshold, the candidate element corresponding to the maximum matching confidence is confirmed as the target element, and the runtime positioning is determined to be successful.
8. The UI script layered self-healing method as described in claim 7, characterized in that, The failure determination results obtained from the execution dimension-level root cause attribution include: When runtime location fails, the candidate element with the highest matching confidence in the candidate element set is determined as the candidate element to be verified. The current features of the candidate element to be verified are compared with the baseline four-dimensional element fingerprint of the page element to construct a four-dimensional deviation vector; Using the four dimensions corresponding to the four-dimensional deviation vector as dimension nodes, directed edges are constructed according to the preset causal relationship between dimensions, and edge weights representing the deviation transmission amount are assigned to each directed edge to obtain a causal directed graph between dimensions; For each dominant dimension and its corresponding subordinate dimension in the causal directed graph between dimensions, when the deviation of the dominant dimension is greater than the high deviation threshold, there exists a directed edge from the dominant dimension to the subordinate dimension, and the ratio between the deviation of the subordinate dimension and the deviation of the dominant dimension is less than the cascading threshold, the failure determination result is determined to be a cascading failure. When the deviations of more than a preset number of dominant dimensions are all greater than the high deviation threshold, and there are no directed edges between the dimensions that have deviations, or the ratios corresponding to each dominant dimension are greater than or equal to the cascading threshold, the failure determination result is determined to be an independent failure.
9. The UI script layered self-healing method as described in claim 8, characterized in that, The repair, based on the principle of minimum scope, is performed according to the failure determination result, and the repair results include: When the failure determination result is the cascade failure, the dominant dimension is repaired, and the deviation of the subordinate dimension is recalculated after the repair is completed; If the recalculated deviation is less than the residual deviation threshold, the dependent dimension will no longer be repaired; if the recalculated deviation is greater than or equal to the residual deviation threshold, the dependent dimension will continue to be repaired. When the failure determination result is the independent failure, the changed dimensions are repaired in descending order of deviation; After each round of repair is completed, matching is re-executed based on the updated four-dimensional element fingerprint. When the maximum matching confidence is greater than or equal to the preset global positioning success confidence threshold and the deviation of each dimension is lower than the repair completion threshold, the corresponding candidate element is confirmed as the target element, and the positioning information of the page element is updated to obtain the repair result.
10. The UI script layered self-healing method as described in claim 6, characterized in that, The process of propagating the repair results and performing a global validation of the dependent scripts after propagation to obtain the self-healed UI script includes: The repaired target element is used as the root node for propagation, and breadth-first propagation is performed along the edges of the heterogeneous graph. Each time an edge is traversed, the propagation intensity is attenuated using the corresponding attenuation coefficient, and the corresponding propagation path is truncated when the propagation intensity is less than the propagation termination threshold. Only the elements corresponding to the propagation paths with propagation intensity greater than or equal to the propagation termination threshold are propagated. After the propagation is completed, starting from the business operation node corresponding to the repaired target element, all reachable nodes are traversed in reverse along the incoming edges of the business process graph, and all associated test scripts on the traversal path are collected. Obtain the business centrality score of each element corresponding to each associated test script in the business process graph; The corresponding elements are pre-verified for location based on the business centrality scores from high to low to obtain the pre-verification results; wherein, the location pre-verification only performs location matching calculations and does not fully execute the test script; Perform self-healing processing on the corresponding elements based on the pre-verification results; Integrate all the elements after self-healing to obtain the UI script.
