Logic ring management system and method for automated test tasks
By constructing a task logic loop and dynamically adjusting strategies, the issues of flexibility and exception handling in automated test task management are resolved, improving test efficiency and completion rate, and avoiding task blocking and deadlock.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-03
AI Technical Summary
Existing automated test task management methods are inadequate in terms of flexibility, exception handling, and task blocking, making them unable to adapt to diverse testing needs in complex scenarios and lacking a rapid response mechanism, resulting in low testing efficiency.
A task logic loop is constructed using a task executor module, an anomaly monitoring and capture module, a result analysis module, and a strategy adjustment module. The node dependencies are presented through a directed graph, anomalies are monitored in real time, and dynamic strategy adjustments are made. The execution strategy is optimized by combining machine learning models.
It enables flexible adaptation to testing requirements in complex scenarios, reduces task blocking and process deadlock, improves test completion rate, and supports rapid recovery and exception handling without manual intervention.
Smart Images

Figure CN121785936A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a logic loop management system and method for automated test tasks. Background Technology
[0002] With the continuous development of intelligent software systems, their functional complexity is constantly increasing, and the scope of functions they cover is becoming wider and wider. This places more comprehensive requirements on automated testing. Under the development trend of Industry 4.0, various industries have significantly increased their requirements for testing efficiency and consistency, while urgently needing to reduce manual intervention in the testing process to adapt to the rapid iteration pace of product development. As a key link in ensuring the stability and reliability of intelligent software systems, the execution effect of automated testing directly affects the product delivery quality and cycle time.
[0003] Existing technologies for automated test task management have the following drawbacks: Insufficient task execution flexibility: Existing automated test scripts are mostly bound to fixed test steps or test case order, and cannot dynamically adjust the execution logic according to the actual situation in the test process. They lack the ability to adapt to diverse test requirements in complex scenarios and are not flexible enough. Frequent task blocking and deadlock: Due to the strong dependencies between test tasks, when the execution conditions of a certain test case are not met or an exception occurs, subsequent test operations may not be able to proceed according to the predetermined steps, causing problems such as execution disorder, task blocking or even process deadlock. Weak anomaly handling mechanism: Existing technologies lack a sound anomaly monitoring and rapid response mechanism. When faced with situations such as interface timeouts, log anomalies, and node execution failures during testing, it is impossible to capture anomaly information in a timely manner and handle them effectively, leading to test interruptions and reducing test completion rate. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of existing technologies by proposing a method for managing the logic loop of automated test tasks.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: An automated test task logic loop management system is used, the system including a task executor module, an anomaly monitoring and capture module, a result analysis module, and a strategy adjustment module; The task executor module is used to import test cases and construct a task logic loop; The anomaly monitoring and capture module is used to receive the execution status of the task executor module in real time, monitor and capture anomalies during task execution, and send the anomaly information to the result analysis module. The result analysis module is used to receive the task status report from the task executor module and the abnormal information from the abnormal monitoring and capture module, analyze the test results and output the evaluation results. The strategy adjustment module optimizes and dynamically adjusts the test strategy based on the output of the result analysis module. This invention also proposes a method for managing the logic loop of automated test tasks, comprising the following sub-steps: S1: Import test cases and build the task logic loop; S11: Filter test cases that meet the criteria and transfer them to the execution queue; The task executor module imports the completed test cases into the task executor's queue to be executed. The task executor selects the test cases that meet the conditions from the queue to be executed according to the built-in preset execution strategy and transfers the test cases into the execution queue. The execution strategy includes test case filtering rules, including filtering by test case type and filtering by test case priority; S12: Initialize test case information; Each test case in the execution queue is encapsulated as a task node, and a unique identifier (source node ID and target node ID) is assigned to each task node; and each task node is associated with corresponding attributes, including execution status, dependencies, execution result markers, etc. S13: Construct the logical loop; The task executor module creates an empty directed graph data structure using the networkx library, and calls the add_node component to add each task node and its unique identifier to the directed graph. Based on the dependencies of the task nodes, the add_edge component adds directed edges to each task node in the directed graph. The set_entry_point component selects a task node from all task nodes in the directed graph as the starting node, which is the entry point of the logical loop. The logical loop is then constructed. S14: Synchronization periodic message; After each task node is added to the directed graph, a periodic message is generated according to a preset fixed format. The periodic message includes the source node ID, target node ID, execution control bit, source node status bit, running status identifier, etc. of the current task. The task node sends periodic messages to the main thread of the task state machine according to a preset period. S15: The task state machine dynamically manages task nodes in real time; The task state machine receives and traverses the periodic messages of all task nodes, extracts information such as the execution control bits of the task nodes, activates the execution task nodes in sequence based on the directed graph and backtracks to check the corresponding predecessor nodes, synchronizes the execution status of the task nodes in real time, and updates the attributes of the corresponding task nodes in the directed graph. S2: Anomaly Detection and Capture; The anomaly monitoring and capture module obtains the periodic messages and execution status of the task nodes of the task executor module in real time through the API interface, and captures anomaly information according to preset rules. S21: Interface dwell time monitoring; Specifically, when executing each task node, the anomaly monitoring and capture module starts a timer to record the duration of each task node on the corresponding interface. If the duration of the duration exceeds the preset duration, the anomaly monitoring and capture module sends a retry instruction to the task executor module and records the number of retries. When the number of retries reaches the set threshold and the interface operation completion signal is still not received, it is marked as an interface interaction anomaly, and the corresponding timeout duration, number of retries, and unique identifier of the task node are recorded. If a signal indicating completion of the interface operation is received from the task executor module during the timing process, it is determined that there is no abnormality in the interface interaction, the timer is reset, and the next interface monitoring is performed. S22: Log exception capture; The anomaly monitoring and capture module listens to the logs generated during task execution in real time, scans the logs in real time, and matches them with entries in the preset anomaly log keyword library. If there are entries in the logs that match the anomaly log keyword library, the information in the logs is parsed using regular expressions, including the time of the anomaly, the log level, the anomaly type, etc. The parsed information is structured and stored and associated with the unique identifier of the task node to obtain the anomaly log file. S23: Detection of abnormal task node execution; The anomaly monitoring and capture module counts the number of timeout retry failures for each task node. When the number of timeout retry failures exceeds a preset threshold, it is determined that the task node is executing abnormally and is captured. The anomaly monitoring and capture module organizes all captured anomaly information into a unified format and sends it to the result analysis module.
[0006] S3: Test result feedback values are obtained based on multi-dimensional indicators; The results analysis module associates the execution status of the task nodes synchronized by the task executor, the exception information reported by the exception monitoring and capture module, and the unique identifier and timestamp of the corresponding task node to obtain a structured dataset. The structured dataset contains the unique identifier and timestamp of the task node, the number of timeout retries that failed, the total number of timeout retries of the task node, and the total number of entries in the log that match the exception log keyword library. The results analysis module performs multi-dimensional metric calculations on the task nodes in the structured dataset. These metrics include Mean Time To Failure (MTTF), task node timeout retry failure rate, number of log exceptions, and task node execution success rate. The results analysis module standardizes the various multi-dimensional indicators and performs a weighted sum based on the preset weights of each multi-dimensional indicator to obtain the test result feedback value. The test result feedback value and multi-dimensional data are then synchronized to the strategy adjustment module.
[0007] S4: Dynamically adjust execution tasks; The strategy adjustment module performs data cleaning and standardization on test result feedback values and multi-dimensional data, and selects data related to task execution as features to save the feature dataset. The features in the feature dataset are input into a pre-trained machine learning model, such as random forest or XGBoost. The machine learning model predicts the prediction results of each task node corresponding to the features. The prediction results include failure risk probability, execution efficiency, etc. The strategy adjustment module divides the prediction results into corresponding risk levels and efficiency levels based on preset thresholds for each risk level and efficiency level, thus forming the risk assessment results. Based on the risk assessment results and the preset optimization objectives, corresponding adjustment strategies are generated; The strategy adjustment module converts the adjustment strategy into a corresponding adjustment instruction and sends it to the task executor module. The adjustment instruction includes information such as the target node ID and execution control bit. The task executor executes the adjustment instructions and reports the adjusted task status. The result analysis module continuously monitors the adjustment effect. If the expected goal is not achieved after the adjustment, the strategy adjustment module generates an optimization strategy again based on the new feedback value.
[0008] Compared with the prior art, the beneficial effects of the present invention are as follows: This method constructs a task logic loop, supports filtering test cases by type, priority and other rules, encapsulates test cases as independent task nodes and dynamically associates dependencies, and combines the strategy adjustment module to optimize execution priority, switch alternative test cases or adjust parameters in real time. It does not require binding to fixed steps and can flexibly adapt to the diverse testing needs in complex scenarios. It clearly presents node dependencies using a directed graph, activates incomplete preceding nodes through the backtracking mechanism of the task state machine to avoid "dead ends," and can suspend or skip high-risk tasks, isolate abnormal nodes, and prevent the spread of single task failures. It also supports execution state storage and restart recovery, completely reducing task blocking and process deadlock issues. A multi-dimensional anomaly monitoring system is built to comprehensively capture issues such as interface timeouts, log anomalies, and node execution failures. By storing anomaly information in a structured manner and associating it with a unique node identifier, accurate location can be achieved. Combined with the result analysis and strategy adjustment module, closed-loop processing actions such as retries and parameter optimization are triggered, allowing for rapid test recovery without manual intervention and significantly improving the test completion rate. Attached Figure Description
[0009] Figure 1 This is a flowchart illustrating the steps of the method for managing the logical loop of automated test tasks according to the present invention. Detailed Implementation
[0010] To provide a further understanding of the purpose, structure, features, and functions of the present invention, detailed descriptions are provided below with reference to specific embodiments.
[0011] like Figure 1 Furthermore, the present invention also proposes a method for managing the logic loop of automated test tasks, comprising the following sub-steps: S1: Import test cases and build the task logic loop; S11: Filter test cases that meet the criteria and transfer them to the execution queue; The task executor module imports the completed test cases into the task executor's queue to be executed. The task executor selects the test cases that meet the conditions from the queue to be executed according to the built-in preset execution strategy and transfers the test cases into the execution queue. The execution strategy includes test case filtering rules, including filtering by test case type and filtering by test case priority; S12: Initialize test case information; Each test case in the execution queue is encapsulated as a task node, and a unique identifier (source node ID and target node ID) is assigned to each task node; and each task node is associated with corresponding attributes, including execution status, dependencies, execution result markers, etc. S13: Construct the logical loop; The task executor module creates an empty directed graph data structure using the networkx library, calls the add_node component to add each task node and its unique identifier to the directed graph; based on the dependencies of the task nodes, it adds directed edges to each task node in the directed graph using the add_edge component, and selects a task node from all task nodes in the directed graph as the starting node using the set_entry_point component. The starting node is the entry point of the logical loop, and the logical loop is now constructed. S14: Synchronization periodic message; After each task node is added to the directed graph, a periodic message is generated according to a preset fixed format. The periodic message includes the source node ID, target node ID, execution control bit, source node status bit, running status identifier, etc. of the current task. The task node sends periodic messages to the main thread of the task state machine according to a preset period. S15: The task state machine dynamically manages task nodes in real time; The task state machine receives and traverses the periodic messages of all task nodes, extracts information such as the execution control bits of the task nodes, executes the task nodes, and updates the attributes of the corresponding task nodes in the directed graph. Specifically, the task state machine calls the execute_next method to start execution from the starting node. If the execution flag of the starting node is False, that is, the starting node has not been executed, the state machine sends an activation instruction through the execution control bit of the message to trigger the execution of the starting node. After execution, the execution flag of the node is True. After the starting node completes execution, the task state machine uses the graph.successors component to traverse all successor nodes of the current task node in the directed graph, selects the unexecuted task node as the next execution node, and sends an activation command through the execution control bit of the periodic message to trigger the execution of the node; if the current task node has no unexecuted successor nodes, the state machine calls the graph.predecessors component to backtrack to the previous nodes of the current task node in the directed graph and checks whether there are any previous nodes that have not been fully executed. During execution, each task node continuously sends periodic messages to the task state machine at a preset interval to update its own execution status (running, suspended, waiting, stopped) in real time. After receiving the messages, the task state machine synchronously updates the attributes of the corresponding node in the directed graph and stores the execution status through the to_json method to ensure that the execution status can be restored after an abnormal restart.
[0012] When a reset command is received from the strategy adjustment module or the test process needs to be restarted, the state machine calls the reset method to reset the execution flag of all task nodes to false, clear the current execution node record, and reselect the starting node through the set_entry_point component.
[0013] S2: Anomaly Detection and Capture; The anomaly monitoring and capture module obtains the periodic messages and execution status of the task nodes of the task executor module in real time through the API interface, and captures anomaly information according to preset rules. S21: Interface dwell time monitoring; Specifically, when executing each task node, the anomaly monitoring and capture module starts a timer to record the duration of each task node on the corresponding interface. If the duration of the duration exceeds the preset duration, the anomaly monitoring and capture module sends a retry instruction to the task executor module and records the number of retries. When the number of retries reaches the set threshold and the interface operation completion signal is still not received, it is marked as an interface interaction anomaly, and the corresponding timeout duration, number of retries, and unique identifier of the task node are recorded. If a signal indicating completion of the interface operation is received from the task executor module during the timing process, it is determined that there is no abnormality in the interface interaction, the timer is reset, and the next interface monitoring is performed. Furthermore, interface image data is collected by a test bench camera and compared with a preset standard image to identify and record the differences between the two. S22: Log exception capture; The anomaly monitoring and capture module listens to the logs generated during task execution in real time, scans the logs in real time, and matches them with entries in the preset anomaly log keyword library. If there are entries in the logs that match the anomaly log keyword library, the information in the logs is parsed using regular expressions, including the time of the anomaly, the log level, the anomaly type, etc. The parsed information is structured and stored and associated with the unique identifier of the task node to obtain the anomaly log file. S23: Detection of abnormal task node execution; The anomaly monitoring and capture module counts the number of timeout retry failures for each task node. When the number of timeout retry failures exceeds a preset threshold, it is determined that the task node is executing abnormally and is captured. The anomaly monitoring and capture module organizes all captured anomaly information into a unified format and sends it to the result analysis module.
[0014] S3: Test result feedback values are obtained based on multi-dimensional indicators; The results analysis module associates the execution status of the task nodes synchronized by the task executor, the exception information reported by the exception monitoring and capture module, and the unique identifier and timestamp of the corresponding task node to obtain a structured dataset. The structured dataset contains the unique identifier and timestamp of the task node, the number of timeout retries that failed, the total number of timeout retries of the task node, and the total number of entries in the log that match the exception log keyword library. The results analysis module performs multi-dimensional metric calculations on the task nodes in the structured dataset. These metrics include Mean Time To Failure (MTTF), task node timeout retry failure rate, number of log exceptions, and task node execution success rate. Specifically, Mean Time To Failure (MTTF): The results analysis module extracts fault-free periods from the structured dataset in timestamp order and calculates the arithmetic mean of all fault-free periods, i.e., the Mean Time To Failure (MTTF). Task node timeout retry failure rate: (Number of failed timeout retries for the task node / Total number of timeout retries for the task node) * 100%; Log exception count: The total number of entries in the log that match the exception log keyword library; Task node execution success rate: (Number of task nodes with a successful execution status / Total number of task nodes) * 100%; The results analysis module standardizes the various multi-dimensional indicators and performs a weighted sum based on the preset weights of each multi-dimensional indicator to obtain the test result feedback value. The test result feedback value and multi-dimensional data are then synchronized to the strategy adjustment module.
[0015] S4: Dynamically adjust execution tasks; The strategy adjustment module performs data cleaning and standardization on test result feedback values and multi-dimensional data, and selects data related to task execution as features to save the feature dataset. The features in the feature dataset are input into a pre-trained machine learning model, such as random forest or XGBoost. The machine learning model predicts the prediction results of each task node corresponding to the features. The prediction results include failure risk probability, execution efficiency, etc. The strategy adjustment module divides the prediction results into corresponding risk levels and efficiency levels based on preset thresholds for various risk levels (such as high risk, medium risk, and low risk) and efficiency levels (such as inefficient, medium, and efficient), thus forming the risk assessment results. Based on the risk assessment results and the preset optimization objectives, corresponding adjustment strategies are generated; Specifically, task priority optimization: increase the execution priority of low-risk, high-efficiency tasks and allocate computing resources to them first; Task node status adjustment: For high-risk tasks: send a suspend or stop command to prevent their execution from causing subsequent tasks to be blocked due to abnormalities; if the task is a non-critical path task, it can be skipped and recorded for separate handling later. For inefficient tasks: If there are alternative test cases, switch to the alternative task node; if there are no alternative test cases, adjust its execution parameters (such as extending the timeout threshold and optimizing dependencies). The strategy adjustment module converts the adjustment strategy into a corresponding adjustment instruction and sends it to the task executor module. The adjustment instruction includes information such as the target node ID and execution control bit. The task executor executes the adjustment instructions and reports the adjusted task status. The result analysis module continuously monitors the adjustment effect (such as whether the error rate has decreased or whether the execution efficiency has improved). If the adjustment does not achieve the expected goal, the strategy adjustment module generates an optimization strategy again based on the new feedback value.
[0016] The present invention has been described in the above-described embodiments; however, these embodiments are merely examples for implementing the present invention. It must be noted that the disclosed embodiments do not limit the scope of the present invention. Conversely, any modifications and refinements made without departing from the spirit and scope of the present invention are within the scope of patent protection of the present invention.
Claims
1. A method for managing the logic loop of automated test tasks, characterized in that: Includes the following steps: S1: Import test cases and build the task logic loop; S11: Filter test cases that meet the criteria and transfer them to the execution queue; S12: Initialize test case information; S13: Construct the logical loop; S14: Synchronization periodic message; S15: The task state machine dynamically manages task nodes in real time; S2: Anomaly Detection and Capture; The anomaly monitoring and capture module obtains the periodic messages and execution status of the task nodes of the task executor module in real time through the API interface, and captures anomaly information. S3: Test result feedback values are obtained based on multi-dimensional indicators; The results analysis module associates the execution status of the task nodes synchronized by the task executor, the abnormal information reported by the abnormal monitoring and capture module, with the unique identifier and timestamp of the corresponding task node to obtain a structured dataset. Calculate multi-dimensional indicators based on structured datasets and obtain test result feedback values; S4: Dynamically adjust execution tasks; The strategy adjustment module performs data cleaning and standardization on test result feedback values and multi-dimensional data, and selects data related to task execution as features to save the feature dataset. The features in the feature dataset are input into the pre-trained machine learning model, which outputs risk assessment results and generates corresponding adjustment strategies.
2. The method for managing the logic loop of automated test tasks as described in claim 1, characterized in that: The specific details of step S1 are as follows: S11: Filter test cases that meet the criteria and transfer them to the execution queue; The task executor module imports the completed test cases into the task executor's queue to be executed. The task executor selects the test cases that meet the conditions from the queue to be executed according to the built-in preset execution strategy and transfers the test cases into the execution queue. S12: Initialize test case information; Each test case in the execution queue is encapsulated as a task node, and a unique identifier is assigned to each task node. And associate each task node with corresponding attributes; S13: Construct the logical loop; The task executor module creates an empty directed graph data structure, adds each task node and its unique identifier to the directed graph; according to the dependencies of the task nodes, it adds directed edges to each task node in the directed graph, selects a task node from all task nodes in the directed graph as the starting node, and the starting node is the entry point of the logical loop, thus completing the construction of the logical loop. S14: Synchronization periodic message; After each task node is added to the directed graph, a periodic message is generated according to a preset fixed format. The task node sends the periodic message to the task state machine main thread according to the preset period. S15: The task state machine dynamically manages task nodes in real time; The task state machine receives and traverses the periodic messages of all task nodes, extracts the execution control bit information of the task nodes, activates the execution task nodes in sequence based on the directed graph, backtracks to check the corresponding predecessor nodes, synchronizes the execution status of the task nodes in real time, and updates the attributes of the corresponding task nodes in the directed graph.
3. The method for managing the logic loop of automated test tasks as described in claim 1, characterized in that: The specific details of step S2 are as follows: S21: Interface dwell time monitoring; When executing each task node, the anomaly monitoring and capture module starts a timer to record the duration of each task node on the corresponding interface. If the duration of the duration exceeds the preset duration, the anomaly monitoring and capture module sends a retry instruction to the task executor module and records the number of retries. When the number of retries reaches the set threshold and the interface operation completion signal is still not received, it is marked as an interface interaction anomaly, and the corresponding timeout duration, number of retries, and unique identifier of the task node are recorded. If a signal indicating completion of the interface operation is received from the task executor module during the timing process, it is determined that there is no abnormality in the interface interaction, the timer is reset, and the next interface monitoring is performed. S22: Log exception capture; The anomaly monitoring and capture module listens to the logs generated during task execution in real time, scans the logs in real time, and matches them with entries in the preset anomaly log keyword library. If there are entries in the logs that match the anomaly log keyword library, the information in the logs is parsed using regular expressions, the parsed information is structured and stored and associated with the unique identifier of the task node to obtain an anomaly log file. S23: Detection of abnormal task node execution; The anomaly monitoring and capture module counts the number of timeout retry failures for each task node. When the number of timeout retry failures exceeds a preset threshold, it is determined that the task node is executing abnormally and is captured. The anomaly monitoring and capture module organizes all captured anomaly information into a unified format and sends it to the result analysis module.
4. The method for managing the logic loop of automated test tasks as described in claim 1, characterized in that: The specific details of step S3 are as follows: The results analysis module associates the execution status of the task nodes synchronized by the task executor, the abnormal information reported by the abnormal monitoring and capture module, with the unique identifier and timestamp of the corresponding task node to obtain a structured dataset. The results analysis module calculates multi-dimensional indicators for task nodes in the structured dataset. It standardizes each multi-dimensional indicator and performs a weighted sum based on the preset weights of each multi-dimensional indicator to obtain the test result feedback value. The test result feedback value and multi-dimensional data are then synchronized to the strategy adjustment module.
5. The method for managing the logic loop of automated test tasks as described in claim 1, characterized in that: The specific details of step S4 are as follows: The strategy adjustment module performs data cleaning and standardization on test result feedback values and multi-dimensional data, and selects data related to task execution as features to save the feature dataset. The features in the feature dataset are input into the pre-trained machine learning model, and the machine learning model predicts the prediction results of each task node corresponding to the features. The strategy adjustment module divides the prediction results into corresponding risk levels and efficiency levels based on preset thresholds for each risk level and efficiency level, thus forming the risk assessment results. Based on the risk assessment results and the preset optimization objectives, corresponding adjustment strategies are generated; The strategy adjustment module converts the adjustment strategy into corresponding adjustment instructions and sends them to the task executor module; The task executor executes the adjustment instructions and reports the adjusted task status. The result analysis module continuously monitors the adjustment effect. If the expected goal is not achieved after the adjustment, the strategy adjustment module generates an optimization strategy again based on the new feedback value.
6. A logic loop management system for automating test tasks, used to implement the method of any one of claims 1-5, characterized in that: The system includes a task executor module, an anomaly monitoring and capture module, a result analysis module, and a strategy adjustment module; The task executor module is used to import test cases and construct a task logic loop; The anomaly monitoring and capture module is used to receive the execution status of the task executor module in real time, monitor and capture anomalies during task execution, and send the anomaly information to the result analysis module. The result analysis module is used to receive the task status report from the task executor module and the abnormal information from the abnormal monitoring and capture module, analyze the test results and output the evaluation results. The strategy adjustment module optimizes and dynamically adjusts the testing strategy based on the output of the result analysis module.