Test simulator generation method, device and equipment

By constructing a page structure tree for the test simulator and generating source code, the problem of inconsistent testing environments for intelligent agents was solved, enabling accurate evaluation of agent capabilities and efficient generation of testing environments.

CN121901115APending Publication Date: 2026-04-21XG TECHNOLOGIES PTE LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XG TECHNOLOGIES PTE LTD
Filing Date
2026-01-14
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing technologies make it difficult to provide reproducible testing environments for intelligent agents, resulting in different interface states when intelligent agents perform the same task at different times or on different devices, which affects the accuracy of evaluation. At the same time, the development of high-fidelity simulation applications is costly and time-consuming.

Method used

By identifying the tasks to be executed and screenshots of the task paths, a page structure tree for the test simulator is constructed. The source code of the test simulator is generated using an intelligent agent to ensure the authenticity of the interface layout, eliminate random interference from personalized recommendations and dynamic UI changes, and generate a controllable and reproducible test environment.

Benefits of technology

It enables accurate evaluation of agent capabilities, ensures consistency of the testing environment, improves the efficiency of test simulator construction, and lowers the threshold for benchmark construction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121901115A_ABST
    Figure CN121901115A_ABST
Patent Text Reader

Abstract

The invention discloses a test simulator generation method, device and equipment. The test simulator generation method comprises the steps of determining at least one to-be-executed task of a test simulator for simulating a target application and a task path screenshot sequence related to each to-be-executed task; determining a target data structure of the test simulator based on the at least one to-be-executed task; based on the interface structure information of the target application and the at least one to-be-executed task, constructing a page structure tree of the test simulator; based on the page structure tree, the at least one to-be-executed task, the target data structure and the task path screenshot sequence related to each to-be-executed task, generating a target source code of the test simulator through the intelligent agent; and compiling the target source code to generate a test simulator. According to the scheme, the controllable and reproducible test simulator is generated to replace a real commercial application as a test environment, so that the consistency of the test environment in which the intelligent agent executes the same task at different time can be ensured, and the accurate evaluation of the ability of the intelligent agent is further realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the fields of computer software engineering and artificial intelligence technology, and in particular to a method, apparatus and device for generating a test simulator. Background Technology

[0002] With the development of large language models, GUI agents capable of understanding natural language instructions and automatically operating mobile devices to complete multi-step tasks have become a research hotspot. However, how to provide reproducible testing environments for these agents to improve the accuracy of agent evaluation remains a pressing issue. Summary of the Invention

[0003] To address the aforementioned technical problems, this disclosure provides a test simulator generation method, apparatus, and device that can provide a reproducible testing environment for intelligent agents, thereby improving the accuracy of intelligent agent evaluation.

[0004] The first aspect of this disclosure provides a method for generating a test simulator, comprising: Identify at least one task to be executed by the test simulator used to simulate the target application and a sequence of task path screenshots associated with each task to be executed; Based on the at least one task to be executed, determine the target data structure of the test simulator; Based on the interface structure information of the target application and the at least one task to be executed, construct the page structure tree of the test simulator; Based on the page structure tree, the at least one task to be executed, the target data structure, and the sequence of task path screenshots associated with each task to be executed, the target source code of the test simulator is generated by an intelligent agent; The target source code is compiled to generate the test simulator.

[0005] A second aspect of this disclosure provides a test simulator generation apparatus, comprising: The first determining module is used to determine at least one task to be executed by the test simulator used to simulate the target application and a sequence of task path screenshots associated with each task to be executed; The second determining module is used to determine the target data structure of the test simulator based on the at least one task to be executed; The first determining module is used to construct the page structure tree of the test simulator based on the interface structure information of the target application and the at least one task to be executed. The first generation module is used to generate the target source code of the test simulator through an intelligent agent based on the page structure tree, the at least one task to be executed, the target data structure, and the task path screenshot sequence associated with each task to be executed. The compilation module is used to compile the target source code to generate the test simulator.

[0006] A third aspect of this disclosure provides a computer-readable storage medium storing a computer program for executing the test simulator generation method described in the first aspect above.

[0007] A fourth aspect of this disclosure provides an electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the test simulator generation method described in the first aspect above.

[0008] A fifth aspect of this disclosure provides a computer program product that, when executed by an instruction processor, performs the test simulator generation method proposed in the first aspect of this disclosure.

[0009] The technical solution provided in this disclosure, after determining at least one task to be executed on a test simulator simulating a real commercial application and screenshots of the task paths associated with each task, firstly determines the data structure required by the test simulator to implement the at least one task to be executed based on the at least one task to be executed, and constructs the page structure tree of the test simulator based on the interface structure information of the real commercial application and the at least one task to be executed. Therefore, the interface layout of the test simulator is fixed while ensuring the authenticity of the page layout. Thus, based on at least one task to be executed and screenshots of the task paths associated with each task, the page structure tree, and the sequence of task path screenshots, the test simulator generated by the intelligent agent eliminates environmental uncertainties while ensuring the realism of the application, completely excluding random interference such as personalized recommendations, pop-up ads, and dynamic UI changes found in real commercial applications. In this way, by generating a controllable and reproducible test simulator to replace the real commercial application as the test environment, this solution can ensure the consistency of the test environment when the intelligent agent executes the same task at different times, thereby achieving accurate evaluation of the intelligent agent's capabilities. Attached Figure Description

[0010] Figure 1 This is a flowchart of the system architecture for building and evaluating a test simulator based on coded intelligent agents.

[0011] Figure 2This is a flowchart illustrating a test simulator generation method provided in an exemplary embodiment of this disclosure.

[0012] Figure 3 This is a flowchart illustrating a test simulator generation method provided in another exemplary embodiment of this disclosure.

[0013] Figure 4 This is a flowchart illustrating a test simulator generation method provided in yet another exemplary embodiment of this disclosure.

[0014] Figure 5 This is a flowchart illustrating a test simulator generation method provided in yet another exemplary embodiment of this disclosure.

[0015] Figure 6 This is a flowchart illustrating a test simulator generation method provided in another exemplary embodiment of this disclosure.

[0016] Figure 7 This is a flowchart illustrating a test simulator generation method provided in another exemplary embodiment of this disclosure.

[0017] Figure 8 This is a schematic diagram of the structure of a test simulator generation apparatus provided in an exemplary embodiment of this disclosure.

[0018] Figure 9 This is a structural diagram of an electronic device provided in an exemplary embodiment of this disclosure. Detailed Implementation

[0019] To explain this disclosure, exemplary embodiments of the disclosure will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the disclosure, and not all of them. It should be understood that the disclosure is not limited to exemplary embodiments.

[0020] It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps set forth in these embodiments do not limit the scope of this disclosure.

[0021] Application Overview Testing agents in real-world commercial applications, while realistic, is hampered by uncontrollable random factors. These include personalized recommendations, pop-up ads, and dynamic UI layout changes. This means that for the same task, the agent may encounter completely different interface states at different times or on different devices. Therefore, it's impossible to accurately evaluate an agent's capabilities in such variable testing environments. While using open-source or simplified applications as testing environments ensures controllability, their functional logic, UI complexity, and user scenarios differ significantly from mainstream real-world applications (such as social, shopping, and travel apps). This makes it difficult to effectively assess an agent's generalization ability and robustness in real, complex tasks.

[0022] Furthermore, developing a completely new high-fidelity simulation application or labeling a large amount of task data from real-world applications requires a significant investment of professional developers and testers, resulting in long development cycles and high costs, which hinders the rapid iteration of large-scale, diverse benchmarks.

[0023] Therefore, how to provide reproducible testing environments for intelligent agents to improve the accuracy of agent evaluation has become an urgent problem to be solved.

[0024] Based on the aforementioned problems, the technical solution provided in this disclosure, after determining at least one task to be executed on a test simulator simulating a real commercial application and screenshots of the task paths associated with each task, firstly determines the data structure required by the test simulator to implement the at least one task to be executed based on the at least one task to be executed, and constructs the page structure tree of the test simulator based on the interface structure information of the real commercial application and the at least one task to be executed. Therefore, the interface layout of the test simulator is fixed while ensuring the authenticity of the page layout. Thus, based on at least one task to be executed and screenshots of the task paths associated with each task, the page structure tree, and the sequence of task path screenshots, the test simulator generated by the intelligent agent eliminates environmental uncertainties while ensuring the realism of the application, completely excluding random interference such as personalized recommendations, pop-up ads, and dynamic UI changes found in real commercial applications. In this way, by generating a controllable and reproducible test simulator to replace the real commercial application as the test environment, this solution can ensure the consistency of the test environment when the intelligent agent executes the same task at different times, thereby achieving accurate evaluation of the intelligent agent's capabilities.

[0025] Furthermore, automation enables the rapid generation of high-quality test simulators, facilitating rapid iteration. This improves the efficiency of test simulator builds and significantly lowers the barrier to entry for benchmark building.

[0026] Exemplary System Figure 1This is a flowchart illustrating the system architecture for constructing and evaluating a test simulator based on coded intelligent agents, provided in an exemplary embodiment of this disclosure. Figure 1 As shown, the test simulator is built and evaluated through three stages: task building, test simulator building, and automated evaluation.

[0027] Phase 1, Task Construction: such as Figure 1 As shown, high-frequency task scenarios are constructed by analyzing real-world applications.

[0028] Phase Two, Test Simulator Construction: (e.g.) Figure 1 As shown, the target data structure can be determined based on high-frequency task scenarios, and the corresponding page structure tree and task screenshot sequence can be determined accordingly. Then, the assisted development capabilities of the coding agent can be utilized; that is, based on the target data structure, page structure tree, task screenshot sequence, and high-frequency task scenarios, the coding agent can generate the source code for the test simulator. Furthermore, the generated source code can be manually reviewed, and based on the feedback from the review, the coding agent can revise the source code to obtain iteratively updated source code. Instrumentation can also be performed on the test simulator's source code, and then the instrumented source code can be compiled to generate the test simulator.

[0029] Phase 3, Automated Evaluation: such as Figure 1 As shown, the test simulator and the tasks constructed above can be loaded first, and then the task can be executed on the test simulator by the agent to be evaluated. By executing the evaluation script, the system status after the task is executed can be obtained, and the system status after the task is executed can be matched with the preset status to determine whether the task is executed successfully. Finally, the evaluation result is output.

[0030] For a detailed description of the above embodiments, please refer to the relevant explanations in the following method embodiments. The embodiments disclosed herein will not be repeated here.

[0031] The technical solution provided in this disclosure, after determining at least one task to be executed on a test simulator simulating a real commercial application and screenshots of the task paths associated with each task, firstly determines the data structure required by the test simulator to implement the at least one task to be executed based on the at least one task to be executed, and constructs the page structure tree of the test simulator based on the interface structure information of the real commercial application and the at least one task to be executed. Therefore, the interface layout of the test simulator is fixed while ensuring the authenticity of the page layout. Thus, based on at least one task to be executed and screenshots of the task paths associated with each task, the page structure tree, and the sequence of task path screenshots, the test simulator generated by the intelligent agent eliminates environmental uncertainties while ensuring the realism of the application, completely excluding random interference such as personalized recommendations, pop-up ads, and dynamic UI changes found in real commercial applications. In this way, by generating a controllable and reproducible test simulator to replace the real commercial application as the test environment, this solution can ensure the consistency of the test environment when the intelligent agent executes the same task at different times, thereby achieving accurate evaluation of the intelligent agent's capabilities.

[0032] Moreover, the evaluation mechanism in the above scheme does not rely on a fixed path, but judges whether the task is successful by verifying the change of system state, thereby ensuring that the evaluation results can accurately reflect the agent's task completion ability, rather than its path selection preference.

[0033] Exemplary methods Figure 2 This is a schematic flowchart illustrating a test simulator generation method provided in an exemplary embodiment of this disclosure. This embodiment can be applied to an electronic device or its processor. Figure 2 As shown, the method may include the following steps: Step 201: Determine at least one task to be executed in the test simulator used to simulate the target application and a sequence of task path screenshots associated with each task to be executed.

[0034] In some examples, the target application mentioned above refers to a real-world commercial application, such as a shopping application, a social application, or other types of applications. This disclosure does not limit this. The task to be executed refers to the specific operational goal that the agent needs to complete in the test simulator, such as "searching for and purchasing a specified product" in a shopping application or "posting a status update containing a picture" in a social application. The task path screenshot sequence mentioned above refers to a collection of screenshots of a series of key interfaces experienced from the starting interface to the final completion interface during the completion of the task to be executed. These screenshots reconstruct the task execution path and the interface state corresponding to each step. For example, for the task of "searching for and purchasing a specified product," its task path screenshot sequence may include: a screenshot of the application homepage, a screenshot of the search results page after entering keywords in the search box, a screenshot of the product details page, a screenshot of the shopping cart confirmation page, a screenshot of the checkout page, and a screenshot of the payment success page. Determining the task to be executed and the task path screenshot sequence is the foundation for building the test simulator, providing a target and basis for the subsequent construction of the page structure tree and the generation of the target source code.

[0035] In some embodiments, the at least one task to be executed may be pre-generated or generated in real time based on user interaction sample data. If the at least one task to be executed is pre-generated, it can be directly retrieved from the storage location of the at least one task to be executed. See the detailed description in the following embodiments for further details.

[0036] For example, the task to be performed can be of various types. For instance, a navigation task could be used to evaluate the agent's understanding of the application's internal structure, navigation hierarchy, and UI semantics, such as requiring it to find an option hidden deep within a settings menu. Another example is a reasoning task used to evaluate the agent's ability to perform multi-step reasoning, involving numerical calculations, conditional judgments, and information integration, such as requiring it to "calculate last month's total bill expenditure."

[0037] In some embodiments, one possible approach is for testers to manually operate the target application to complete different tasks, capturing interface images according to preset rules during the operation to obtain the corresponding task path screenshot sequence. Another possible approach is to utilize automated scripting tools, pre-setting the operation flow for different tasks, driving the target application to automatically execute tasks, and automatically capturing interface screenshots at each key node during execution, thereby generating the task path screenshot sequence. After collecting the task path screenshot sequences using either of these methods, they can be pre-stored in a local cache or on a designated server. When a test simulator needs to be generated, the task path screenshot sequence related to each task can be directly retrieved from the local cache based on the identifier of each task, or a request can be made to a designated server to obtain the task path screenshot sequence related to each task. Furthermore, the task path screenshot sequence related to each task can also be directly extracted from the user behavior analysis data of the target application based on the identifier of each task.

[0038] Step 202: Determine the target data structure of the test simulator based on at least one task to be executed.

[0039] In some embodiments, the target data structure refers to the set of key entity classes and their attribute fields obtained by analyzing at least one task to be executed, identifying at least one core object of the task, abstracting the core object into an entity class, and defining attribute fields for it. Subsequently, the set of key entity classes and their attribute fields included in the target data structure can be stored, queried, and associated in the database through database table structure, field types, relational constraints, record data, etc., thus obtaining the backend data model corresponding to each core object. Here, the entity class refers to the typed representation of the core object involved in the task to be executed, and the attribute fields are the key data characteristics used to define the entity class.

[0040] For example, suppose the task to be performed is "send a message to Zhang San that the meeting will be at 3 pm". The core objects of this task are "contact" (Zhang San) and "message" (message content). Therefore, we can abstract two entity classes: Contact and Message. The key data used to identify the contact (Zhang San) are name and avatar. The key data used to complete the message sending includes sender, receiver, content and time. The resulting target data structure can include: a Contact class, whose attributes can include name and avatar; and a Message class, whose attributes can include sender, receiver, message content and message sending time.

[0041] For example, suppose the task to be performed is "find 'Huawei mobile phone' and 'Xiaomi mobile phone' and determine which one is more expensive". The core object of this task is "product" (Huawei mobile phone, Xiaomi mobile phone). Therefore, a Product entity class can be abstracted. The key data used for searching and comparing prices includes name, price and product information. The resulting target data structure can include the Product class, whose attributes can include name, price and product description, and several product instances are pre-defined.

[0042] In constructing entity classes, the principle of simplicity is followed, retaining only key entities and attributes directly related to each task to be executed, omitting or simplifying irrelevant fields. For example, for the simulated user class (User), if the task to be executed only involves user identification and basic display information, then necessary fields such as username and avatar are retained, while other fields unrelated to the current task, such as last login time and device information, are omitted. This significantly reduces the development complexity and data processing burden of the test simulator while ensuring normal functionality.

[0043] Step 203: Based on the target application's interface structure information and at least one task to be executed, construct the page structure tree of the test simulator.

[0044] In some examples, the interface structure information of the target application may include the layout information of the main interface, interface elements, control types, attribute parameters, etc. One possible approach, in developer mode, is to utilize the target application's interface to obtain the layout information, control types, and attribute parameters (e.g., size, position, text content, interactive response events, etc.) of the interface elements. Another possible approach is to decompile the target application's installation package (APK, IPA, etc.) and extract the interface structure information from the resource files, including the constituent elements of each page, the relative positions of the elements, and resource references. Of course, other methods can also be used to obtain the target application's interface structure information, and this disclosure does not limit this approach. After obtaining the target application's interface structure information, it can be stored in a local cache or on a designated server. When a test simulator needs to be generated, the target application's interface structure information can be directly obtained from the local cache, or a request can be sent to a designated server to obtain the target application's interface structure information.

[0045] In some embodiments, the interface structure information of the target application can be deeply analyzed as described above to identify the core elements constituting the interface, such as buttons, input boxes, lists, and images, and to clarify the types, attribute information, and hierarchical relationships of these elements within the interface. For at least one task to be executed, the key interfaces involved in the execution of each task and the navigation logic between interfaces are analyzed. Based on the above analysis information, a page structure tree is constructed in the form of a tree. The root node of the tree can be the application's homepage or starting interface, the first-level child nodes are the main functional pages that can be directly accessed from the homepage, the second-level child nodes are the subpages under each main functional page, and so on. Under each page node, the sub-interface element nodes contained in that page are further attached, thus forming a hierarchical page structure tree. In this way, the above page structure tree clearly shows the navigation relationships between different interfaces. Through this page structure tree, the interface layout and navigation relationships of the target application can be fixed in a structured way, providing a clear interface framework guide for the subsequent generation of the target source code of the test simulator, ensuring that the interface of the test simulator is highly consistent with the real target application in terms of layout and navigation logic.

[0046] For example, suppose the task to be performed is "to send a message to Zhang San on the XX instant messaging application." When simulating the XX instant messaging application, the interface structure information can be used to identify elements in the bottom navigation bar of the homepage such as "XX," "Contacts," "Discover," and "Me," as well as core elements in the "Contacts" page such as the "Contact List" and "Search Box." Based on this task, the key interfaces involved include the homepage, the Contacts page, and Zhang San's chat interface. The interface navigation logic is: Homepage → Contacts page (achieved by clicking "Contacts" in the bottom navigation bar) → Zhang San's chat interface (achieved by clicking "Zhang San" in the contact list). In this way, the target application can be divided into four main tabs: "Chat," "Contacts," "Discover," and "Me." When constructing the page structure tree, the root node is the XX application homepage. Under the homepage node are first-level nodes, including "XX," "Contacts," "Discover," and "Me." Under the "Contacts" node are the "Search Box" and "Contact List" nodes. Under the "Contact List" node are further contact nodes such as "Zhang San." Clicking the "Zhang San" node redirects to the corresponding chat interface node. Under the chat interface node are sub-interface element nodes such as "Message Input Box" and "Send Button," thus defining the subpages and interaction paths under the main tabs. The above page structure tree fully reproduces the interface hierarchy and element relationships required to complete the task of "sending a message to Zhang San."

[0047] Step 204: Based on the page structure tree, at least one task to be executed and the target data structure, as well as the sequence of task path screenshots associated with each task to be executed, generate the target source code of the test simulator through the agent.

[0048] In some examples, the aforementioned agent is one that has been trained on a large amount of code data and possesses powerful code generation capabilities. This agent can be a coding agent, or other artificial intelligence systems based on Large Language Models (LLMs), or a specific model that has undergone reinforcement learning.

[0049] In some embodiments, a page structure tree, at least one task to be executed, a target data structure, and a sequence of task path screenshots can be passed as input information to the agent. Upon receiving the input information, the agent performs in-depth analysis of the task to be executed, the page structure tree, the task path screenshot sequence, and the target data structure. First, based on the task to be executed, the agent clarifies the core logic and functional modules that the code needs to implement; and combined with the page structure tree, it understands the composition of the test simulator's interface elements, hierarchical relationships, and the attributes of each element to accurately simulate the interactive behavior of a real application page. The task path screenshot sequence provides the specific flow of task execution and the jump relationships between different interfaces, enabling the agent to clearly grasp the steps of user operations and the corresponding interface feedback, thereby implementing corresponding flow control and interface switching in the code. The injection of the target data structure ensures that the code generated by the coding agent contains the key field information that needs to be constructed when implementing the function of each task to be executed. After the agent fully understands the above key information, it can use any programming language it is proficient in to transform the business logic into specific code statements, generating the complete target source code of the test simulator.

[0050] In some embodiments, step 204 may specifically include: generating the front-end source code of the test simulator through an intelligent agent based on the page structure tree, at least one task to be executed, a target data structure, and a sequence of task path screenshots associated with each task to be executed; or, generating both the front-end and back-end source code of the test simulator through an intelligent agent. The target source code includes the front-end source code, or the target source code includes both the front-end and back-end source code.

[0051] In some examples, the aforementioned front-end source code may include, but is not limited to: UI page layout, such as using Extensible Markup Language (XML), a composition framework (Jetpack Compose), a user interface framework (SwiftUI), etc., control binding and navigation logic between pages, and basic front-end behavior, etc.

[0052] In some examples, the aforementioned backend source code may include, but is not limited to: data storage and management modules, interface simulation and interaction logic, business logic and state management, data validation and exception handling, and auxiliary tools and extension capabilities.

[0053] Based on the above embodiments, under the premise of providing a reproducible test environment for intelligent agent evaluation, the first method only generates the front-end source code of the test simulator, which can simplify the amount of code and improve the code generation efficiency; the second method generates both the front-end and back-end source code of the test simulator, which can more comprehensively reproduce the complete functional logic of the real application, including data storage, query and interaction, thereby providing a test environment closer to the real scenario for intelligent agent evaluation.

[0054] Step 205: Compile the target source code to generate a test simulator.

[0055] In some embodiments, a suitable compiler can be selected based on the programming language type of the target source code. The compiler then performs syntax checking, semantic analysis, and code optimization on the target source code. The compiler is then used to compile the target source code in a preset compilation environment to generate an executable file. This executable file serves as a test simulator capable of simulating the target application's interface and interaction logic. After compilation, the resulting test simulator can run independently in the corresponding operating system environment, providing a consistent and controllable testing platform for subsequent evaluation of the intelligent agent.

[0056] The technical solution provided in this disclosure, after determining at least one task to be executed on a test simulator simulating a real commercial application and screenshots of the task paths associated with each task, firstly determines the data structure required by the test simulator to implement the at least one task to be executed based on the at least one task to be executed, and constructs the page structure tree of the test simulator based on the interface structure information of the real commercial application and the at least one task to be executed. Therefore, the interface layout of the test simulator is fixed while ensuring the authenticity of the page layout. Thus, based on at least one task to be executed and screenshots of the task paths associated with each task, the page structure tree, and the sequence of task path screenshots, the test simulator generated by the intelligent agent eliminates environmental uncertainties while ensuring the realism of the application, completely excluding random interference such as personalized recommendations, pop-up ads, and dynamic UI changes found in real commercial applications. In this way, by generating a controllable and reproducible test simulator to replace the real commercial application as the test environment, this solution can ensure the consistency of the test environment when the intelligent agent executes the same task at different times, thereby achieving accurate evaluation of the intelligent agent's capabilities.

[0057] In some embodiments, when the agent is a coded agent; such as Figure 3 As shown above, in the above Figure 2 Based on the illustrated embodiment, step 204 above may include the following steps: Step 2041: Generate target prompt words based on the page structure tree, at least one task to be executed and the target data structure, and the sequence of task path screenshots associated with each task to be executed.

[0058] The coding agent possesses powerful natural language understanding and code generation capabilities, accurately grasping the development requirements of the test simulator based on input prompts. This coding agent can be a large language model trained on extensive code data, such as Claude or a Generative Pre-trained Transformer 4 (GPT-4) model. It not only understands complex business logic and interface interaction requirements but also proficiently uses multiple programming languages ​​(such as Python, Java, and JavaScript) to write code. In other words, the coding agent can be viewed as a large language model with powerful code generation capabilities.

[0059] In some embodiments, when the aforementioned agent is a coding agent, a structured, task-oriented target prompt can be pre-generated for the coding agent to guide it in fully understanding the requirements and generating target source code that meets the requirements. This target prompt not only needs to meet the requirements of natural language description but must also incorporate four key pieces of information: 1) at least one formalized task to be executed, clearly defining the functionality that the test simulator needs to implement; 2) a page structure tree; 3) a sequence of task path screenshots related to each task to be executed; and 4) the target data structure. These four key pieces of information provide the coding agent with all the semantic and structural constraints required for code generation.

[0060] In some embodiments, after obtaining the page structure tree, at least one task to be executed, the target data structure, and the sequence of task path screenshots associated with each task to be executed, the above four key pieces of information can be organically integrated with the structured template based on a preset structured template, and a combination of natural language and formal description can be used to generate target prompt words. The target prompt words may include one prompt word, or multiple prompt words, with one prompt word corresponding to each task to be executed.

[0061] In some embodiments, the number of at least one task to be executed can be one or more. When only one task is included, only one prompt word is generated based on the page structure tree, the task to be executed, the target data structure, and the sequence of task path screenshots associated with that task. When multiple tasks are included, only one prompt word is generated based on the page structure tree, the multiple tasks to be executed, the target data structure, and the sequence of task path screenshots associated with each task; that is, the prompt word is a prompt word that integrates all tasks; or, multiple prompt words are generated, with one prompt word corresponding to each task to be executed.

[0062] Step 2042: Based on the target prompt words, guide the coding agent to generate the target source code.

[0063] In some embodiments, target prompts can be input into the coding agent. Upon receiving the target prompts, the coding agent performs in-depth analysis of the tasks to be executed, page structure tree, task path screenshot sequence, and target data structure contained therein. First, based on the formal definition of the tasks to be executed in the target prompts, the coding agent clarifies the core logic and functional modules that the code needs to implement. Next, combined with the page structure tree, it understands the composition, hierarchical relationship, and attributes of the interface elements of the test simulator. This helps the coding agent accurately simulate the interactive behavior of the page when generating code. The task path screenshot sequence provides the coding agent with the specific flow of task execution and the jump relationship between different interfaces, enabling it to clearly grasp the steps of user operation and the corresponding interface feedback, thereby implementing the corresponding flow control and interface switching in the code. The injection of the target data structure ensures that the code generated by the coding agent contains the key field information that needs to be constructed when implementing the function of each task to be executed. After the coding agent fully understands the above key information, it can use any programming language it is proficient in, such as Python, Java, JavaScript, etc., to transform business logic into specific code statements and build the complete front-end target source code of the test simulator, guided by prompts.

[0064] In other embodiments, step 2042 may specifically include: in response to the target prompt word including a first prompt word corresponding to a first task to be executed, guiding the coding agent to generate a first source code corresponding to the first task to be executed based on the first prompt word; in response to the target prompt word also including a second prompt word corresponding to a second task to be executed, guiding the coding agent to update the first source code based on the second prompt word, generating a second source code corresponding to the first task to be executed and the second task to be executed; and generating the target source code based on the second source code.

[0065] In some embodiments, if only the first task to be executed and the second task to be executed are included, that is, the target prompt word only includes the first prompt word and the second prompt word, then the obtained second source code is used as the target source code; if other tasks to be executed are also included, that is, the target prompt word also includes prompt words corresponding to other tasks to be executed, then based on the second source code and the prompt words corresponding to other tasks to be executed, the final target source code is generated by the coding agent in the manner described above.

[0066] When the target prompt word integrates all tasks, the coding agent can generate target source code containing the functionality of all tasks to be executed in one go, based on this target prompt word. When the target prompt word includes a prompt word corresponding to each task to be executed, one prompt word can be input into the coding agent to generate source code with one sub-function. Another prompt word can be input, and based on this, source code with two sub-functions can be generated. This process continues, gradually building up the target source code to implement all sub-functions by inputting prompt words corresponding to each task to be executed. For example, when multiple tasks to be executed have sequential execution logic, basic code can be generated first based on the prompt word of the corresponding preceding task, and then extended and developed based on the prompt words of subsequent tasks on the existing code framework to generate the complete target source code.

[0067] Based on the above embodiments, since target prompts can be generated based on the page structure tree, at least one task to be executed and the target data structure, as well as the sequence of task path screenshots related to each task to be executed, and the target prompts can guide the coding agent to generate target source code, the core requirements of the test simulator can be accurately conveyed to the coding agent through prompts. This not only realizes the automated generation of the target source code of the test simulator, but also makes the target source code more accurate and in line with the requirements.

[0068] In some embodiments, such as Figure 4 As shown above, in the above Figure 2 Based on the illustrated embodiment, before step 205 above, step 206 may also be included; correspondingly, step 205 above can be implemented by step 2051 below.

[0069] Step 206: Instrument the target source code to inject logging code into the target source code, and obtain the instrumented target source code.

[0070] The logging code is used to record changes in system state.

[0071] In some examples, pre-designed logging code can be obtained first, and then tools can be used to insert pre-formatted logging code snippets into key logic nodes of the target source code (such as page switching trigger points, user input response functions, data loading completion events, etc.) to obtain the instrumented target source code.

[0072] For example, in the page navigation function of the target source code, insert logging code to record the current page identifier, the target page identifier, and the navigation timestamp; in the button click event handling function of the target source code, add logging code to record the button ID (e.g., the send button), the click coordinates, and the context parameters when triggered.

[0073] In some embodiments, the above logging code records system state changes in real time during the test simulator operation. System state changes may include system state changes after each interaction operation, or only system state changes after the last interaction operation is completed; and outputs them to a specified log file in a structured format.

[0074] For example, when simulating sending messages in an instant messaging application, the logging code will record the message content in a local chat log file chat_log.txt after the message is successfully sent; when simulating an e-commerce application, it will track every change in the order status (such as "pending payment", "paid", "shipped") and record the status in the log file, which helps with subsequent status monitoring and result verification.

[0075] Step 2051: Compile the instrumented target source code to generate a test simulator.

[0076] The compilation of the target source code can be referred to the above embodiments and related technologies, and will not be repeated here.

[0077] Based on the above embodiments, since the target source code can be instrumented first to inject logging code, resulting in instrumented target source code, and then compiled to generate a test simulator, system state changes can be recorded through logging code when the test simulator executes tasks. This generates structured trajectories that can be audited by the automated evaluation system, providing detailed and structured behavioral trajectory data for agent evaluation, which helps ensure the accuracy and absolute controllability of agent assessment. Simultaneously, when the agent exhibits abnormal behavior or task failure, the cause of the problem can be quickly located, providing strong evidence for agent optimization and iteration.

[0078] In some embodiments, such as Figure 5 As shown above, in the above Figure 2Based on the illustrated embodiment, step 204 above may further include the following steps: Step 2043: Receive the correction instructions for the target source code.

[0079] To ensure the reliability of the target source code used to generate the simulation tester, developers can perform rapid functional and logical verification on the target source code to achieve iterative correction. Specifically, after generating the target source code for the simulation tester through an intelligent agent, developers can execute the target source code, identify behaviors that do not conform to expectations (such as invalid buttons or incorrect navigation), and then provide feedback on corrections in natural language to the intelligent agent that generated the target source code. Users can input correction instructions, which can be specific text descriptions, image-type descriptions, or other types of descriptive information. These instructions can include the object to be corrected, the content to be corrected, the scope of the correction, and constraints. Of course, when the intelligent agent used to generate the target source code is a coding agent, the above correction instructions can be text descriptions.

[0080] For example, let's take a correction instruction as a text description. A correction instruction could be something like "Fix the issue of the 'Add to Cart' button on the product details page not responding" or "Adjust the homepage carousel switching logic to make it play in a specified order."

[0081] Step 2044: In response to the correction instruction, based on the correction indication carried by the correction instruction, the target source code is corrected by the agent to obtain the iterative target source code.

[0082] In some examples, the above correction instructions may include: the object to be corrected, the content of the correction, the scope of the correction, and constraints.

[0083] In some embodiments, when the correction instruction is a text description, the agent can perform semantic understanding of the correction indication carried by the correction instruction. Alternatively, when the correction instruction is a non-text description, such as image-type description information or other types of description information, the non-text description can be converted into a text description first, and then the correction indication carried by the converted correction instruction can be semantically understood. This clarifies the code modules and specific logic in the target source code that need to be modified, and then the target source code can be adjusted and optimized in a targeted manner to generate target source code that better meets expectations. It should be noted that because the agent is strongly constrained by the data pattern and navigation tree, the consistency and reliability of its code generation are significantly improved. Therefore, problems such as inconsistent states or UI structure illusions are avoided during the correction of the target source code.

[0084] Based on the above embodiments, since it can receive correction instructions for the target source code and, in response to these instructions, correct the target source code through an intelligent agent based on the correction indications carried by the correction instructions, obtain iterative target source code. Therefore, through this human-machine collaborative approach, a rapid "AI development - human verification" iterative closed loop is formed, effectively improving the quality and accuracy of the target source code and shortening the development cycle of the test simulator. Simultaneously, this iterative correction mechanism also enables the test simulator to better adapt to functional updates or interface changes in the target application. When the business processes, interface layouts, etc., of the target application are adjusted, developers can input new correction instructions to guide the intelligent agent to update the target source code of the existing test simulator, ensuring that the test simulator always remains consistent with the latest state of the target application, thereby continuously providing effective testing environment support for the evaluation of the intelligent agent.

[0085] In some embodiments, such as Figure 6 As shown above, in the above Figure 2 Based on the illustrated embodiment, step 201 above may include step 2011, or may include steps 2012 and 2013: Step 2011: In response to the fact that multiple tasks to be executed, including the target application, are pre-stored in the cloud, at least one task to be executed is obtained from the multiple tasks to be executed stored in the cloud.

[0086] In some examples, based on at least one real-world application (such as high-frequency applications like social media, e-commerce, and travel apps), interaction sample data of typical users in these applications is first collected through interviews and user surveys, such as "sending a message to a colleague" or "searching for and purchasing an item." To ensure that task instructions are natural, unambiguous, and clearly interpretable by machines, human experts can manually rewrite and semantically normalize the collected interaction sample data to design a series of tasks that reflect real user intentions and interactive behaviors. Simultaneously, to evaluate deeper capabilities of the intelligent agent, unconventional tasks can also be designed. Then, multiple tasks for at least one application are stored in the cloud. When an electronic device needs to generate a test simulator for the target application, it can access the cloud interface and, based on the target application's type tag or functional description, filter and retrieve at least one task matching the core functionality of the target application from the cloud. This approach allows for rapid reuse of existing task resources, improving the efficiency of test simulator generation.

[0087] Step 2012: Obtain user interaction sample data for the target application.

[0088] In some examples, user interaction sample data of the target application can be obtained through monitoring mechanisms or manual collection, and this data can be pre-stored in a local cache or on a designated server. When the user interaction sample data is stored in the local cache, it can be retrieved directly from the local cache. When the user interaction sample data is stored on a designated server, a data retrieval request can be sent to the server, carrying the unique identification information of the target application (such as the application package name, application ID, etc.). Upon receiving the request, the designated server retrieves the corresponding user interaction sample data from its database based on the unique identification information and returns the data to the electronic device. The user interaction sample data can include user operation records in the target application, such as clicks, inputs, and swipes; and can also include interface state information at the time of the operation, such as the position, attributes, and text content of interface elements.

[0089] Step 2013: Generate at least one task to be executed based on user interaction sample data.

[0090] In some examples, one possible approach is to analyze and process user interaction sample data based on a pre-trained large model to output at least one task to be executed; another possible approach is to analyze the user interaction sample data to extract key data, and then match the key data with a pre-built task template to generate at least one task to be executed.

[0091] Based on the above embodiments, when multiple tasks to be executed for at least one application, including the target application, are pre-stored in the cloud, at least one task to be executed can be obtained from the multiple tasks stored in the cloud. Therefore, this method can quickly reuse existing task resources and improve the efficiency of test simulator generation. Based on the obtained user interaction sample data of the target application, at least one task to be executed is generated. Therefore, this method can generate test tasks that closely match real user behavior, improving the realism and evaluation accuracy of the test simulator, while simultaneously reducing the cost of manually defining tasks, thus achieving automated task generation and improving test preparation efficiency.

[0092] In some embodiments, such as Figure 7 As shown above, in the above Figure 2 Based on the illustrated embodiments, the test simulator generation method provided in this disclosure may further include the following steps: Step 207: Load and run the test simulator.

[0093] In some embodiments, by executing a run command, the executable file of the test simulator compiled based on the target source code is loaded into memory and the runtime environment of the test simulator is initialized. The test simulator is then started, and the user interface of the test simulator is rendered and displayed based on the page structure tree, target data structure and task path screenshot sequence used when generating the target source code, and is in a ready state waiting for intelligent agent interaction.

[0094] Step 208: Invoke at least one pre-determined task to be executed.

[0095] In some embodiments, tasks can be selected sequentially from a task list containing at least one task to be executed, according to a preset invocation order (e.g., logical order, importance order, or random order). The task identifier, task description, and expected input / output requirements of the selected task are then passed to the test simulator. Furthermore, invocation parameters for the task can be specified via configuration files or user input, such as the number of times the task can be executed and specific conditions triggered during execution, to meet the needs of different testing scenarios.

[0096] For example, suppose at least one task to be executed includes "user registration", "product browsing", and "order payment". If the preset calling order is "user registration" → "product browsing" → "order payment", the test simulator first receives and parses the relevant information of the "user registration" task, providing the agent with the corresponding interface and data support to execute the task; after the "user registration" task is simulated, the "product browsing" task is called in the calling order, and so on, until the last "order payment" task is called.

[0097] Step 209: For each task to be executed, perform the corresponding interface interaction operation on the test simulator through the target intelligent agent to be evaluated.

[0098] In some examples, the target agent first perceives and analyzes the interface currently displayed by the test simulator. During runtime, the test simulator renders an interface highly similar to the target application based on a constructed page structure tree and a sequence of task path screenshots. The target agent uses image recognition technology (such as OCR text recognition) to identify various elements on the interface, including buttons, input boxes, text labels, drop-down menus, etc., and determines the position, type, and current state of these elements (e.g., whether they are clickable, whether they are active, etc.). Simultaneously, by combining data field information defined in the target data structure, the agent can understand the relationship between interface elements and data; for example, whether the data field corresponding to a certain input box is "username" or "password". Then, based on the description of the task to be executed, combined with its internal decision-making logic or trained model, the target agent plans a series of interaction steps required to complete the task. Finally, the target agent translates the planned interaction steps into specific operation instructions, which are precise down to the type of operation on the interface elements, such as click operations (the coordinates of a click operation are located to a specific button), input operations (entering preset or generated text data in a specified input box), selection operations (selecting a specific option from a drop-down menu), etc. Because the test simulator provides an interactive interface consistent with real applications, capable of receiving and responding to these operation commands, after the target agent executes each interactive operation, the test simulator updates the interface state and related data according to its built-in logic and target data structure, and feeds back the operation result to the target agent. The target agent then perceives the interface changes again to determine whether the current operation was successful and whether subsequent steps need to be adjusted. This process repeats until the target agent completes all interactive steps of the task to be executed, or terminates due to inability to continue execution. The aforementioned target agent can be a graphical user interface (GUI) agent.

[0099] For example, for the "user registration" task, the agent can plan a sequence of steps such as "click the register button → enter username → enter password → confirm password → click the submit button". Following this sequence of steps, the target agent can perform user interface interactions on the test simulator.

[0100] Step 210: Obtain the task execution result corresponding to each task after it has been completed.

[0101] In some embodiments, the task execution result may include at least the interface interaction trajectory data and system state change data generated by the target agent during task execution. The interface interaction trajectory data may include each step of the target agent's operation on the test simulator interface; the system state change data may include the system's initial state data at the start of the task and the system's final state data. For different types of tasks to be executed, the upload location of the task execution result is different; therefore, different methods can be used to obtain the task execution result corresponding to each task after completion. For details, please refer to the detailed description in the following embodiments.

[0102] In some embodiments, step 210 may specifically include: calling an evaluation script to obtain the task execution result corresponding to the completion of each task to be executed from the database.

[0103] In some examples, the database stores various data recorded and uploaded in real time by the test simulator during its operation, including but not limited to interface interaction trajectory data, initial system state data, and final system state data during the agent's task execution. After the target agent completes all interface interaction operations, the evaluation script can be started. Based on the task identifier or execution end time, the script can accurately extract the final system state data after the corresponding task is completed from the database (e.g., an order database), and then use this final system data as the task execution result. The evaluation script can be written in Python, Java, or other programming languages.

[0104] In other embodiments, step 210 may specifically include: in response to the target source code of the test simulator being injected with logging code for recording system changes, generating a log file based on the logging code; and calling the evaluation script to read the log file to obtain the task execution result corresponding to the completion of each task to be executed.

[0105] In some examples, where logging code for recording system changes is implanted into the target source code of the test simulator, the instrumented logging code will record detailed information such as each step of the target agent's operation, operation time, changes in the state of interface elements, and data interaction in real time throughout the entire process of the target agent performing interface interaction operations on the test simulator, generating a log file (e.g., chat_log.txt). After the target agent completes all interface interaction operations, the evaluation script can be started, and the corresponding task's log file can be read by calling the evaluation script according to the identifier of the task to be executed. The evaluation script can parse the structured data in the log file, extract the final system state data after the corresponding task is completed, and use this final system data as the task execution result.

[0106] Step 211: Based on the matching relationship between the execution result of each task and the corresponding preset execution result, the evaluation result of the target intelligent agent is obtained.

[0107] In some examples, the preset execution result for each task to be executed may include the target conditions that need to be achieved for the task to be executed successfully, and the target conditions may include one or more sets of states.

[0108] In some embodiments, step 211 above may specifically include: determining that the target agent has successfully executed the task in response to the matching relationship being the same as the preset execution result; or, determining that the target agent has failed to execute the task in response to the matching relationship being different from the preset execution result.

[0109] For example, suppose the task to be executed is "send a message to Zhang San saying 'Meeting at 3 PM'". The initial system data shows no messages related to Zhang San regarding this content. The preset execution result is that there should be one record in the log file with "Zhang San" as the receiver and "Meeting at 3 PM" as the content. For this task, after the target agent completes the interface interaction on the test simulator, the evaluation script can be called to read the generated log file (e.g., chat_history.db) and query the task execution result from the log file. Then, the task execution result is compared with the preset execution result. If the task execution result shows a log record "send a message to Zhang San saying 'Meeting at 3 PM'", meaning the task execution result is the same as the preset execution result, then it can be determined that the target agent executed the task successfully. If the task execution result does not show a log record "send a message to Zhang San saying 'Meeting at 3 PM'", meaning the task execution result is different from the preset execution result, then it can be determined that the target agent failed to execute the task.

[0110] Based on the above embodiments, after loading and running the test simulator, for each task to be executed, the target agent to be evaluated performs the corresponding interface interaction operation on the test simulator, and obtains the task execution result after each task is completed. Then, based on the matching relationship between each task execution result and the corresponding preset execution result, the evaluation result of the target agent is obtained. Since this scheme compares the obtained task execution result (i.e., the final system state data) with the preset execution result (i.e., the target condition), and determines whether the target agent has successfully executed the task based on the matching relationship between the two, this result-based evaluation strategy perfectly solves the "multi-path problem" regardless of the operation path the target agent uses. This provides an automated and reproducible task evaluation mechanism that does not rely on fixed operation paths. Thus, this evaluation mechanism accurately reflects the agent's task completion ability, rather than its path selection preference, helping to ensure the fairness and accuracy of the evaluation.

[0111] Exemplary device Figure 8 This is a schematic diagram of a test simulator generation apparatus provided as an exemplary embodiment of the present disclosure. The apparatus can be installed in electronic devices such as terminal devices and servers to execute the test simulator generation method of any of the above embodiments of the present disclosure.

[0112] like Figure 8 As shown, the aforementioned device 300 may include: a first determining module 301, configured to determine at least one task to be executed by the test simulator for simulating a target application and a sequence of task path screenshots associated with each task to be executed; a second determining module 302, configured to determine the target data structure of the test simulator based on the at least one task to be executed; a first constructing module 303, configured to construct a page structure tree of the test simulator based on the interface structure information of the target application and the at least one task to be executed; a code generation module 304, configured to generate the target source code of the test simulator through an intelligent agent based on the page structure tree, the at least one task to be executed, the target data structure, and the sequence of task path screenshots associated with each task to be executed; and a compilation generation module 305, configured to compile the target source code to generate the test simulator.

[0113] In one possible implementation, the agent is a coding agent; the code generation module 304 can be specifically used to: generate target prompt words based on the page structure tree, the at least one task to be executed, the target data structure, and the task path screenshot sequence associated with each task to be executed; and guide the coding agent to generate the target source code based on the target prompt words.

[0114] In one possible implementation, the code generation module 304 described above can be specifically used to: respond to the target prompt word including a first prompt word corresponding to a first task to be executed, guide the coding agent to generate a first source code corresponding to the first task to be executed based on the first prompt word; respond to the target prompt word also including a second prompt word corresponding to a second task to be executed, guide the coding agent to update the first source code based on the second prompt word, and generate a second source code corresponding to the first task to be executed and the second task to be executed; and generate the target source code based on the second source code.

[0115] In one possible implementation, the code generation module 304 described above can be specifically used to: generate the front-end source code of the test simulator through an intelligent agent based on the page structure tree, the at least one task to be executed, the target data structure, and the task path screenshot sequence associated with each task to be executed; or, generate the front-end source code and back-end source code of the test simulator through an intelligent agent; wherein the target source code includes the front-end source code, or the target source code includes the front-end source code and the back-end source code.

[0116] In one possible implementation, the above-mentioned device 300 may further include: a code insertion module, which can be used to instrument the target source code to inject logging code into the target source code to obtain the instrumented target source code; wherein the logging code is used to record system state changes; and a compilation generation module 305, which can be specifically used to compile the instrumented target source code to generate the test simulator.

[0117] In one possible implementation, the code generation module 304 described above can be specifically used to: receive a correction instruction for the target source code; and in response to the correction instruction, correct the target source code through the agent based on the correction indication carried by the correction instruction to obtain an iterated target source code.

[0118] In one possible implementation, the first determining module 301 described above may be specifically used to: in response to a plurality of tasks to be executed, including the target application, being pre-stored in the cloud, obtain the at least one task to be executed from the plurality of tasks to be executed stored in the cloud; or, obtain user interaction sample data of the target application; and generate the at least one task to be executed based on the user interaction sample data.

[0119] In one possible implementation, the device 300 may further include: a loading and running module for loading and running the test simulator; a first invocation module for invoking the at least one pre-determined task to be executed; an interface interaction module for performing corresponding interface interaction operations on the test simulator for each task to be executed through the target agent to be evaluated; a first acquisition module for acquiring the task execution result corresponding to the completion of each task to be executed; and a second acquisition module for obtaining the evaluation result of the target agent based on the matching relationship between each task execution result and the corresponding preset execution result.

[0120] In one possible implementation, the first acquisition module described above can be specifically used to: call the evaluation script to obtain the task execution result corresponding to the completion of each task to be executed from the database; or, in response to the target source code of the test simulator being injected with logging code for recording system changes, generate a log file based on the logging code; call the evaluation script to read the log file to obtain the task execution result corresponding to the completion of each task to be executed.

[0121] In one possible implementation, the second acquisition module described above can be specifically used to: determine that the target agent has successfully executed the task in response to the matching relationship indicating that the task execution result is the same as the preset execution result; or, determine that the target agent has failed to execute the task in response to the matching relationship indicating that the task execution result is different from the preset execution result.

[0122] The beneficial technical effects corresponding to the exemplary embodiments of this device can be found in the corresponding beneficial technical effects of the exemplary method section above, and will not be repeated here.

[0123] Exemplary electronic devices Figure 9 A structural diagram of an electronic device provided in an embodiment of this disclosure includes at least one processor 111 and a memory 112.

[0124] The processor 111 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 11 to perform desired functions.

[0125] The memory 112 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 111 may execute one or more computer program instructions to implement the test simulator generation methods and / or other desired functions of the various embodiments of this disclosure described above.

[0126] In one example, the electronic device 11 may also include an input device 113 and an output device 114, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).

[0127] The input device 113 may also include, for example, a keyboard, a mouse, etc.

[0128] The output device 114 can output various information to the outside, including, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.

[0129] Of course, for the sake of simplicity, Figure 9 Only some of the components of the electronic device 11 relevant to this disclosure are shown, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 11 may include any other suitable components depending on the specific application.

[0130] Exemplary computer program products and computer-readable storage media In addition to the methods and apparatus described above, embodiments of this disclosure may also provide a computer program product, including computer program instructions that, when executed by a processor, cause the processor to perform the steps in the test simulator generation methods of various embodiments of this disclosure described in the "Exemplary Methods" section above.

[0131] Computer program products can be written in any combination of one or more programming languages ​​to perform the operations of embodiments of this disclosure. These programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0132] Furthermore, embodiments of this disclosure may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps in the test simulator generation methods of various embodiments of this disclosure described in the "Exemplary Methods" section above.

[0133] Computer-readable storage media may take the form of any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, but is not limited to, systems, apparatuses, or devices that are electrical, magnetic, optical, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0134] The basic principles of this disclosure have been described above with reference to specific embodiments. However, the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.

[0135] Various modifications and variations can be made to this disclosure without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this disclosure and their equivalents, this disclosure is also intended to include such modifications and variations.

Claims

1. A method for generating a test simulator, comprising: Identify at least one task to be executed by the test simulator used to simulate the target application and a sequence of task path screenshots associated with each task to be executed; Based on the at least one task to be executed, determine the target data structure of the test simulator; Based on the interface structure information of the target application and the at least one task to be executed, construct the page structure tree of the test simulator; Based on the page structure tree, the at least one task to be executed, the target data structure, and the sequence of task path screenshots associated with each task to be executed, the target source code of the test simulator is generated by an intelligent agent; The target source code is compiled to generate the test simulator.

2. The method according to claim 1, wherein, The intelligent agent is a coded intelligent agent; the generation of the target source code for the test simulator by the intelligent agent based on the page structure tree, the at least one task to be executed, the target data structure, and the task path screenshot sequence associated with each task to be executed includes: Based on the page structure tree, the at least one task to be executed, the target data structure, and the sequence of task path screenshots associated with each task to be executed, a target prompt word is generated; Based on the target prompt, the coding agent is guided to generate the target source code.

3. The method according to claim 2, wherein, The step of guiding the coding agent to generate the target source code based on the target prompt word includes: In response to the target prompt word including a first prompt word corresponding to a first task to be executed, the coding agent is guided to generate the first source code corresponding to the first task to be executed based on the first prompt word; In response to the target prompt word, a second prompt word corresponding to the second task to be executed is also included. Based on the second prompt word, the coding agent is guided to update the first source code and generate the second source code corresponding to the first task to be executed and the second task to be executed. The target source code is generated based on the second source code.

4. The method according to claim 1, wherein, The process of generating the target source code of the test simulator through an intelligent agent, based on the page structure tree, the at least one task to be executed, the target data structure, and the sequence of task path screenshots associated with each task to be executed, includes: Based on the page structure tree, the at least one task to be executed, the target data structure, and the sequence of task path screenshots associated with each task to be executed, the front-end source code of the test simulator is generated by the agent, or the front-end source code and back-end source code of the test simulator are generated by the agent. The target source code includes the front-end source code, or the target source code includes both the front-end source code and the back-end source code.

5. The method according to claim 1, wherein, Before compiling the target source code to generate the test simulator, the process also includes: The target source code is instrumented to inject logging code into it, resulting in instrumented target source code; wherein the logging code is used to record system state changes. The step of compiling the target source code to generate the test simulator includes: The instrumented target source code is compiled to generate the test simulator.

6. The method according to claim 1, wherein, The process of generating the target source code for the test simulator through the agent, based on the page structure tree, the at least one task to be executed, the target data structure, and the sequence of task path screenshots associated with each task to be executed, includes: Receive correction instructions for the target source code; In response to the correction instruction, the target source code is corrected by the agent based on the correction indication carried by the correction instruction to obtain the iterative target source code.

7. The method according to claim 1, wherein, The determination of at least one task to be executed by the test simulator used to simulate the target application includes: In response to the fact that multiple tasks to be executed, including the target application, are pre-stored in the cloud, the at least one task to be executed is retrieved from the multiple tasks to be executed stored in the cloud; or, Obtain user interaction sample data of the target application; Based on the user interaction sample data, at least one task to be executed is generated.

8. The method according to any one of claims 1 to 7, further comprising: Load and run the test simulator; Invoke the at least one pre-determined task to be executed; For each task to be performed, the target intelligent agent to be evaluated performs the corresponding interface interaction operation on the test simulator; Get the execution result of each pending task after it is completed; Based on the matching relationship between the execution result of each task and the corresponding preset execution result, the evaluation result of the target intelligent agent is obtained.

9. The method according to claim 8, wherein, The step of obtaining the task execution result corresponding to the completion of each task to be executed includes: The evaluation script is invoked to retrieve the task execution result corresponding to the completion of each task from the database; or, In response to the fact that logging code for recording system changes is injected into the target source code of the test simulator, a log file is generated based on the logging code; The evaluation script is invoked to read the log file to obtain the task execution result corresponding to the completion of each task to be executed.

10. The method according to claim 8, wherein, The evaluation result of the target agent is obtained based on the matching relationship between the execution result of each task and the corresponding preset execution result, including: In response to the matching relationship indicating that the task execution result is the same as the preset execution result, it is determined that the target agent has successfully executed the task; or, In response to the matching relationship indicating that the task execution result is different from the preset execution result, it is determined that the target agent has failed to execute the task.

11. A test simulator generation apparatus, comprising: The first determining module is used to determine at least one task to be executed by the test simulator used to simulate the target application and a sequence of task path screenshots associated with each task to be executed; The second determining module is used to determine the target data structure of the test simulator based on the at least one task to be executed; The first construction module is used to construct the page structure tree of the test simulator based on the interface structure information of the target application and the at least one task to be executed. The code generation module is used to generate the target source code of the test simulator through an intelligent agent based on the page structure tree, the at least one task to be executed, the target data structure, and the task path screenshot sequence associated with each task to be executed. The compilation module is used to compile the target source code to generate the test simulator.

12. A computer-readable storage medium storing a computer program for performing the test simulator generation method according to any one of claims 1-10.

13. An electronic device, the electronic device comprising: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the test simulator generation method according to any one of claims 1-10.