UI test script visual arrangement method and system based on reinforcement learning

Through the reinforcement learning-based visual orchestration method of UI test scripts, the problem of existing UI testing technology relying on manual experience is solved, efficient and low-cost UI automated testing is achieved, and robust test scripts with clear business intent are generated.

CN120670322AActive Publication Date: 2025-09-19深圳市名通科技股份有限公司
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511165533.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-20
Publication Date
2025-09-19
Estimated Expiration
2045-08-20

AI Technical Summary

Technical Problem

Existing UI testing technologies rely on the experience of testers, resulting in redundant and suboptimal test scripts, high maintenance costs, and test fragility.

Method used

A reinforcement learning-based visual orchestration method for UI test scripts is adopted. The user constructs the initial test path through a preset visual orchestration interface, and the reinforcement learning algorithm is used to optimize the path to generate a robust UI test script.

Benefits of technology

It improves testing efficiency, reduces redundancy and non-optimal paths in test scripts, reduces maintenance costs, and ensures the robustness of test scripts and the clarity of business intent.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120670322A_ABST
    Figure CN120670322A_ABST
Patent Text Reader

Abstract

The invention discloses a UI test script visual arrangement method and system based on reinforcement learning, and relates to the technical field of user interface test.The UI test script visual arrangement method based on reinforcement learning comprises the steps that an initial test path constructed by a user is received through a preset first visual arrangement interface; performing path optimization on the initial test path to obtain an optimized test path; and displaying comparison information of the optimized test path and the initial test path on a preset second visual arrangement interface, and generating a UI test script in response to a user interaction operation received on the second visual arrangement interface. According to the method, the UI automatic test which has a clear business intention and is robust to execute can be efficiently created and maintained at low cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of user interface testing technology, and in particular to a method and system for visually arranging UI test scripts based on reinforcement learning. Background Art

[0002] UI (User Interface) testing is an indispensable part of the modern software development life cycle, aiming to improve test efficiency, coverage and product quality.

[0003] Currently, UI testing is generally completed by testers writing scripts. However, this method relies heavily on the testers' testing experience. The scripts often contain redundant steps, suboptimal navigation, and unnecessary waiting, reflecting the testers' exploration process rather than the optimal path required to verify specific functions. In addition, there are problems such as high workload for testers and long project testing cycles.

[0004] In summary, how to efficiently and cost-effectively create and maintain UI automated tests with clear business intent and robust execution has become a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0005] The main purpose of this application is to provide a method and system for visually arranging UI test scripts based on reinforcement learning, aiming to efficiently and cost-effectively create and maintain UI automated tests with clear business intent and robust execution.

[0006] To achieve the above objectives, this application proposes a method for visually arranging UI test scripts based on reinforcement learning. The method for visually arranging UI test scripts based on reinforcement learning includes: Receiving an initial test path constructed by a user through a preset first visual arrangement interface; Performing path optimization on the initial test path to obtain an optimized test path; The comparison information between the optimized test path and the initial test path is displayed on a preset second visual choreography interface, and a UI test script is generated in response to a user interaction operation received on the second visual choreography interface.

[0007] In one embodiment, before the step of performing path optimization on the initial test path to obtain an optimized test path, the method further includes: Obtaining an initial deep Q network, wherein a state space of the initial deep Q network is configured to store an environment state when executing a test step in a preset application environment under test, and an action space of the initial deep Q network is configured to store various test path optimization operations; Acquire a training sample, wherein the training sample includes multiple groups of training and testing paths; The initial deep Q network is trained based on the training samples to obtain a trained deep Q network, and the deep Q network is used to perform path optimization on the initial test path.

[0008] In one embodiment, the step of training the initial deep Q network based on the training samples to obtain a trained deep Q network includes: For each of the training test paths in the training sample, interact with the tested application environment according to the training test path, and obtain each experience tuple in the interaction process according to a preset reinforcement learning strategy, wherein the experience tuple includes the current state at each moment, the executed action, the state at the next moment, and the compound reward; Calculating the priority of each of the experience tuples, and storing each of the experience tuples and the corresponding priority into a preset experience replay pool; Based on the priority replay mechanism, a sampled experience tuple is selected from the experience replay pool to perform iterative network training on the initial deep Q network to obtain a trained deep Q network.

[0009] In one embodiment, the step of performing path optimization on the initial test path to obtain an optimized test path includes: Determining state information of each test step in the initial test path according to an environment state when the initial test path is executed in a preset application environment under test; For each of the test steps, analyzing the state information of the test step through a deep Q network to determine the optimal action after the test step; The initial test path is iteratively updated according to each of the optimal actions to obtain an optimized test path.

[0010] In one embodiment, the step of determining the status information of each test step in the initial test path according to the environment state when the initial test path is executed in a preset application environment under test includes: For each test step when the initial test path is executed in the preset application environment under test, extracting a visual state from a current user interface screenshot when each test step is executed; Performing vector representation on the document object model or view hierarchy of the current user interface when each of the test steps is executed to obtain a structural state; Obtaining a path state according to position information of each test step in the initial test path; Extracting the embedded representation of the preceding action of each test step to obtain a historical action state; Extract the state-action pair of each test step to obtain the tail sequence state.

[0011] In one embodiment, the deep Q network includes a convolutional neural network branch, a multi-layer perceptron branch, a long short-term memory network branch, and a fully connected layer; The step of analyzing the state information of each test step by a deep Q network to determine the optimal action after the test step includes: For each of the test steps, the visual state corresponding to the test step is used as the input of the convolutional neural network branch, the structural state and path state corresponding to the test step are used as the input of the multi-layer perceptron branch, and the historical action state and tail sequence state corresponding to the test step are used as the input of the long short-term memory network branch; splicing the outputs of the convolutional neural network branch, the multi-layer perceptron branch, and the long short-term memory network branch to obtain a fused feature vector; The fused feature vector is input into the fully connected layer to obtain the optimal action after the test step output by the fully connected layer.

[0012] In one embodiment, the first visual orchestration interface includes a natural language instruction block, and the step of receiving the initial test path constructed by the user through the preset first visual orchestration interface includes: In response to the user's dragging operation and parameter configuration operation on the natural language instruction block in the first visual arrangement interface, an initial test path is generated.

[0013] In one embodiment, the step of displaying comparison information between the optimized test path and the initial test path on a preset second visual orchestration interface, and generating a UI test script in response to a user interaction operation received on the second visual orchestration interface, includes: In a preset second visual arrangement interface, differentiating the optimized test path from the initial test path by using different colors or different styles; Visually graying out the optimized steps in the initial test path, and displaying optimization reasons in response to the first user interaction operation; modifying the optimized test path and / or the initial test path in response to a second user operation to generate a target test path; Generate a UI test script based on the target test path.

[0014] In addition, to achieve the above objectives, this application also proposes a UI test script visual orchestration system based on reinforcement learning. The UI test script visual orchestration system based on reinforcement learning includes: A visual arrangement module, configured to receive an initial test path constructed by a user through a preset first visual arrangement interface; A reinforcement learning optimization engine is used to perform path optimization on the initial test path to obtain an optimized test path; The visual orchestration module is further configured to display comparison information between the optimized test path and the initial test path on a preset second visual orchestration interface, and generate a UI test script in response to a user interaction operation received on the second visual orchestration interface.

[0015] In one embodiment, the reinforcement learning optimization engine includes: a state determination unit, configured to determine state information of each test step in the initial test path according to an environment state when the initial test path is executed in a preset application environment under test; an action determination unit, configured to analyze, for each of the test steps, state information of the test step using a deep Q network, and determine an optimal action after the test step; The path optimization unit is used to iteratively update the initial test path according to each of the optimal actions to obtain an optimized test path.

[0016] This application proposes a UI test script visual orchestration method based on reinforcement learning. This application receives an initial test path constructed by a user through a preset first visual orchestration interface; optimizes the initial test path to obtain an optimized test path; displays comparison information between the optimized test path and the initial test path on a preset second visual orchestration interface, and generates a UI test script in response to user interaction operations received on the second visual orchestration interface.

[0017] In summary, this application reduces the reliance on testers’ programming skills and script writing experience with the help of the first visual orchestration interface, allowing testers to intuitively construct the initial test path; automatically optimizes the initial test path using a reinforcement learning algorithm to remove redundant steps in the path, optimize navigation, and reduce unnecessary waiting, generating an optimized test path for verifying specific functions to improve test efficiency; finally, with the help of the second visual orchestration interface, the initial test path and the optimized test path are intuitively compared and displayed, allowing users to clearly understand the effect of the path optimization. At the same time, the final UI test script can be generated based on the user’s confirmation or further adjustment of the instructions. As a result, this application can efficiently and cost-effectively create and maintain UI automated tests with clear business intent and robust execution. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0020] Figure 1 A flowchart illustrating the first embodiment of the method for visually arranging UI test scripts based on reinforcement learning in this application; Figure 2 This is a schematic diagram of an example scenario flow for the first embodiment of the method for visually arranging UI test scripts based on reinforcement learning in this application; Figure 3 A flowchart of the second embodiment of the method for visually arranging UI test scripts based on reinforcement learning is provided in this application; Figure 4 This is a flowchart of the third embodiment of the method for visually arranging UI test scripts based on reinforcement learning in this application; Figure 5 This is a schematic diagram of the module structure of the UI test script visual orchestration system based on reinforcement learning in an embodiment of the present application.

[0021] The purpose, features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0022] It should be understood that the specific embodiments described herein are merely used to explain the technical solutions of the present application and are not intended to limit the present application.

[0023] Currently, UI testing is generally completed by testers writing scripts. However, this method relies heavily on the testers' testing experience. The scripts often contain redundant steps, suboptimal navigation, and unnecessary waiting, reflecting the testers' exploration process rather than the optimal path required to verify specific functions. In addition, there are problems such as high workload for testers and long project testing cycles.

[0024] In addition, it is worth mentioning that although some other UI testing solutions have been proposed, such as record and playback: by recording the user's operation sequence on the interface and automatically generating repeatable scripts to quickly create simple test cases; no-code / low-code platform: by providing a graphical user interface, allowing users to drag and drop preset instruction blocks or use natural language to orchestrate the test process without writing code, so that non-technical personnel can also participate in automated testing; AI-based autonomous test generation: using AI (Artificial Intelligence) algorithms to allow the intelligent agent to autonomously explore the application under test and generate test cases, guiding the intelligent agent to learn strategies to discover defects or meet specific test goals; visual testing: focusing on verifying whether the visual presentation of the UI is correct, by capturing application screenshots and using computer vision and AI technology to perform pixel-level comparisons with pre-approved baseline images to detect unexpected changes in layout, color, font, etc.

[0025] However, they each have significant shortcomings, which together constitute a series of technical problems that need to be solved urgently: High maintenance costs and test fragility are common. Manually written and recorded / replayed scripts are extremely fragile. They rely heavily on the UI's DOM (Document Object Model) structure and element locators. Any minor interface change can invalidate a large number of test cases. This leads to enormous maintenance costs, often offsetting the benefits of automation and is recognized as a major pain point in the industry.

[0026] Inherent inefficiencies in test paths: Whether manually written, recorded and played back, or orchestrated via codeless platforms, test paths are essentially direct replicas of human operational logic. These paths often contain redundant steps, suboptimal navigation, and unnecessary waits, reflecting the tester's exploration process rather than the optimal path required to verify specific functionality. Existing tools generally lack the ability to globally optimize the logic of created paths.

[0027] Limitations of no-code / low-code platforms: While these platforms simplify test creation, they don't address the issue of test path efficiency. Inefficient user-orchestrated paths are simply executed. The "self-healing" capabilities they provide are merely passive, partial locator fixes, failing to fundamentally optimize the logic of the test process.

[0028] Challenges of AI-powered test generation: Relying solely on AI to generate tests from scratch faces significant challenges. First, reinforcement learning encounters state space explosion when exploring unconstrained UI environments, making it difficult to scale to complex applications. Second, generated test cases often lack clear business intent and interpretability, making them difficult for humans to understand and maintain. Furthermore, code generated based on large language models may also contain "test smells" that violate engineering best practices.

[0029] In summary, how to efficiently and cost-effectively create and maintain UI automated tests with clear business intent and robust execution has become a technical problem that urgently needs to be solved in this field.

[0030] An embodiment of the present application provides a solution that receives an initial test path constructed by a user through a preset first visual orchestration interface; performs path optimization on the initial test path to obtain an optimized test path; displays comparison information between the optimized test path and the initial test path on a preset second visual orchestration interface, and generates a UI test script in response to user interaction operations received on the second visual orchestration interface.

[0031] In summary, the embodiment of the present application reduces the dependence on the tester's programming skills and script writing experience with the help of the first visual arrangement interface, and the tester can intuitively construct the initial test path; the initial test path is automatically optimized using the reinforcement learning algorithm to remove redundant steps in the path, optimize navigation and reduce unnecessary waiting, and generate an optimized test path for verifying specific functions to improve testing efficiency; finally, the initial test path and the optimized test path are intuitively compared and displayed with the help of the second visual arrangement interface, so that the user can clearly understand the effect of the path optimization. At the same time, the final UI test script can be generated based on the user's confirmation or further adjustment of the instructions. Therefore, the present application can efficiently and cost-effectively create and maintain UI automated tests with clear business intent and robust execution.

[0032] It should be noted that the execution subject of this embodiment can be an electronic device with data processing, network communication and program running functions, such as a computer, tablet computer, server, etc., or an electronic device that can realize the above functions.

[0033] Based on this, the embodiment of the present application provides a UI test script visualization arrangement method based on reinforcement learning, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the method for visually arranging UI test scripts based on reinforcement learning in this application.

[0034] In this embodiment, the UI test script visual arrangement method based on reinforcement learning includes steps S10 to S30: Step S10: receiving an initial test path constructed by a user through a preset first visual arrangement interface; It should be noted that the reinforcement learning-based UI test script visual orchestration method in this embodiment can be applied to a reinforcement learning-based UI test script visual orchestration system, which includes a visual orchestration module and a reinforcement learning optimization engine. The visual orchestration module is used to orchestrate, receive, parse, display and manage UI test paths; the reinforcement learning optimization engine is responsible for analyzing UI test paths and making optimization suggestions.

[0035] The visual orchestration module includes a first visual orchestration interface, which is used to interact with the user and receive the initial test path constructed by the user. The initial test path can be rendered in real time as a visual flowchart, thereby transforming the complex test script creation process into an intuitive, easy-to-understand and coding-free visual operation.

[0036] In a feasible embodiment, the first visual arrangement interface includes a natural language instruction block, and step S10 may include step S101: Step S101 : generating an initial test path in response to a user's dragging operation and parameter configuration operation on a natural language instruction block in a first visual arrangement interface.

[0037] It's important to note that in this embodiment, the visual orchestration module provides a library of natural language instructions that encapsulate UI operations. Users don't need to worry about the underlying code implementation; they simply select instructions from the library that match their intent, such as "enter text," "click a button," or "verify element existence." This approach leverages natural language processing (NLP) technology to map human-readable commands to executable test actions, significantly lowering the barrier to entry for test automation and enabling non-technical personnel like product managers and business analysts to participate in test case creation.

[0038] The first visual orchestration interface provides a dynamic, interactive canvas where users can organize and arrange the aforementioned natural language instruction blocks through simple drag-and-drop operations, thereby building a complete test flow. In the first visual orchestration interface, each node represents a specific UI action (for example, "Enter 'AA' in the 'Username' input box") and allows users to configure related parameters. This visualization makes the internal logic of the test script intuitively constructed and understood.

[0039] Step S20, performing path optimization on the initial test path to obtain an optimized test path; The initial test path constructed by the user is optimized through reinforcement learning technology. The optimization direction is to reduce redundant and inefficient steps in the initial test path to obtain an optimized test path, so that the final generated UI test script is faster to execute and occupies less computing resources.

[0040] Step S30 : displaying comparison information between the optimized test path and the initial test path on a preset second visual arrangement interface, and generating a UI test script in response to a user interaction operation received on the second visual arrangement interface.

[0041] A second visual layout interface displays a comparison of the optimized and initial test paths. This approach prioritizes readability and comprehensibility, allowing users to quickly understand the differences. Furthermore, the interface incorporates a comprehensive interactive response mechanism. Upon receiving user-triggered interactions (such as confirming a click or modifying parameters), the interface rapidly invokes internal processing modules to generate UI test scripts according to established algorithms and processes.

[0042] The layout of the second visual arrangement interface may be the same as that of the first visual arrangement interface, which is not specifically limited in this embodiment.

[0043] In a feasible embodiment, step S30 may include steps S301 to S304: Step S301: In a preset second visual layout interface, differentiating the optimized test path and the initial test path by different colors or styles; Step S302: Visually graying out the optimized steps in the initial test path, and displaying the optimization reasons in response to the first user interaction operation; Step S303: modifying the optimized test path and / or the initial test path in response to the second user operation to generate a target test path; Step S304: Generate a UI test script based on the target test path.

[0044] In this embodiment, after the user completes path orchestration and requests optimization, the optimized test path generated by the reinforcement learning engine is displayed as a suggestion on a second visual orchestration interface, alongside or overlaid with the user's original test path. In this interface, the initial and optimized test paths are distinguished by different colors or styles, making the differences clear at a glance. Optimized steps (e.g., redundant waits or unnecessary page jumps) are visually grayed out in the initial test path. When the user hovers over an optimized point, a tooltip appears, explaining the rationale for the optimization in natural language. For example, "This step is redundant because the UI element 'Username Input Box' is already in the target state" or "A faster navigation path has been found that skips three intermediate steps, reducing execution time by an estimated 50%." The user has full decision-making power over which path to ultimately adopt. The second visual orchestration interface provides clear controls, allowing the user to accept the optimized path or retain the original orchestration, ultimately confirming the production UI test script.

[0045] For example, Figure 2 As shown, in the first visual orchestration interface, the user builds a test case by dragging a series of UI operation instructions encapsulated as natural language instruction blocks (for example, "click the 'Login' button"). The orchestration process is rendered in real time as a visual flowchart. When the user completes the orchestration of the test path, the system passes the orchestrated initial test path as input to the reinforcement learning optimization engine. The optimization engine explores the user-defined initial test path in an interactive environment with the application under test (AUT). The engine learns optimization strategies to identify and eliminate redundant steps, merge multiple operations, or replace them with more efficient action sequences, while ensuring that the functional objectives and core coverage of the original test case are not changed.

[0046] All optimization suggestions are presented to users visually, using a secondary visual orchestration interface to display a comparison of the optimized test path and the initial test path. Users can review and accept or reject each suggestion, ensuring ultimate control. The system's final output is a new, optimized UI test script with increased execution efficiency and enhanced maintainability.

[0047] In this way, in the embodiment of the present application, with the help of the first visual arrangement interface, the dependence on the tester's programming skills and script writing experience is reduced, and the tester can intuitively construct the initial test path; the initial test path is automatically optimized using the reinforcement learning algorithm to remove redundant steps in the path, optimize navigation and reduce unnecessary waiting, and generate an optimized test path for verifying specific functions to improve testing efficiency; finally, with the help of the second visual arrangement interface, the initial test path and the optimized test path are intuitively compared and displayed, so that the user can clearly understand the effect of the path optimization. At the same time, the final UI test script can be generated based on the user's confirmation or further adjustment of the instructions. As a result, the present application can efficiently and cost-effectively create and maintain UI automated tests with clear business intent and robust execution.

[0048] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction and will not be described in detail later. Figure 3 As shown, before step S20, steps A10 to A30 may be included: Step A10: obtaining an initial deep Q network, wherein the state space of the initial deep Q network is set to store the environment state when the test steps are executed in the preset tested application environment, and the action space of the initial deep Q network is set to store various test path optimization operations; First, an initial deep Q network is obtained and its key parameters are set. The state space of the initial deep Q network is defined as the environment state presented when executing test steps in a preset tested application environment. This environment state covers various possible situations of the tested application during the test process and provides the network with comprehensive environmental perception information. At the same time, the action space of the initial deep Q network is set to store various test path optimization operations, which are the basic action sets for subsequent optimization and adjustment of the test path.

[0049] It should be noted that in this embodiment, the states in the state space can include visual state, structural state, path state, historical action state, and tail sequence state. Specifically, the visual state (Vt) is a feature vector extracted from the current application screenshot by a convolutional neural network. This approach can capture the visual layout information of the UI without relying on the fragile DOM structure, and is used in advanced visual testing techniques.

[0050] Structural State (Dt): A vectorized representation of the document object model or view hierarchy of the current page, which provides structural context that may be overlooked by purely visual information.

[0051] Path state (Pt): A vector that encodes the current position (t) in the original N-step test path and may contain a look-ahead window for the next k plan steps. This is crucial for the agent to understand the original test intent.

[0052] History Action State (Ht): An embedding representation of the most recent m actions performed by the agent, used to provide temporal context and prevent the agent from falling into a loop.

[0053] Tails: To address the common state confusion problem in UIs (i.e., two visually and structurally identical interfaces that require different actions due to different previous operation histories), state representation can be further enhanced with "tails." A tail is a sequence of the most recent l (state-action) pairs. This provides the agent with richer historical trajectory information, enabling it to distinguish similar states with different contexts.

[0054] The test path optimization operations in the action space may specifically include: Execute_Original_Step: Executes the operation specified in step t of the user-programmed path. This is the default baseline action.

[0055] Skip_Step_As_Redundant: The agent can choose this action if the state analysis indicates that the goal of step t has been achieved (for example, an input box already contains the correct text).

[0056] Propose_Alternative_Action(a'): The agent can select an alternative action a' from a predefined library of common UI interactions if it predicts that the action can more efficiently reach the state at a future step.

[0057] Assert_State_And_Terminate: If the agent determines that the final goal of the test case has been achieved early, it can choose to terminate the test early.

[0058] Step A20: obtaining a training sample, wherein the training sample includes multiple sets of training and testing paths; Obtain training samples, which include multiple sets of training test paths. Each set of training test paths simulates the path conditions that may occur in actual test scenarios, providing the network with rich and diverse learning materials to ensure that the trained network can adapt to various complex test path optimization requirements.

[0059] Step A30: Train the initial deep Q network based on the training samples to obtain a trained deep Q network. The deep Q network is used to optimize the initial test path.

[0060] The initial deep Q network is trained based on the acquired training samples to obtain a trained deep Q network that can be used to perform path optimization on the initial test path.

[0061] In a feasible embodiment, step A30 may include steps A301 to A303: Step A301: For each training-test path in the training sample, interact with the tested application environment according to the training-test path, and obtain each experience tuple during the interaction process according to the preset reinforcement learning strategy. The experience tuple includes the current state, executed action, next state, and compound reward at each moment. For each set of training and test paths in the training sample, the training and test paths are interacted with the pre-set application environment under test. During this interaction, operations are performed according to the pre-set reinforcement learning strategy, resulting in various experience tuples during the interaction. Each experience tuple includes: the current state at each moment, that is, the specific state of the application environment under test at a certain moment; the execution action, that is, the test path optimization operation taken in the current state; the next moment state, that is, the state to which the application environment under test transitions after the execution of the action; and the compound reward, a comprehensive evaluation indicator used to measure the benefits obtained after executing the action. It comprehensively considers multiple factors such as the effectiveness and efficiency of path optimization.

[0062] It is worth mentioning that in this embodiment, the reward function (i.e., the calculation function of the compound reward) can be specifically: R = α • R efficiency +β•R coverage -γ•C deviation -δ•C cost , where the weight coefficients α, β, γ, and δ can be adjusted dynamically to adapt to the focus of different optimization stages, R efficiency represents the efficiency reward, R coverage represents the coverage reward, C deviation Denotes deviation penalty, C cost Represents cost penalty.

[0063] In one possible embodiment, R efficiency The calculation method is 1 / num_steps, where num_steps represents the number of steps, or is proportional to the number of steps saved. The purpose is to reward the agent for completing the task with fewer steps, which is the main driving force of optimization. coverage The calculation method is to give rewards when a key checkpoint is reached, in order to ensure that the optimization process does not sacrifice the core coverage goal of the original test; Cdeviation The calculation method is -1×state_distance_metric, where state_distance_metric represents the state distance metric. Its purpose is to penalize the path that causes the final state to be inconsistent with the original script to ensure the correctness of the optimization. cost It is calculated as -0.01×execution_time_sec, where execution_time_sec represents the execution time. Its purpose is to penalize operations with high computational overhead (such as long waiting times) and encourage streamlined execution.

[0064] In this example, a simple reward function is insufficient for the complex optimization task, and this composite function demonstrates a deep understanding of the various trade-offs in test automation. It demonstrates that the agent pursues not just the "shortest path," but rather a path based on a more nuanced definition of "optimal" that integrates speed, correctness, and cost.

[0065] It's also worth noting that the preset reinforcement learning strategy in this embodiment can be specifically an epsilon-greedy (exploration-exploitation) strategy. During training, "exploration" doesn't involve randomly attempting arbitrary UI actions (such as clicking on irrelevant ads). Instead, it attempts to optimize actions within the step logic of a predefined path. For example, in the "enter quantity on the product page" step, the exploration action might be "skipping input (if the quantity is already correct by default)" or "directly entering the target value (instead of clicking the original '+1' three times)." This "directed exploration" ensures that the agent's trial and error focuses on "improving path efficiency," avoiding the "flood of invalid actions" problem in traditional RL UI testing caused by overly wide exploration scope (such as interrupting the test by clicking on an element outside the path).

[0066] Step A302: Calculate the priority of each experience tuple, and store each experience tuple and its corresponding priority into a preset experience replay pool; Calculate the priority of each experience tuple. The priority calculation method can be set according to specific needs and actual conditions, for example, it can be determined based on factors such as the size of the compound reward and the importance of the state transition. After calculating the priority, each experience tuple and its corresponding priority are stored in a preset experience replay pool. The experience replay pool serves to store and manage experience tuples, providing data support for subsequent network training.

[0067] In step A303, based on the priority replay mechanism, sampled experience tuples are selected from the experience replay pool to perform iterative network training on the initial deep Q network to obtain a trained deep Q network.

[0068] A prioritized replay mechanism selects sampled experience tuples from the experience replay pool. This mechanism selectively samples experience tuples based on their priority, prioritizing high-priority experience tuples to ensure the network learns the most valuable information. The sampled experience tuples are used to iteratively train the initial Deep Q Network. During each iteration, the network adjusts its parameters based on the information in the experience tuples, gradually optimizing network performance. After multiple iterative training cycles, a fully trained Deep Q Network is obtained, capable of performing path optimization on the initial test path.

[0069] It is worth mentioning that the weight of TD-error (empirical importance) in the priority replay mechanism in this embodiment is tilted towards the following scenarios: State confusion scenarios: For example, "actions leading to different outcomes in two UI states with the same visual or structural structure but different histories" can help the agent quickly learn to distinguish similar states and reduce subsequent decision-making errors. Optimize effective scenarios: For example, "skipping a step and successfully reaching the next critical checkpoint"—this type of experience is the core of an efficient path, and prioritizing learning can accelerate the formation of optimization strategies. Deviation risk scenarios, such as scenarios where an alternative action results in a final state that differs from the original path, can strengthen the agent's understanding of optimization boundaries and prevent over-optimization that compromises test accuracy. By prioritizing these experiences, the agent's understanding of what to optimize and what to avoid in UI testing increases by 2-3 times, even with the same number of training steps, significantly shortening the convergence cycle.

[0070] For example, in one possible implementation, the deep Q-network training process is performed in rounds, with each round aiming to learn how to complete a given UI test path more efficiently. The following are the specific steps of the agent in a complete training cycle: (1) Initialization round: Anchoring Paths and Goals: At the beginning of each round, the system loads a user-defined N-step test path (e.g., "Login → Homepage → Product Page → Checkout Page"). This sets clear macro-goals and exploration boundaries for the agent.

[0071] Set the initial state: Set the initial state s0 to the UI state at the starting point of the path, including the visual screenshot V0, DOM structure D0, path context P0 (such as "current position 0 / N") and historical action H0 (empty).

[0072] Network and environment preparation: Initialize the parameters of the evaluation network (EvaluationNetwork) and the target network (TargetNetwork) (usually set the parameters of the two to be the same), and prepare the UI test environment.

[0073] (2) Exploration and interaction within the path framework: At each step t of the round: Select action at based on the current state st: The agent inputs the current state st (including Vt, Dt, Pt, Ht) into the evaluation network and obtains the Q values ​​of all possible optimization actions ("execute original step", "skip", "alternative action", etc.).

[0074] Adopting an epsilon-greedy strategy: randomly selecting a directed exploration action with probability ε (such as trying to skip a seemingly optional step), and selecting the action with the highest Q value with probability 1-ε. This ensures that exploration always revolves around the core task of "improving path efficiency."

[0075] Interact with the UI environment and get feedback: The agent performs action at.

[0076] The UI test environment returns the next state s{t+1} (new screenshot V{t+1} and DOMD{t+1}), as well as a comprehensive reward rt. The reward consists of the following parts: Efficiency reward: If an action (such as "skip") successfully shortens the steps and the state meets the requirements, a positive reward is given.

[0077] Coverage Reward: If the agent's actions enable the test case to cover previously untouched interface elements, functional modules, or specific business process branches (for example, successfully triggering a hidden function entrance or traversing a previously untraversed order processing branch), a corresponding positive reward will be given based on the difficulty and importance of the coverage. This will incentivize the agent to explore more diverse scenarios and improve the comprehensiveness of the test.

[0078] Deviation penalty: If the action causes the UI state to deviate from the original path (such as skipping a required field), a negative penalty is given.

[0079] Cost penalty: The actual time taken for an operation (such as page loading) is recorded as a negative reward to prevent the agent from choosing actions that appear to be efficient but are actually time-consuming.

[0080] (3) Store and prioritize key experiences: Encapsulated experience: After executing an action, we obtain a complete experience tuple: (st, at, rt, st{t+1}). This tuple is the raw material for the agent to learn.

[0081] Calculating Priority (TD-error): To store this new experience in the replay pool, we first calculate its "degree of surprise," or TD-error. This value is roughly equal to the difference between "actual reward rt + best expectation of the future" and "initial expectation." The higher the TD-error, the more unexpected the experience, and the greater its learning value.

[0082] Store in Prioritized Experience Replay (PER): The experience tuple (st, at, rt, s{t+1}) is stored in the experience replay pool together with its TD-error as the priority.

[0083] (4) Sampling experience and updating the network: Prioritized Sampling: When the experience replay pool has accumulated enough experience, we no longer use the newly generated experience. Instead, we sample from the pool according to priority, extracting a batch of experiences. High-priority experiences (such as those in key scenarios) are more likely to be selected. This step is the core application of the PER mechanism in step (4), which ensures that training resources are focused on the most valuable examples.

[0084] Calculate the loss function: For each sampled experience (sj, aj, rj, s{j+1}): Target Q-value: The target network calculates the maximum possible Q-value in state s{j+1} and combines this with the reward rj to form the learning objective. The parameters of the target network are fixed, providing a stable target for learning. This is specifically designed to address dynamic changes such as temporary UI pop-ups and loading delays, ensuring decision stability.

[0085] Predict Q-value: Use the evaluation network to calculate the Q-value of performing action aj in state sj.

[0086] Loss: The loss function calculates the difference between the target Q-value and the predicted Q-value. Path intention constraints are also added as a penalty term to the loss function: if action aj causes the state s{j+1} to deviate significantly from the original path plan, the loss value is increased.

[0087] Update the evaluation network: Through backpropagation, use the gradient descent algorithm to update the parameters of the evaluation network so that its predicted Q value is closer and closer to the more accurate target Q value.

[0088] Synchronize the target network: Every fixed number of steps, the parameters of the evaluation network are completely copied to the target network to achieve parameter synchronization.

[0089] (5) Termination and iteration: Checking for round termination: After each interaction, check whether the round termination condition is met: a. The final state of the test path has been reached.

[0090] b. Core coverage targets were achieved ahead of schedule (e.g. key checkpoints were covered).

[0091] c. Exceeding the preset maximum number of steps.

[0092] Start a new cycle: If the round has not ended, let st = s{t+1} and return to step (2) to continue the interaction.

[0093] If the round ends, the indicators such as "step saving rate" and "final state consistency" of this round are recorded. Then return to step (1) and start a new round.

[0094] Determine training convergence: When various indicators (such as step saving rate ≥ 20% and state consistency ≥ 95%) for multiple consecutive rounds stably reach the preset standards, the model is determined to have converged and training is completed.

[0095] Based on the first embodiment and / or the second embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the first and second embodiments can be referred to the above description and will not be described in detail. Figure 4 As shown, step S20 may include steps S201 to S203: Step S201, determining status information of each test step in the initial test path according to the environment state when the initial test path is executed in a preset application environment under test; It should be noted that since the direct input of the deep Q network is not the original initial test path, but the preprocessed state information representing the current UI interface, the state information of each test step in the initial test path is first determined in this embodiment.

[0096] Based on the environmental status presented when the initial test path is actually executed in the preset application environment under test, each test step in the initial test path is analyzed in detail to accurately determine the status information corresponding to each test step. This status information fully reflects the specific context of the test step in the application environment under test.

[0097] In a feasible embodiment, step S201 may include steps S2011 to S2015: Step S2011, for each test step when the initial test path is executed in the preset application environment under test, extracting a visual state from a current user interface screenshot when each test step is executed; For each test step when the initial test path is executed in the preset application environment under test, a screenshot of the current user interface when the test step is executed is taken, and then it is converted into a fixed-dimensional visual feature vector through a preprocessing module (usually a pre-trained image model) to obtain the visual state.

[0098] Step S2012, performing vectorized representation on the document object model or view hierarchy of the current user interface when each test step is executed to obtain a structural state; For each test step when the initial test path is executed in the preset application environment under test, the DOM tree or view hierarchy of the current user interface when the test step is executed is parsed, and the attributes of key elements (such as whether the button is clickable, the content of the text box, etc.) are extracted. Then, an encoder is used to convert it into a structural feature vector, that is, a structural vector is obtained.

[0099] Step S2013, obtaining the path status according to the position information of each test step in the initial test path; A path context vector is generated based on the current step’s position in the entire “test path.” For example, if the total path has N steps and the current step is at step i, this vector can be [i / N] or an encoding that indicates the intent of the next step, i.e., the path state.

[0100] Step S2014: extract the embedded representation of the preceding action of each test step to obtain the historical action state; Record the most recent series of actions of each test step to form a sequence to capture the timing dependency, that is, to obtain the historical action status.

[0101] Step S2015: extract the state-action pairs of each test step to obtain the tail sequence state.

[0102] To address the common state confusion problem in UIs (i.e., two visually and structurally identical interfaces that require different actions due to different previous operation histories), state representation can be further enhanced with "tails." A tail is a sequence of the most recent l (state-action) pairs, namely, Tt = ((st-l, at-l),..., (st-1, at-1), st). This provides the agent with richer historical trajectory information, enabling it to distinguish similar states with different contexts, thereby obtaining a tail sequence state.

[0103] Step S202: For each test step, analyze the state information of the test step through a deep Q network to determine the optimal action after the test step; For each test step with determined state information, a pre-trained Deep Q-Network conducts in-depth analysis of the state information. Leveraging its powerful learning and decision-making capabilities, the Deep Q-Network searches and determines the optimal action following each test step within a pre-set action space based on the input state information. This optimal action, calculated using a reinforcement learning algorithm, considers multiple factors, such as test efficiency, coverage, and path rationality, guiding the test path toward a more optimal direction.

[0104] It's worth noting that traditional reinforcement learning applications in the testing field typically treat the entire application under test as the environment, resulting in an extremely large, even unmanageable, state-action space. This embodiment redefines this problem: the "environment" here is no longer the entire application, but rather the process of traversing the test path predefined by the user through the first visual orchestration interface. The goal of the reinforcement learning agent is not to discover a valid test case from scratch, but to find the most efficient way to execute a known valid test case. This problem transformation greatly narrows the scope of the RL (Reinforcement Learning) problem, making network training computationally feasible and efficient. The agent no longer explores blindly, but instead finds shortcuts guided by a "map" (i.e., the original path created by the user).

[0105] In a feasible embodiment, the deep Q network includes a convolutional neural network branch, a multi-layer perceptron branch, a long short-term memory network branch, and a fully connected layer; step S202 may include steps S2021 to S2023: Step S2021: For each test step, the visual state corresponding to the test step is used as the input of the convolutional neural network branch, the structural state and path state corresponding to the test step are used as the input of the multi-layer perceptron branch, and the historical action state and tail sequence state corresponding to the test step are used as the input of the long short-term memory network branch. To accurately process the multi-dimensional state information in UI testing, the Deep Q Network adopts a multi-branch fusion architecture. Each branch is specifically adapted to the specific information type of the UI scenario, ensuring that the analysis of UI state is both comprehensive and accurate. Specifically, the Deep Q Network includes: Convolutional Neural Network (CNN) branch: The input is the visual state of the current UI screenshot. In UI testing, visual information provides direct feedback on user actions (such as whether a button has been clicked or a form has been filled out), but the position and style of elements in the screenshot may change dynamically (such as when a pop-up window loads or a list scrolls). The CNN branch uses convolutional layers to extract both invariant features (such as the visual outline of the input box) and variable features (such as the pixel distribution of the text within the input box). This not only captures the essential structure of the UI layout, but also distinguishes key state differences such as "unfilled" and "filled," providing a basis for "skipping redundant steps" (e.g., eliminating the need to re-enter an input box if it's already filled out).

[0106] Multilayer Perceptron (MLP) branch: Inputs are the structural state and path state of the DOM / view hierarchy. In UI testing, the DOM structure contains logical relationships that are difficult to capture visually (such as the disabled / enabled state of a "Submit" button or the list of options in a "drop-down menu"). Path context (such as "Currently at step 3, the next step is to enter the payment page") anchors the agent's optimization direction, avoiding deviation from the user's predefined test intent. The MLP branch uses fully connected layers to encode this structural information and path intent (such as "Payment must be completed in the next two steps") into vectors, providing logical support for "proposing alternative actions" (such as directly clicking the enabled Submit button instead of clicking the blank space as in the original step).

[0107] Long Short-Term Memory (LSTM) branch: Inputs are historical action states and tail sequence states. "State confusion" is a common problem in UI testing. For example, a product details page may require different subsequent actions depending on the historical path of "clicking in from the homepage" and "clicking in from search results" (the former requires returning to the homepage, while the latter requires returning to the search page). The LSTM branch leverages its temporal modeling capabilities to convert the most recent sequence of (state-action) pairs into a context vector, accurately distinguishing UI states with the same visual and structural structure but different histories, and preventing the agent from falling into loops (e.g., repeatedly jumping between the same two UI pages).

[0108] Step S2022: concatenate the outputs of the convolutional neural network branch, the multi-layer perceptron branch, and the long short-term memory network branch to obtain a fused feature vector; The feature vectors output by the three branches of CNN, MLP, and LSTM are connected end to end to form a longer fused feature vector that contains all the information.

[0109] In step S2023, the fused feature vector is input to the fully connected layer to obtain the optimal action after the test step output by the fully connected layer.

[0110] This fused long vector is input into one or more fully connected layers (also called output layers). The number of neurons in this output layer is equal to the number of possible actions (e.g., "Perform the original step," "Skip," "Alternative action A," "Alternative action B," etc.). The output value of each neuron is the Q-value of the corresponding action in the current state. The action with the highest Q-value is selected as the optimal action.

[0111] Step S203: iteratively update the initial test path according to each optimal action to obtain an optimized test path.

[0112] After determining the optimal actions after each test step, the initial test path is iteratively updated based on these optimal actions. During each iteration, the path is adjusted based on the optimal actions of the current test step, generating a new test path, which serves as the initial path for the next iteration. Through continuous iterative updates, the individual test steps and overall structure of the initial test path are gradually optimized, ultimately resulting in an optimized test path. Compared to the initial test path, this optimized test path has higher test efficiency, wider test coverage, and a more reasonable test process.

[0113] Therefore, this embodiment first utilizes a code-free, natural language-based visual orchestration interface to allow users to easily define an initial test path with high business value, preserving human intent. It then applies reinforcement learning techniques to a constrained optimization problem (i.e., optimizing this initial test path) rather than an unconstrained generation problem, thus circumventing the problem of state space explosion. In this way, this embodiment aims to produce automated test cases that are both efficient and robust, and fully meet the original business objectives, significantly reducing maintenance costs and improving the return on investment of automated testing.

[0114] Compared to traditional codeless visually orchestrated test platforms, this embodiment achieves a leap from "simplified creation" to "intelligent optimization": the core value of existing codeless platforms lies in simplifying the test case creation process. However, they faithfully execute the path orchestrated by the user, even if that path contains redundant and inefficient steps. This embodiment, on top of simplified creation, adds a new dimension of intelligent optimization that is not available in existing technologies. It not only makes test creation easier, but also makes the final test cases themselves more efficient and streamlined.

[0115] Significantly improve test execution efficiency and reduce costs: By using a reinforcement learning engine to discover and eliminate unnecessary steps (such as redundant verification clicks and invalid waits), the final test script generated by this embodiment is faster to execute and consumes less computing resources.

[0116] Compared to autonomous AI test generation techniques, this embodiment effectively circumvents the state space explosion problem: fully autonomous RL test generation techniques, when used in complex modern applications, often encounter the "curse of dimensionality" due to the excessively large state-action space, making it difficult to converge or scale. This embodiment technically solves this core problem by limiting the application of RL to optimizing a defined artificial path, significantly constraining the search space and making AI applications practical.

[0117] Perfectly preserves business intent and explainability: Autonomously generated test cases often lack clear business context, making their behavior difficult for humans to understand and maintain, which severely hinders their adoption within enterprises. This embodiment starts from a user-created path with clear business logic, ensuring that the core purpose and business value of the test are always preserved. AI's role is that of an "optimizer" rather than a "creator," resulting in highly explainable and business-relevant results.

[0118] Providing a controllable and trustworthy human-machine collaboration mechanism: The autonomous AI generation process is often like a "black box," making it difficult for users to control its behavior. This embodiment designs a transparent closed-loop human-machine interaction: all optimization suggestions made by the AI ​​must be reviewed and approved by the user. This "human-in-the-loop" design ensures that the final test script fully meets user expectations, thereby building user trust in AI capabilities and promoting the practical application of the technology.

[0119] It should be noted that the above examples are only used to understand this application and do not constitute a limitation on the UI test script visualization orchestration method based on reinforcement learning in this application. More simple transformations based on this technical concept are all within the scope of protection of this application.

[0120] The present application also provides a UI test script visualization arrangement system based on reinforcement learning. Figure 5 , the UI test script visual orchestration system based on reinforcement learning includes: The visual arrangement module 10 is configured to receive an initial test path constructed by a user through a preset first visual arrangement interface; A reinforcement learning optimization engine 20 is used to optimize the initial test path to obtain an optimized test path; The visual orchestration module 10 is further configured to display comparison information between the optimized test path and the initial test path on a preset second visual orchestration interface, and generate a UI test script in response to a user interaction operation received on the second visual orchestration interface.

[0121] Optionally, the reinforcement learning optimization engine 20 includes: a state determination unit, configured to determine state information of each test step in the initial test path according to an environment state when the initial test path is executed in a preset application environment under test; An action determination unit is used to analyze the state information of each test step through a deep Q network to determine the optimal action after the test step; The path optimization unit is used to iteratively update the initial test path according to each optimal action to obtain an optimized test path.

[0122] The reinforcement learning-based UI test script visual orchestration system provided in the embodiment of the present application adopts the reinforcement learning-based UI test script visual orchestration method in the above embodiment, and can efficiently and cost-effectively create and maintain UI automated tests with clear business intent and robust execution. Compared with the prior art, the beneficial effects of the reinforcement learning-based UI test script visual orchestration system provided in the embodiment of the present application are the same as the beneficial effects of the reinforcement learning-based UI test script visual orchestration method provided in the above embodiment, and other technical features of the reinforcement learning-based UI test script visual orchestration system are the same as the features disclosed in the reinforcement learning-based UI test script visual orchestration method in the above embodiment, and are not further described here.

[0123] The above are only some embodiments of the present application and are not intended to limit the patent scope of the present application. All equivalent structural transformations made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A method for visually arranging UI test scripts based on reinforcement learning, characterized in that: The reinforcement learning-based UI test script visual arrangement method includes: Receiving an initial test path constructed by a user through a preset first visual arrangement interface; Performing path optimization on the initial test path to obtain an optimized test path; The comparison information between the optimized test path and the initial test path is displayed on a preset second visual choreography interface, and a UI test script is generated in response to a user interaction operation received on the second visual choreography interface.

2. The method for visually arranging UI test scripts based on reinforcement learning according to claim 1, wherein: Before the step of performing path optimization on the initial test path to obtain an optimized test path, the method further includes: Obtaining an initial deep Q network, wherein a state space of the initial deep Q network is configured to store an environment state when executing a test step in a preset application environment under test, and an action space of the initial deep Q network is configured to store various test path optimization operations; Acquire a training sample, wherein the training sample includes multiple groups of training and testing paths; The initial deep Q network is trained based on the training samples to obtain a trained deep Q network, and the deep Q network is used to perform path optimization on the initial test path.

3. The method for visually arranging UI test scripts based on reinforcement learning according to claim 2, wherein: The step of training the initial deep Q network based on the training samples to obtain a trained deep Q network includes: For each of the training test paths in the training sample, interact with the tested application environment according to the training test path, and obtain each experience tuple in the interaction process according to a preset reinforcement learning strategy, wherein the experience tuple includes the current state at each moment, the executed action, the state at the next moment, and the compound reward; Calculating the priority of each of the experience tuples, and storing each of the experience tuples and the corresponding priority into a preset experience replay pool; Based on the priority replay mechanism, a sampled experience tuple is selected from the experience replay pool to perform iterative network training on the initial deep Q network to obtain a trained deep Q network.

4. The method for visually arranging UI test scripts based on reinforcement learning according to claim 1, wherein: The step of performing path optimization on the initial test path to obtain an optimized test path includes: Determining state information of each test step in the initial test path according to an environment state when the initial test path is executed in a preset application environment under test; For each of the test steps, analyzing the state information of the test step through a deep Q network to determine the optimal action after the test step; The initial test path is iteratively updated according to each of the optimal actions to obtain an optimized test path.

5. The method for visually arranging UI test scripts based on reinforcement learning according to claim 4, wherein: The step of determining the status information of each test step in the initial test path according to the environment state when the initial test path is executed in the preset application environment under test includes: For each test step when the initial test path is executed in the preset application environment under test, extracting a visual state from a current user interface screenshot when each test step is executed; Performing vector representation on the document object model or view hierarchy of the current user interface when each of the test steps is executed to obtain a structural state; Obtaining a path state according to position information of each test step in the initial test path; Extracting the embedded representation of the preceding action of each test step to obtain a historical action state; Extract the state-action pair of each test step to obtain the tail sequence state.

6. The method for visually arranging UI test scripts based on reinforcement learning according to claim 5, characterized in that: The deep Q network includes a convolutional neural network branch, a multi-layer perceptron branch, a long short-term memory network branch and a fully connected layer; The step of analyzing the state information of each test step by a deep Q network to determine the optimal action after the test step includes: For each of the test steps, the visual state corresponding to the test step is used as the input of the convolutional neural network branch, the structural state and path state corresponding to the test step are used as the input of the multi-layer perceptron branch, and the historical action state and tail sequence state corresponding to the test step are used as the input of the long short-term memory network branch; splicing the outputs of the convolutional neural network branch, the multi-layer perceptron branch, and the long short-term memory network branch to obtain a fused feature vector; The fused feature vector is input into the fully connected layer to obtain the optimal action after the test step output by the fully connected layer.

7. The method for visually arranging UI test scripts based on reinforcement learning according to claim 1, wherein: The first visual orchestration interface includes a natural language instruction block, and the step of receiving the initial test path constructed by the user through the preset first visual orchestration interface includes: In response to the user's dragging operation and parameter configuration operation on the natural language instruction block in the first visual arrangement interface, an initial test path is generated.

8. The method for visually arranging UI test scripts based on reinforcement learning according to claim 1, wherein: The step of displaying the comparison information between the optimized test path and the initial test path on a preset second visual orchestration interface, and generating a UI test script in response to a user interaction operation received on the second visual orchestration interface, includes: In a preset second visual arrangement interface, differentiating the optimized test path from the initial test path by using different colors or different styles; Visually graying out the optimized steps in the initial test path, and displaying optimization reasons in response to the first user interaction operation; modifying the optimized test path and / or the initial test path in response to a second user operation to generate a target test path; Generate a UI test script based on the target test path.

9. A UI test script visual arrangement system based on reinforcement learning, characterized in that: The reinforcement learning-based UI test script visual orchestration system includes: A visual arrangement module, configured to receive an initial test path constructed by a user through a preset first visual arrangement interface; A reinforcement learning optimization engine is used to perform path optimization on the initial test path to obtain an optimized test path; The visual orchestration module is further configured to display comparison information between the optimized test path and the initial test path on a preset second visual orchestration interface, and generate a UI test script in response to a user interaction operation received on the second visual orchestration interface.

10. The UI test script visual arrangement system based on reinforcement learning according to claim 9, characterized in that: The reinforcement learning optimization engine includes: a state determination unit, configured to determine state information of each test step in the initial test path according to an environment state when the initial test path is executed in a preset application environment under test; an action determination unit, configured to analyze, for each of the test steps, state information of the test step using a deep Q network, and determine an optimal action after the test step; The path optimization unit is used to iteratively update the initial test path according to each of the optimal actions to obtain an optimized test path.

Citation Information

Patent Citations

  • Software testing automation platform and intelligent optimization method thereof

    CN119415393A

  • Computer testing method and system based on machine learning

    CN119739643A

  • Application test method and device, electronic equipment, product and storage medium

    CN119938531A

  • Test case generation and script optimization method and device based on machine learning

    CN120123251A

  • Testing of Computing Processes Using Artificial Intelligence

    US20210279577A1