Automatic test case execution method based on large language model

Through the collaboration of large language model and reinforcement learning, the design of conditional strategies π(a|s,z) and similarity analysis, the limitations of traditional testing methods are solved, efficient and adaptive automated testing is realized, and potential defects can be found in complex software systems.

CN120371697APending Publication Date: 2025-07-25SHANGHAI PALM INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510447874.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

Traditional automated testing methods have significant limitations in efficiency, coverage and adaptability, and manual test scripts need to be updated frequently, lacking generalization capabilities, resulting in frequent test vulnerabilities.

Method used

A method of collaborating with large language model and reinforcement learning (RL) is adopted to explore the software state space and execute test actions through code parsing, generating initial test cases, combining the state space, action space and reward functions of the RL model, and design the conditional strategy π (a|s,z) to explore the software state space and execute test actions, and introduce similarity analysis to improve generalization ability.

Benefits of technology

It realizes closed-loop optimization of test case generation and execution, improves the generalization ability and adaptability of the test process, can discover potential defects without preset paths, and simplifies the complexity of test case generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371697A_ABST
    Figure CN120371697A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of software testing, and particularly relates to an automatic test case execution method based on a large language model, which comprises the following steps: S1) analyzing a to-be-tested software source code, and extracting structured code metadata of the source code; s2) selecting an accessibility code path according to the extracted structured code metadata, and generating an initial test case by using a large language model; s3) interacting with the tested software by using an RL model agent, and executing the initial test case; s4) performing structured analysis on the initial test case, and extracting an initial state, an action and a test target state in the initial test case; and S5) the agent explores the state space of the tested software through the condition strategy of the RL model and executes operation. According to the method, an agent mechanism based on reinforcement learning is designed, an agent is guided to autonomously explore a user interface of software, an effective test strategy is learned, and the test process has generalization ability and adaptivity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of software testing, and specifically, relates to an automated test case execution method based on a large language model. Background Art

[0002] As the last link in software delivery, with the rapid increase in the complexity of software systems, traditional automated test methods have gradually revealed significant limitations in terms of efficiency, coverage, and adaptability:

[0003] First: Traditional test case generation tools, such as rule-based or random search methods, lack in-depth structured analysis of code semantics. The generated test cases are mostly limited to complex paths covered by multitasks under predefined patterns, and their complexity restricts the application of large language models in test case code generation.

[0004] Second: Automated test frameworks that rely on manually writing test scripts (such as Selenium) require frequent manual updates for UI; while tools based on recording and playback, such as UiPath, although reducing the difficulty of script writing, the generated scripts lack generalization ability and cannot adapt to UI element changes (such as button ID changes, new pop-ups), resulting in frequent occurrence of test fragility (Flaky Tests). According to statistics, the maintenance cost of test scripts in large projects accounts for more than 40% of the total test cost. Summary of the Invention

[0005] To solve the technical problems that the complexity of test cases generated by traditional tools restricts the application of large language models; and the automated test frameworks that rely on manually writing test scripts require manual updates and lack generalization ability, the present invention provides an automated test case execution method based on a large language model. Through the collaboration of LLM and RL, a conditional policy π(a|s,z) based on the RL model is designed, realizing the closed-loop optimization of test case generation, execution, and automatic iteration.

[0006] The object of the present invention can be achieved by the following technical solutions:

[0007] An automated test case execution method based on a large language model includes the following steps:

[0008] S1) Code parsing and information extraction: Parse the source code of the software to be tested, and extract the structured code metadata of the source code, including classes, methods, dependency relationships, and code reachability information;

[0009] S2) Application of large language model: According to the extracted structured code metadata, select a reachable code path, and use the large language model to generate an initial test case;

[0010] S3) RL Environment Modeling: Use an RL model (reinforcement learning such as the PPO algorithm) agent to interact with the software under test, execute the initial test cases, and define the state space (user interface), action space (click, input), and reward function (achieve the test goal, cover new paths) of the RL model;

[0011] S4) Structured Parsing: Perform structured parsing on the initial test cases to extract the initial state, actions, and test target states (such as "save file", "font modification") in the initial test cases;

[0012] S5) Policy Learning: The agent explores the state space of the software under test through the conditional policy π(a∣s,z) of the RL model and performs operations;

[0013] Preferably, in step S3), the defined range of the state space of the RL model includes the user interface and UI elements;

[0014] The action space is mainly UI interaction actions, including click, input, and selection;

[0015] The definition of the reward function includes: when the agent executes an action and reaches a certain test target state of the test case, a positive reward is given;

[0016] When the agent executes an action and causes the test case to fail or exhibit unexpected behavior, a zero reward or negative reward is given.

[0017] Preferably, in the definition of the reward function, it also includes: when the agent executes an action and has not yet reached a certain test target state, but the agent accesses a UI interface that has not been visited before, a moderate positive reward is given to encourage exploration;

[0018] When the action executed by the agent brings it close to a certain test target state of the test case, a moderate positive reward is given.

[0019] Preferably, in step S5), the specific implementation steps of the conditional policy π(a∣s,z) of the RL model include:

[0020] S51) The RL model agent selects an action a to execute in the initial user interface s generated by the software under test.

[0021] S52) Execute the selected action a, causing the software under test to transition from the initial user interface s to the second user interface.

[0022] S53) If the executed action makes the software running state close to or reach a certain test target state z, the agent will receive a positive reward; otherwise, it will receive a zero reward or negative reward.

[0023] S54) The agent iteratively updates its internal RL model based on the actions it executes and the rewards it receives.

[0024] Preferably, the specific implementation steps of step S5) include:

[0025] Perform similarity analysis based on the structured parsing result, and generate a set of similar test target states according to the analysis result;

[0026] The RL model agent selects an action to execute in the initial user interface generated by the software under test;

[0027] Execute the selected action, causing the software under test to transition from the initial user interface to the second user interface;

[0028] If the executed action causes the software running state to approach or reach two or more test target states in the set of similar test target states, the agent will receive a positive reward; otherwise, it will receive a zero reward or a negative reward.

[0029] Preferably, the specific implementation method of the similarity analysis is:

[0030] Extract the initial state, action, and test target state in the test case according to step S4); use the one-hot encoding method to convert the initial state, action, and test target state into numerical feature vectors, thereby classifying the set of similar test target states.

[0031] Preferably, the specific implementation steps of the one-hot encoding method include:

[0032] Traverse all test cases to construct a category dictionary, assign a unique index to each state and action, and generate a one-hot encoding table;

[0033] Perform one-hot encoding on the initial state, action, and test target state of each test case respectively, and splice them into a complete feature vector.

[0034] Calculate the similarity of the feature vectors based on the cosine similarity, and set the similarity threshold;

[0035] Classify different sets of similar test target states according to the similarity threshold.

[0036] Preferably, the calculation formula of the cosine similarity is:

[0037]

[0038] In the formula, u and v represent the feature vectors of different test cases; ∥u∥·∥v∥ represents the product of the Euclidean norms of the feature vectors u and v; u·v represents the product of the feature vectors u and v.

[0039] Preferably, it further includes step S6) test case iteration: the LLM dynamically supplements test cases for other code paths (such as adding a "file deletion" use case) according to the exploration results of the agent.

[0040] Advantages of the present invention:

[0041] 1. The present invention utilizes the semantic understanding and code generation capabilities of the large language model, starting from the simple structure of test cases for a single code path, thereby greatly simplifying the complexity of test case generation by the large language model.

[0042] 2. A proxy mechanism based on reinforcement learning (RL model) is designed. The agent is guided by the conditional policy π(a∣s,z) to autonomously explore the user interface of the software, execute test actions, and receive rewards according to the execution results, and finally learn effective test strategies. This makes the test process more generalizable and adaptable, and can discover potential software defects without a pre-set complete test path.

[0043] 3. Similarity analysis is also introduced. The determination of the reward is based on whether the executed action achieves multiple target states in a set of similar test target state sets, thereby improving the efficiency and generalization ability of reinforcement learning. Description of the drawings

[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0045] Figure 1 It is a step flow chart of the method for executing automated test cases based on the large language model of the present invention.

[0046] Figure 2 It is a step flow chart of the conditional policy of the RL model in the method for executing automated test cases based on the large language model of the present invention.

[0047] Figure 3 It is a step flow chart of the similarity analysis in the method for executing automated test cases based on the large language model of the present invention. Detailed implementation manners

[0048] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art without creative efforts based on the embodiments of the present invention belong to the scope of protection of the present invention.

[0049] Please refer to Figures 1 - 3 as shown, the automated test case execution method based on large language models includes the following steps:

[0050] S1) Code parsing and information extraction: Parse the source code of the software under test, and extract the structured code metadata of the source code, including classes, methods, dependency relationships, and code reachability information;

[0051] In the specific implementation process, use the 'Checkstyle' or 'PMD' code analysis tool to parse the source code of the software under test and extract the structured code metadata. Furthermore, the structured context information of the abstract syntax tree (AST) can be constructed by parsing classes, methods, and dependency relationships. The code branch coverage can also be identified through the code reachability information, and the code path can be marked; at the same time, the abnormal code path can be marked.

[0052] S2) Application of large language models: According to the extracted structured code metadata, select a reachable code path, and use the large language model to generate initial test cases;

[0053] In the specific implementation process, use the large language model (LLM) to understand the code metadata (classes, methods, dependency relationships) and its structured business logic; combined with the code reachability information (such as branch coverage) extracted in step S1, preferentially select the code path that covers the main process. Thus, initial test cases are generated for a single path, including clear initial states, actions, and target test states. Thus, it is compatible with the exploration requirements of the subsequent RL model agent.

[0054] S3) RL environment modeling: Use an RL model (reinforcement learning such as the PPO algorithm) agent to interact with the software under test, execute the initial test cases, and define the state space (user interface), action space (click, input), and reward function (complete the test goal, cover a new path) of the RL model;

[0055] In the specific implementation process, convert the test environment of the software under test into the state space, action space, and reward function that can be understood by the RL model agent. The RL model agent interacts with the software test environment, executes actions, and learns high-quality test strategies based on the observed states and obtained rewards. Among them, the state space defines all possible situations that the agent can perceive in the environment. When converting the test cases into the state space, we need to consider which information can characterize the current state of the software during the test execution process. This includes various UI elements such as buttons, menus, text boxes, lists, etc.; as well as the internal program running state, such as the usage of system resources such as CPU and memory.

[0056] The action space defines all possible actions that an agent can take in each state. Each step of an operation in a test case can be regarded as an action. The design of the action space needs to cover various UI interaction actions that may be executed in the test case, including: 'click': a clickable interface element; 'input': enter text in a text box;'select': select an option in a menu.

[0057] The reward function defines the feedback signal that an agent receives after executing an action and is used to guide the learning direction of the agent. The design of the reward function directly affects the final learning effect of the agent. When converting a test case into a reward function, the expected results and success / failure criteria of the test case need to be considered.

[0058] S4) Structured parsing: Perform structured parsing on the initial test case to extract the initial state, actions, and test target state in the initial test case;

[0059] In the specific implementation process, the large language model can continue to be used to perform structured parsing on the initial test case. The initial state represents the initial interface when software testing starts or the program running state. The execution actions represent specific interaction operations in the test scenario, such as clicking a button, entering text, or triggering a specific function, etc.; the test target state represents reaching a certain test target state, such as specific operation targets like "saving a file" or "modifying the font". This structured parsing based on the large language model actually transforms the test from a traditional manual and experience-driven mode into an intelligent process based on deep semantic understanding. By converting the test case into distinguishable structured elements.

[0060] S5) Policy learning: The agent explores the state space of the software under test and executes operations through the conditional policy π(a∣s,z) of the RL model;

[0061] Specifically, the agent establishes a dynamic and intelligent exploration mechanism through the conditional policy π(a|s,z) of the RL model; the present invention adopts an agent execution mechanism based on the RL model, which does not simply follow a preset fixed path, but can dynamically adjust its behavior according to real-time system feedback. By evaluating the immediate effect and long-term value of actions, the agent gradually builds a deep understanding of the software behavior. In practical applications, this process involves complex probability calculations and policy evaluations. The agent will calculate the expected rewards of different actions in real time and select actions that can maximize the probability of completing the test target.

[0062] Furthermore, it further includes step S6) Test case iteration: The LLM dynamically supplements test cases for other code paths according to the exploration results of the agent (such as adding a "file deletion" use case).

[0063] Further, in step S3), the defined range of the state space of the RL model includes the user interface and UI elements (such as text boxes, menus).

[0064] Specifically, this is the set of all possible user interface states of the software under test. The reinforcement learning agent needs to be able to perceive the current state and make decisions based on this. The state can be represented by screenshots of the user interface, sets of element attributes, etc.

[0065] The action space mainly consists of UI interaction actions, including clicking, inputting, and selecting; this is the set of all possible actions that the reinforcement learning agent can perform in a given user interface state. The specific content of the actions depends on the elements of the user interface and the executable operations.

[0066] The reward function defines the feedback signal given by the environment to the reinforcement learning agent after performing an action and causing a software state transition, including: when the agent performs an action and reaches a certain test target state of the test case, a positive reward is given;

[0067] when the agent performs an action and causes the test case to fail or exhibit unexpected behavior, a zero reward or a negative reward is given.

[0068] Specifically, the agent learns by interacting with the software environment (such as the user interface of the software under test). It observes the current user interface state, selects the action to be performed, and receives feedback (reward signal) from the software environment. The RL model (reinforcement learning) agent learns by continuously interacting with the environment, performing actions, receiving rewards, and updating its policy according to the reward signal. This process is usually iterative, and the agent will gradually explore the action sequences that can obtain higher rewards. The specific implementation process can include the following steps:

[0069] 1. Test case analysis: Deeply understand the purpose, steps, and expected results of each test case.

[0070] 2. Environment modeling: Abstract the software under test as a reinforcement learning environment and determine the possible states and executable actions.

[0071] 3. State space construction: Use automated tools to identify and extract relevant UI elements and their attributes, or monitor internal program states.

[0072] Convert the extracted state information into a numerical feature vector.

[0073] Encode historical state and action information as needed.

[0074] 4. Action space construction: Enumerate the valid UI interaction actions, system-level actions, or custom actions that can be executed in each state.

[0075] Parameterize the actions, for example, specify the UI elements to be operated on or the text to be input.

[0076] Represent the actions in a form that can be understood by the reinforcement learning model (e.g., integer indices or parameterized vectors).

[0077] 5. Reward function design: Define positive rewards and negative punishments based on the success and failure conditions of the test cases.

[0078] Consider introducing intermediate rewards to guide the agent for effective exploration and learning.

[0079] Implement the reward calculation logic, monitor the state and behavior during test execution, and return the corresponding reward values.

[0080] In the specific implementation process, in order to guide the RL model to learn more effectively, intermediate rewards or punishments can be given during the test, even if the final success or failure state has not been reached. In defining the reward function, it also includes: when the agent executes an action, even if a certain test target state has not been reached, but the agent accesses a UI interface that has not been visited before, an appropriate positive reward is given to encourage exploration;

[0081] When the action executed by the agent brings it closer to a certain test target state of the test case, an appropriate positive reward is given.

[0082] Furthermore, in step S5), the specific implementation steps of the conditional policy π(a∣s,z) of the RL model include:

[0083] S51) The RL model agent selects an action a to execute in the initial user interface s generated by the software under test. This action is to interact with a certain element in the user interface, such as clicking a button or entering some text.

[0084] S52) Execute the selected action a, causing the software under test to transition from the initial user interface s to the second user interface. This process simulates the interaction between the user and the software.

[0085] S53) If the executed action makes the software running state close to or reach a certain test target state z, the agent will receive a positive reward; otherwise, it will receive zero reward or negative reward.

[0086] This reward mechanism more directly guides the agent to learn how to complete specific test cases or user scenarios. For example, the test target state can be'successful login', etc.

[0087] S54) The agent iteratively updates its internal RL model based on the actions it executes and the rewards it receives.

[0088] The goal of model update is to adjust the agent's policy so that it is more inclined to select actions that can obtain higher rewards in future similar states. This usually involves using various reinforcement learning algorithms, such as Q-learning, PPO algorithm, etc. The goal of the reinforcement learning algorithm is to learn a conditional policy π(a∣s,z) that can select actions that maximize the long-term cumulative reward in different states.

[0089] Furthermore, the specific implementation steps of step S5) include:

[0090] Perform similarity analysis based on the structured parsing result, and generate a set of similar test target states according to the analysis result;

[0091] The RL model agent selects an action to execute in the initial user interface generated by the software under test;

[0092] Execute the selected action, causing the software under test to transition from the initial user interface to the second user interface;

[0093] If the executed action makes the software running state close to or reach two or more test target states in the set of similar test target states, the agent will receive a positive reward; otherwise, it will receive a zero reward or a negative reward.

[0094] In the specific implementation process, since multiple user interface tasks are similar in nature, the learned test strategies can also be shared or transferred between these similar tasks. Therefore, the present invention also introduces a similarity analysis step before the reinforcement learning process, aiming to improve the efficiency and generalization ability of reinforcement learning. First, perform similarity analysis on various executable user interface tasks in the software under test. Here, "task" can be understood as a series of operation processes, such as different menu functions or user interfaces. The similarity analysis is based on the operation steps of the task, the UI elements involved, the achieved test target states, etc. The result of the analysis is to generate a set of similar test target states.

[0095] The determination of the reward is based on whether the executed action has achieved multiple target states in a set of similar test target states. This means that the reward not only considers whether the currently executed task is successful, but also considers the completion of the goals of other tasks similar to this task. This reward mechanism encourages the agent to learn more general operation modes, enabling it to better handle similar user interface tasks.

[0096] Furthermore, the specific implementation method of the similarity analysis is:

[0097] Extract the initial state, actions, and test target state from the test cases according to step S4); use the one-hot encoding method to convert the initial state, actions, and test target state into numerical feature vectors, so as to classify the set of similar test target states;

[0098] Specifically, one-hot encoding is a method of converting categorical variables into numerical vectors, where each category corresponds to a unique binary vector. It can effectively support similarity analysis and target state clustering. Combining dynamic encoding strategies and similarity calculations provides a classification basis for test case management. Introduce similarity analysis based on one-hot encoding to cluster test targets with similar semantics (such as "save file" and "save as") into a set of similar states. When the agent completes a single target, it synchronously optimizes the reward signal for similar tasks, thereby enhancing the policy generalization ability. For example, after the agent learns to "save file", it can quickly transfer to the "save as" task, reducing repeated exploration.

[0099] Furthermore, the specific implementation steps of the one-hot encoding method include:

[0100] Traverse all test cases to construct a category dictionary, assign a unique index to each state and action, and generate a one-hot encoding table;

[0101] Perform one-hot encoding on the initial state, actions, and test target state of each test case respectively, and splice them into a complete feature vector.

[0102] Calculate the similarity of feature vectors based on cosine similarity, and set a similarity threshold;

[0103] Classify different sets of similar test target states according to the similarity threshold.

[0104] In the specific implementation process, a unique index is assigned to each initial state (e.g., "main page" → encoded as: [1, 0, 0]); actions (e.g., "click the login button" → encoded as: [0, 1, 0]); test target state (e.g., "user has logged in" → encoded as: [1, 1, 1]); then the complete feature vector can be represented as: [100010111]. Then calculate the direction consistency of the feature vectors based on cosine similarity. A threshold set to be greater than 0.8 can be classified as a set of similar test target states.

[0105] In summary, the present invention realizes the intelligent generation, automatic execution, and optimization of execution strategies of software test cases by integrating large language models (LLMs) and reinforcement learning (RL). It solves the problem that traditional software testing often relies on manually writing test cases, which is time-consuming and has incomplete coverage. This solution utilizes the semantic understanding and code generation capabilities of AI large language models, starting from the simple structure of test cases for a single code path, thus greatly simplifying the complexity of generating test cases by large language models.

[0106] On the other hand, an agent mechanism based on reinforcement learning (RL model) is designed, and the agent is guided to explore in the expected direction through the conditional policy π(a∣s,z). At the same time, similarity analysis is also introduced, and the determination of rewards is based on whether the executed actions achieve multiple target states in a set of similar test target state sets, thereby improving the efficiency and generalization ability of reinforcement learning. By utilizing the technology of reinforcement learning, it is expected to overcome some limitations of traditional automated testing methods when dealing with complex and dynamic software systems, discover potential software defects without presetting a complete test path, and achieve higher-quality and more comprehensive automated testing. In the future, it can be extended to cross-platform testing (such as mobile terminals and embedded systems), security vulnerability mining and other fields, promoting the software quality assurance to a new intelligent stage.

[0107] In the description of the specification, the descriptions referring to terms such as "further", "in the specific implementation process", and "specific examples" mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. The above content is only an example and explanation of the structure of the present invention. Those skilled in the art of the present technology can make various modifications or supplements to the described specific embodiments or use similar methods for substitution, as long as they do not deviate from the structure of the invention or exceed the scope defined by the claims of the present invention, they should all fall within the protection scope of the present invention.

Claims

1. An automated test case execution method based on a large language model, characterized in that, It includes the following steps: S1) Parse the source code of the software to be tested, and extract the structured code metadata of the source code, including classes, methods, dependency relationships, and code reachability information; S2) According to the extracted structured code metadata, select a reachable code path, and use a large language model to generate initial test cases; S3) Use an RL model agent to interact with the software to be tested, execute the initial test cases, and define the state space, action space, and reward function of the RL model; S4) Structurally parse the initial test cases, and extract the initial state, actions, and test target states in the initial test cases; S5) The agent explores the state space of the software to be tested through the conditional policy π(a∣s,z) of the RL model and performs operations.

2. The automated test case execution method based on a large language model according to claim 1, wherein: In step S3), the defined range of the state space of the RL model includes the user interface and UI elements; The action space is mainly UI interaction actions, including clicking, inputting, and selecting; The definition of the reward function includes: when the agent executes an action and reaches a certain test target state of the test case, a positive reward is given; When the agent executes an action and causes the test case to fail or exhibit unexpected behavior, a zero reward or a negative reward is given.

3. The automated test case execution method based on a large language model according to claim 2, wherein: In the definition of the reward function, it also includes: when the agent executes an action and has not yet reached a certain test target state, but the agent accesses a UI interface that has not been visited before, a moderate positive reward is given.

4. The automated test case execution method based on a large language model according to claim 2, wherein: In the definition of the reward function, it also includes: when the action executed by the agent brings it closer to a certain test target state of the test case, a moderate positive reward is given.

5. The automated test case execution method based on a large language model according to claim 1, wherein: In step S5), the specific implementation steps of the conditional policy π(a∣s,z) of the RL model include: S51) The RL model agent selects an action a to execute in the initial user interface s generated by the software to be tested; S52) Execute the selected action a, causing the software to be tested to transition from the initial user interface s to the second user interface; S53) If the executed action makes the software running state close to or reach a certain test target state z, the agent will receive a positive reward; otherwise, it will receive a zero reward or a negative reward; S54) The agent iteratively updates its internal RL model based on the actions it executes and the rewards it receives.

6. The automated test case execution method based on a large language model according to claim 1, wherein, The specific implementation steps of step S5) include: Perform similarity analysis based on the structural parsing results, and generate a set of similar test target states according to the analysis results; The RL model agent selects an action to execute in the initial user interface generated by the software to be tested; Execute the selected action, causing the software to be tested to transition from the initial user interface to the second user interface; If the executed action makes the software running state close to or reach two or more test target states in the set of similar test target states, the agent will receive a positive reward; otherwise, it will receive a zero reward or a negative reward.

7. The automated test case execution method based on a large language model according to claim 6, wherein: The specific implementation method of the similarity analysis is: Extract the initial state, actions, and test target states in the test cases according to step S4); use the one-hot encoding method to convert the initial state, actions, and test target states into numerical feature vectors, so as to classify the set of similar test target states.

8. The automated test case execution method based on a large language model according to claim 7, wherein: The specific implementation steps of the one-hot encoding method are as follows: Traverse all test cases to construct a category dictionary, assign a unique index to each state and action, and generate a one-hot encoding table; Perform one-hot encoding on the initial state, action, and test target state of each test case respectively, and concatenate them into a complete feature vector; Calculate the similarity of feature vectors based on cosine similarity and set a similarity threshold; Classify different similar test target state sets according to the similarity threshold.

9. The automated test case execution method based on a large language model according to claim 8, wherein: The calculation formula of the cosine similarity is: In the formula, u and v represent the feature vectors of different test cases; ∥u∥·∥v∥ represents the product of the Euclidean norms of the feature vectors u and v; u·v represents the product of the feature vectors u and v.

10. The automated test case execution method based on a large language model according to claim 1, wherein, It also includes step S6): The LLM dynamically supplements test cases for other code paths according to the exploration results of the agent.