Test data construction method, device, equipment, storage medium and program product

CN122963952APending Publication Date: 2026-10-23TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611105379.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-24
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

因此会出现造数需求频繁,且手动构造测试数据费时费力的情况

Benefits of technology

[0052]上述测试数据构造方法、装置、设备、存储介质和程序产品,获取用户基于测试任务输入的造数需求信息;若未从预先构建的存量造数能力库中检索到与造数需求信息功能匹配的目标存量造数能力项,则通过造数大模型确定造数需求信息所属的业务场景类型,并加载业务场景类型对应的专项能力工具;通过专项能力工具获取造数需求信息指示的脚本生成数据;从预先构建的存量造数脚本库中检索与造数需求信息语义相似的相似存量造数脚本;基于造数需求信息、脚本生成数据和相似存量造数脚本,生成目标造数脚本;调用目标造数脚本执行造数操作,获得测试任务所需的测试数据。相较于传统的人工造数方式,本申请通过依托造数大模型与专项能力工具,实现测试数据的智能化按需生成。针对传统人工编写脚本成本高、效率低的痛点,本申请通过智能检索复用存量资产,并在无匹配项时自动适配业务场景、加载专属工具生成脚本,显著降低人力投入与重复劳动。同时,结合语义相似脚本辅助生成,提升脚本构建的准确性与泛化能力,最终实现测试数据的快速、精准产出,大幅缩短造数周期,全面提升软件迭代全生命周期中的测试准备效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122963952A_ABST
    Figure CN122963952A_ABST
Patent Text Reader

Abstract

The application relates to a test data construction method, device, equipment, storage medium and program product. The method comprises the following steps: obtaining number generation requirement information input by a user based on a test task; if a target inventory number generation capability item functionally matched with the number generation requirement information is not retrieved from a pre-constructed inventory number generation capability library, determining a business scenario type to which the number generation requirement information belongs through a number generation large model, and loading a special capability tool corresponding to the business scenario type; obtaining script generation data indicated by the number generation requirement information through the special capability tool; retrieving a similar inventory number generation script similar in semantics to the number generation requirement information from a pre-constructed inventory number generation script library; generating a target number generation script based on the number generation requirement information, the script generation data and the similar inventory number generation script; and calling the target number generation script to perform a number generation operation, so as to obtain test data required by the test task. The method can save labor cost and improve number generation efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of software testing and artificial intelligence technology, and in particular to a test data construction method, apparatus, device, storage medium and program product. Background Technology

[0002] The software iteration lifecycle involves multiple stages and various roles that require test data, such as development integration testing, verification testing, and product acceptance. This leads to frequent data generation needs, and manually constructing test data is time-consuming and labor-intensive. Traditional data generation methods primarily rely on manually writing data generation scripts, but this method is labor-intensive and inefficient. Summary of the Invention

[0003] Therefore, it is necessary to provide a test data construction method, apparatus, equipment, storage medium, and program product that can save labor costs and improve data generation efficiency in response to the above-mentioned technical problems.

[0004] Firstly, this application provides a method for constructing test data, the method comprising:

[0005] Obtain user data generation requirements based on test task input;

[0006] If no target existing data creation capability item matching the data creation requirement information function is found in the pre-built existing data creation capability library, the business scenario type to which the data creation requirement information belongs is determined through the data creation big model, and the special capability tool corresponding to the business scenario type is loaded.

[0007] The script generation data indicated by the data generation requirement information is obtained through the specialized capability tool;

[0008] Retrieve similar existing data creation scripts that are semantically similar to the data creation requirement information from a pre-built existing data creation script library;

[0009] Based on the data creation requirement information, the script generation data, and the similar existing data creation scripts, a target data creation script is generated.

[0010] The target data generation script is invoked to perform data generation operations and obtain the test data required for the test task.

[0011] In one embodiment, the existing data generation capability library includes an existing data generation script library for storing candidate existing data generation scripts, and an existing data generation tool library for storing candidate existing data generation tools; the method further includes:

[0012] If a target existing data creation script matching the data creation requirement information function is found in the existing data creation script library, or a target existing data creation tool matching the data creation requirement information function is found in the existing data creation tool library, then it is determined that a target existing data creation capability item matching the data creation requirement information function has been found in the existing data creation capability library; otherwise, it is determined that no target existing data creation capability item matching the data creation requirement information function has been found in the existing data creation capability library.

[0013] The target stock data creation capability item is either the target stock data creation script or the target stock data creation tool.

[0014] In one embodiment, the method further includes:

[0015] The target data generation script is stored in the existing data generation script library;

[0016] Identify the target functions marked with target decorators in the target data generation script;

[0017] The target function is registered to the model context protocol service of the large data model by the target decorator indicated by the target decorator mark, so as to obtain the target stock data creation tool that matches the data creation requirement information function, and the target stock data creation tool is stored in the stock data creation tool library.

[0018] Abstract syntax tree analysis is performed on the target data generation script to extract the call meta-information of the target function in the target data generation script, and the call meta-information is integrated into a structured specialized capability description file;

[0019] The specific capability description file is deployed to the skill directory of the data model to obtain the specific capability tools corresponding to the business scenario type, and the specific capability tools are stored.

[0020] In one embodiment, the method further includes:

[0021] If a target existing data creation capability item matching the data creation requirement information function has been retrieved from the pre-built existing data creation capability library, then the target existing data creation capability item is invoked to perform the data creation operation and obtain the test data required for the test task.

[0022] In one embodiment, if the business scenario type is a material generation type, then the script generation data includes the cloud storage location and access path of the multimedia file indicated by the data generation requirement information.

[0023] If the business scenario type is a database query type, then the script-generated data includes the table structure, fields, indexes, and data relationships of the data table indicated by the data generation requirement information;

[0024] If the business scenario type is an interface operation type, then the script-generated data includes the interface address and input / output parameter definition data of the business interface indicated by the data generation requirement information.

[0025] In one embodiment, generating a target data generation script based on the data generation requirement information, the script generation data, and the similar existing data generation scripts includes:

[0026] The data creation requirement information is compared with the similar existing data creation scripts to determine the functional differences between the data creation requirement information and the similar existing data creation scripts.

[0027] Identify the target lines of code in the similar stock data generation script that correspond to the functional differences;

[0028] Obtain a standardized script template pre-set for the aforementioned business scenario type;

[0029] Referring to the writing style of the target code line, modify the code area in the standardized script template related to the functional differences, and fill the variable placeholders in the standardized script template with the data generated by the script to generate the target data generation script.

[0030] In one embodiment, the step of invoking the target data generation script to perform data generation operations and obtain the test data required for the test task includes:

[0031] The target data generation script is invoked through the data generation model to perform data generation operations;

[0032] If the execution is successful, the test data required for the test task will be obtained;

[0033] If execution fails, an execution error message is obtained, and the target data generation script is repeatedly repaired and executed based on the execution error message using the data generation model until execution is successful, thereby obtaining the test data required for the test task.

[0034] In one embodiment, the method further includes:

[0035] Identify the target functions marked with target decorators in the target data generation script;

[0036] The target function is parsed by the target decorator indicated by the target decorator markup to obtain the page rendering metadata of the target function;

[0037] The page rendering metadata is integrated into a standardized JSON configuration file;

[0038] Based on the JSON configuration file, the front-end operation interface corresponding to the target data generation script is rendered and generated on the visualization operation page.

[0039] In one embodiment, the method further includes:

[0040] Extract script keywords from the JSON configuration file and construct a retrieval index for the target data generation script based on the script keywords;

[0041] In response to the user entering the script keywords on the visual operation page, the front-end operation interface corresponding to the target data generation script is located and displayed according to the search index;

[0042] Based on the aforementioned front-end operation interface, the target data generation script is invoked again to perform data generation operations and obtain the test data required for the test task.

[0043] Secondly, this application provides a test data construction apparatus, the apparatus comprising:

[0044] The acquisition module is used to acquire data generation requirements information input by the user based on the test task.

[0045] The loading module is used to determine the business scenario type of the data creation requirement information by means of the data creation big model if no target existing data creation capability item matching the data creation requirement information function is found in the pre-built existing data creation capability library, and to load the special capability tool corresponding to the business scenario type.

[0046] The acquisition module is also used to acquire script generation data indicated by the data generation requirement information through the specialized capability tool;

[0047] The retrieval module is used to retrieve similar existing data creation scripts that are semantically similar to the data creation requirement information from a pre-built existing data creation script library;

[0048] The generation module is used to generate a target data generation script based on the data generation requirement information, the script generation data, and the similar existing data generation scripts; and to call the target data generation script to perform data generation operations to obtain the test data required for the test task.

[0049] Thirdly, this application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the various method embodiments of this application.

[0050] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in the various method embodiments of this application.

[0051] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps in the various method embodiments of this application.

[0052] The aforementioned test data construction method, apparatus, equipment, storage medium, and program product acquire user-inputted data generation requirements based on the test task. If no target existing data generation capability item matching the data generation requirements is found in the pre-built existing data generation capability library, the business scenario type to which the data generation requirements belong is determined through the large-scale data generation model, and the corresponding specialized capability tool is loaded. The script generation data indicated by the data generation requirements is obtained through the specialized capability tool. Similar existing data generation scripts semantically similar to the data generation requirements are retrieved from the pre-built existing data generation script library. Based on the data generation requirements, script generation data, and similar existing data generation scripts, a target data generation script is generated. The target data generation script is called to execute the data generation operation, obtaining the test data required for the test task. Compared to traditional manual data generation methods, this application achieves intelligent on-demand generation of test data by relying on the large-scale data generation model and specialized capability tools. Addressing the pain points of high cost and low efficiency in traditional manual script writing, this application utilizes intelligent retrieval and reuse of existing assets. When no matching items are found, it automatically adapts to business scenarios and loads dedicated tools to generate scripts, significantly reducing human input and repetitive work. Simultaneously, by combining semantically similar scripts with script generation assistance, it improves the accuracy and generalization ability of script construction, ultimately achieving rapid and accurate output of test data, significantly shortening the data generation cycle, and comprehensively improving test preparation efficiency throughout the entire software iteration lifecycle. Attached Figure Description

[0053] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 This is a diagram illustrating the application environment of a test data construction method in one embodiment;

[0055] Figure 2 This is a flowchart illustrating a test data construction method in one embodiment;

[0056] Figure 3 This is a schematic diagram of the trigger selection process for the data generation path in one embodiment;

[0057] Figure 4 This is a schematic diagram illustrating the generation process of the target stock data creation tool and the special capability tool in one embodiment;

[0058] Figure 5 This is a flowchart illustrating the test data construction method in another embodiment;

[0059] Figure 6 This is a schematic diagram of the rendering process of the front-end operation interface in one embodiment;

[0060] Figure 7 This is a schematic diagram of a visual operation page in one embodiment;

[0061] Figure 8 Here is a system architecture diagram of a test data construction method in one embodiment;

[0062] Figure 9 This is a schematic diagram of an intelligent data generation platform for a test data construction method in one embodiment;

[0063] Figure 10 This is a schematic diagram illustrating the generation process of the target data generation script in one embodiment;

[0064] Figure 11 This is a schematic diagram illustrating the application process of the target data generation script in one embodiment.

[0065] Figure 12 This is a structural block diagram of a test data construction device in one embodiment;

[0066] Figure 13 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0067] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0068] The test data construction method provided in this application can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. The data storage system can be set up separately and can store the data that server 104 needs to process. The data storage system can be integrated into server 104 or placed in the cloud or on other servers. Terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, and in-vehicle terminals. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, cloud security, host security and other network security services, CDN, and basic cloud computing services such as big data and artificial intelligence platforms. Terminal 102 and server 104 can be directly or indirectly connected via wired or wireless communication, which is not limited herein.

[0069] Terminal 102 can obtain the data generation requirement information input by the user based on the test task. If no target existing data generation capability item matching the data generation requirement information is found in the pre-built existing data generation capability library, terminal 102 can determine the business scenario type to which the data generation requirement information belongs through the data generation big data model and load the special capability tool corresponding to the business scenario type. Terminal 102 can obtain the script generation data indicated by the data generation requirement information through the special capability tool. Terminal 102 can retrieve similar existing data generation scripts with semantic similarity to the data generation requirement information from the pre-built existing data generation script library. Terminal 102 can generate a target data generation script based on the data generation requirement information, script generation data, and similar existing data generation scripts. Terminal 102 can call the target data generation script to perform data generation operations and obtain the test data required for the test task. Terminal 102 can store the target data generation script and test data in server 104.

[0070] It is understood that this embodiment does not impose any limitations on this. Figure 1 The application scenarios shown are for illustrative purposes only and are not limited to these.

[0071] In one embodiment, such as Figure 2 As shown, a test data construction method is provided, which can be applied to a terminal, and includes the following steps:

[0072] Step 202: Obtain the data generation requirements information input by the user based on the test task.

[0073] Step 204: If no target existing data creation capability item matching the data creation requirement information function is found in the pre-built existing data creation capability library, the business scenario type to which the data creation requirement information belongs is determined through the data creation big model, and the special capability tool corresponding to the business scenario type is loaded.

[0074] The existing data creation capability library is a database used to store candidate existing data creation capability items. Functional matching refers to the objective capability of existing data creation capability items to achieve the same or equivalent data construction functions required by the data creation demand information. Specialized capability tools (Skill tools) refer to functional modules predefined for specific business scenarios that can be loaded and invoked by the large data creation model.

[0075] In one embodiment, the existing data generation capability library may include at least one of the following: an existing data generation script library for storing candidate existing data generation scripts, and an existing data generation tool library for storing candidate existing data generation tools (MCP tools). The target existing data generation capability item may be either a candidate existing data generation script or a candidate existing data generation tool. Here, MCP (Model Context Protocol) refers to the Model Context Protocol service.

[0076] In one embodiment, the business scenario type may include material generation type, database query type, and interface operation type. Material generation type refers to a script for constructing unstructured data (such as images, audio, video, PDF files, etc.); database query type refers to a script for constructing data to perform at least one of the operations of insert, update, and query on a database; and interface operation type refers to a script for constructing data to call an application programming interface (API) and obtain the returned data.

[0077] Step 206: Obtain script-generated data indicating the data generation requirements through specialized capability tools.

[0078] The script-generated data is the specific business information used to populate the variable placeholders in the newly generated data script.

[0079] Step 208: Retrieve similar existing data creation scripts that are semantically similar to the data creation requirement information from the pre-built existing data creation script library.

[0080] In one embodiment, the existing data generation script library stores the mapping relationship between existing data generation scripts and their script semantic features. The terminal can extract the demand semantic features of the data generation demand information, and retrieve script semantic features similar to the demand semantic features from the existing data generation script library. Then, the existing data generation scripts that have a mapping relationship with the retrieved script semantic features are identified as similar existing data generation scripts that are semantically similar to the data generation demand information.

[0081] Step 210: Generate the target data generation script based on the data generation requirement information, script generation data, and similar existing data generation scripts.

[0082] In one embodiment, the terminal can obtain a standardized script template pre-set for the business scenario type to which the data generation requirement information belongs. Using this standardized script template as the code skeleton, the terminal generates the target data generation script based on the script and by referring to similar existing data generation scripts. The generated script data is used to populate variable placeholders in the standardized script template.

[0083] Step 212: Call the target data generation script to perform data generation operations and obtain the test data required for the test task.

[0084] In the aforementioned test data construction method, the user's data generation requirement information based on the test task input is obtained. If no target existing data generation capability item matching the data generation requirement information is found in the pre-built existing data generation capability library, the business scenario type to which the data generation requirement information belongs is determined through the data generation big model, and the special capability tool corresponding to the business scenario type is loaded. The script generation data indicated by the data generation requirement information is obtained through the special capability tool. Similar existing data generation scripts with semantic similarity to the data generation requirement information are retrieved from the pre-built existing data generation script library. Based on the data generation requirement information, script generation data, and similar existing data generation scripts, a target data generation script is generated. The target data generation script is called to execute the data generation operation to obtain the test data required for the test task. Compared with the traditional manual data generation method, this application realizes intelligent on-demand generation of test data by relying on the data generation big model and special capability tools. Addressing the pain points of high cost and low efficiency of traditional manual script writing, this application reuses existing assets through intelligent retrieval and automatically adapts to the business scenario and loads special tools to generate scripts when no matching item is found, significantly reducing human input and repetitive labor. At the same time, by combining semantically similar scripts to assist in generation, the accuracy and generalization ability of script construction are improved, ultimately achieving rapid and accurate output of test data, significantly shortening the data generation cycle, and comprehensively improving the test preparation efficiency throughout the entire software iteration lifecycle.

[0085] In one embodiment, such as Figure 3 As shown, the existing data creation capability library includes an existing data creation script library for storing candidate existing data creation scripts and an existing data creation tool library for storing candidate existing data creation tools. The method further includes: if a target existing data creation script matching the data creation requirement information function is found in the existing data creation script library, or a target existing data creation tool matching the data creation requirement information function is found in the existing data creation tool library, then it is determined that a target existing data creation capability item matching the data creation requirement information function has been retrieved from the existing data creation capability library; otherwise, it is determined that no target existing data creation capability item matching the data creation requirement information function has been retrieved from the existing data creation capability library. Wherein, the target existing data creation capability item is a target existing data creation script or a target existing data creation tool.

[0086] It is understandable that as long as the target existing data creation capability item is found in either the existing data creation script library or the existing data creation tool library, it can be determined that a target existing data creation capability item matching the data creation requirement information function has been retrieved from the existing data creation capability library. If the target existing data creation capability item cannot be retrieved in either of these two channels, it is determined that a target existing data creation capability item matching the data creation requirement information function has not been retrieved from the existing data creation capability library.

[0087] In the above embodiments, by constructing a database of existing data generation capabilities that includes script libraries and tool libraries, a dual-track retrieval and intelligent reuse of data generation capabilities is achieved. When a matching existing script or tool is found, it can be directly invoked to avoid redundant development; if no match is found, large model generation is initiated to ensure full coverage. This mechanism maximizes the reuse of existing assets, reduces invalid data generation, significantly reduces labor costs, and improves the efficiency and flexibility of test data preparation.

[0088] In one embodiment, such as Figure 4 As shown, the method further includes: storing the target data generation script in the existing data generation script library; identifying the target function marked with a target decorator in the target data generation script; registering the target function to the model context protocol service of the large-scale data generation model through the target decorator indicated by the target decorator mark, so as to obtain the target existing data generation tool that matches the data generation requirement information function, and storing the target existing data generation tool in the existing data generation tool library; performing abstract syntax tree analysis on the target data generation script to extract the call meta-information of the target function in the target data generation script, and integrating the call meta-information into a structured special capability description file; deploying the special capability description file to the skill directory of the large-scale data generation model to obtain the special capability tool corresponding to the business scenario type, and storing the special capability tool.

[0089] Decorators are higher-order functions or syntactic sugar that can dynamically add extra functionality (such as registration, logging, permission verification, etc.) to a function without modifying its original code. In languages ​​like Python, they are used through the `@decorator` syntax. The call metadata includes at least one of the following: the target function's name, function description, parameter definitions, and calling method.

[0090] In the above embodiments, a closed loop from script generation to capability accumulation is constructed by automatically storing new scripts, registering new tools to the large model protocol service, and using syntax tree analysis to generate structured description files and deploy them to the skill catalog. This mechanism continuously expands the existing capability library, realizes the automated accumulation and intelligent updating of data assets, reduces redundant development, and significantly improves long-term data creation efficiency and system scalability.

[0091] In one embodiment, the method further includes: if a target existing data creation capability item matching the data creation requirement information function has been retrieved from the pre-built existing data creation capability library, then the target existing data creation capability item is invoked to perform a data creation operation to obtain the test data required for the test task.

[0092] Specifically, the terminal can obtain the data generation requirement information input by the user based on the test task, and attempt to retrieve a target existing data generation capability item that matches the data generation requirement information from a pre-built existing data generation capability library. If a target existing data generation capability item matching the data generation requirement information has been found from the existing existing data generation capability library, the target existing data generation capability item is invoked to perform the data generation operation and obtain the test data required for the test task. If no target existing data generation capability item matching the data generation requirement information has been found from the pre-built existing data generation capability library, the business scenario type to which the data generation requirement information belongs is determined through the data generation big data model, and the special capability tool corresponding to the business scenario type is loaded; the script generation data indicated by the data generation requirement information is obtained through the special capability tool; similar existing data generation scripts with semantic similarity to the data generation requirement information are retrieved from the pre-built existing data generation script library; a target data generation script is generated based on the data generation requirement information, script generation data, and similar existing data generation scripts; the target data generation script is invoked to perform the data generation operation and obtain the test data required for the test task.

[0093] In the above embodiments, when a matching target script or tool is retrieved, the data generation operation is directly invoked and executed, realizing the immediate reuse of existing data generation capabilities without the need for repeated writing or generation, thus significantly shortening the data generation time. This mechanism makes full use of existing assets, avoids waste of computing power and manpower, significantly improves the efficiency of test data acquisition, and ensures the rapid response requirements for test data at each stage of software iteration.

[0094] In one embodiment, if the business scenario type is material generation, the script-generated data includes the cloud storage location and access path of the multimedia file indicated by the data generation requirement information; if the business scenario type is database query, the script-generated data includes the table structure, fields, indexes, and data relationships of the data table indicated by the data generation requirement information; if the business scenario type is interface operation, the script-generated data includes the interface address and input / output parameter definition data of the business interface indicated by the data generation requirement information.

[0095] In the above embodiments, the data required for generating scripts is differentiated according to the type of business scenario. For material generation, cloud storage and access paths are provided; for database query, table structure and relationships are provided; and for interface operation, interface addresses and input / output parameters are provided. This precise adaptation mechanism ensures that the generated target data generation script closely matches actual needs, improves script accuracy and usability, reduces manual adjustments, and enhances the versatility and intelligence of the data generation tool.

[0096] In one embodiment, generating a target data generation script based on data generation requirement information, script generation data, and similar existing data generation scripts includes: comparing the data generation requirement information with similar existing data generation scripts to determine the functional differences between the data generation requirement information and similar existing data generation scripts; determining the target lines of code in the similar existing data generation scripts corresponding to the functional differences; obtaining a standardized script template pre-set for the business scenario type; modifying the code areas related to the functional differences in the standardized script template by referring to the writing style of the target lines of code, and filling the variable placeholders in the standardized script template with script generation data to generate the target data generation script.

[0097] Among them, functional differences refer to the specific functional inconsistencies between the user's data creation requirements and similar existing data creation scripts in terms of data construction goals, output results, or business logic. In other words, there are new requirements that existing scripts cannot meet or functional gaps that need to be modified and adapted.

[0098] In the above embodiments, by comparing the functional differences between the data generation requirements and similar existing scripts, the lines of code that need to be modified are accurately located. These lines are then filled in using standardized templates and script-generated data, referencing the original code and referencing standardized templates, thus achieving rapid generation of the target script. This approach preserves the correct logic of existing scripts while flexibly adapting to new requirements, improving the accuracy and efficiency of script generation, reducing manual coding workload, and enhancing the intelligence and reusability of the data generation process.

[0099] In one embodiment, the process of calling the target data generation script to perform data generation operations and obtaining the test data required for the test task includes: calling the target data generation script to perform data generation operations through a large data generation model; if the execution is successful, obtaining the test data required for the test task; if the execution fails, obtaining execution error information, and using the large data generation model to iteratively repair and execute the target data generation script based on the execution error information until the execution is successful and the test data required for the test task is obtained.

[0100] In one embodiment, such as Figure 5As shown, the terminal can obtain the data generation requirement information input by the user based on the test task. If no target existing data generation capability item matching the data generation requirement information is found in the pre-built existing data generation capability library, the business scenario type to which the data generation requirement information belongs is determined through the data generation big data model, and the special capability tool corresponding to the business scenario type is loaded. The script generation data indicated by the data generation requirement information is obtained through the special capability tool. If the business scenario type is material generation type, the script generation data includes the cloud storage location and access path of the multimedia file indicated by the data generation requirement information. If the business scenario type is database query type, the script generation data includes the table structure, fields, indexes and data relationships of the data table indicated by the data generation requirement information. If the business scenario type is interface operation type, the script generation data includes the interface address and input / output parameter definition data of the business interface indicated by the data generation requirement information. The system retrieves similar existing data generation scripts with semantically similar data generation requirements from a pre-built library of existing data generation scripts. It then compares the data generation requirements with these similar existing scripts to identify functional differences. The system identifies the target lines of code in the similar existing scripts corresponding to these functional differences. A standardized script template, pre-defined for the business scenario type, is obtained. Referring to the writing style of the target lines of code, the code areas related to the functional differences in the standardized script template are modified, and variable placeholders in the standardized script template are filled with script-generated data to generate the target data generation script. The system calls the target data generation script to execute the data generation operation through a large-scale data generation model. If execution is successful, the test data required for the test task is obtained. If execution fails, execution error information is obtained, and the large-scale data generation model iteratively repairs and executes the target data generation script based on the execution error information until successful execution, obtaining the test data required for the test task.

[0101] In the above embodiments, a large-scale data model calls a script to generate data, and when it fails, it automatically obtains error information, performs loop repair and retrying until it succeeds. This mechanism enables the script to autonomously correct errors and execute robustly without manual intervention, significantly improving the success rate and efficiency of data generation, ensuring a stable supply of test data, and enhancing the system's robustness and intelligent operation and maintenance capabilities.

[0102] In one embodiment, such as Figure 6 As shown, the method further includes: identifying target functions marked with target decorators in the target data generation script; parsing the target functions through the target decorators indicated by the target decorators to obtain the page rendering metadata of the target functions; integrating the page rendering metadata into a standardized JSON configuration file; and rendering the front-end operation interface corresponding to the target data generation script on the visualization operation page based on the JSON configuration file.

[0103] The page rendering metadata includes at least one of the following: the function name, type, description, default value, and page layout attributes of the target function.

[0104] In the above embodiments, by identifying the functions marked with decorators, parsing their page rendering metadata, and integrating it into a standardized JSON configuration file, the front-end operation interface is automatically generated. This mechanism realizes the visual interaction of the data generation script, lowers the user threshold, allows complex data generation tasks to be executed without coding, improves operational convenience and user experience, and strengthens the standardization and scalability of the tool.

[0105] In one embodiment, the method further includes: extracting script keywords from a JSON configuration file and constructing a retrieval index for the target data generation script based on the script keywords; responding to the user entering script keywords on the visual operation page, locating and displaying the front-end operation interface corresponding to the target data generation script based on the retrieval index; and calling the target data generation script again based on the front-end operation interface to perform data generation operations and obtain the test data required for the test task.

[0106] Script keywords are core terms used to identify the functional characteristics and business attributes of the target data generation script. Script keywords may include at least one of the following: business scenario name, data object type, operation action (such as generate, query, call), and main field or interface name.

[0107] In one embodiment, such as Figure 7 As shown, the visualization page currently displays the test data generation page for the test task "Insert Paid Orders". Users can enter script keywords on this visualization page, and the terminal will respond to the input and locate and display the front-end interface of the target data generation script corresponding to "Insert Paid Orders" based on the search index. Furthermore, users can use the front-end interface to call the target data generation script again to perform data generation operations and obtain the test data required for the "Insert Paid Orders" test task.

[0108] In the above embodiments, a search index is constructed by extracting script keywords and linked to a visual interface. Users can quickly locate and execute scripts by entering keywords. This mechanism enables efficient retrieval and one-click reuse of data generation scripts, reduces repetitive configuration costs, improves operational convenience and test data acquisition efficiency, strengthens knowledge accumulation and intelligent recommendation capabilities, and optimizes the overall user experience.

[0109] In one embodiment, such as Figure 8As shown, the system architecture of the test data construction method includes a development layer, a parsing engine layer, a service exposure layer, and a consumption layer. The development layer includes standardized script templates pre-set for various business scenarios, a data generation platform code repository for storing data generation scripts, and database interaction tools supporting database functions. The parsing engine layer includes an automatic parameter extraction engine for extracting metadata, a generator for generating JSON configuration files, a registration unit for registering model context protocol services, a library of existing data generation scripts, and a generator for generating specialized capability description files. The service exposure layer is used to render the front-end operation interface corresponding to the target data generation script based on the JSON configuration file, provide model context protocol services, generate the target data generation script, and call specialized capability tools. The consumption layer includes the front-end operation interface and an AI dialogue agent.

[0110] In one embodiment, such as Figure 9 As shown, the test data construction method can be applied to a terminal-based intelligent data generation platform. For example, users can access the intelligent data generation platform's website via a URL link. The intelligent data generation platform supports obtaining user input of data generation requirements through dialogue: "Please help me construct a 2-minute piece of instrumental music." Users can clearly see the intelligent data generation platform's thinking, retrieval, decision-making, and generation steps in constructing test data.

[0111] In one embodiment, such as Figure 10 As shown, the terminal can obtain the data generation requirement information input by the user based on the test task; if no target existing data generation capability item matching the data generation requirement information is found in the pre-built existing data generation capability library, the business scenario type to which the data generation requirement information belongs is determined through the data generation big model, and the special capability tool corresponding to the business scenario type is loaded; the business scenario type includes material generation type, database query type, and interface operation type; the script generation data indicated by the data generation requirement information is obtained through the special capability tool; similar existing data generation scripts with semantic similarity to the data generation requirement information are retrieved from the pre-built existing data generation script library; a standardized script template pre-set for the business scenario type is obtained; based on the standardized script template, data generation requirement information, script generation data, and similar existing data generation scripts, a target data generation script is generated; the target data generation script is called to execute the data generation operation to obtain the test data required for the test task.

[0112] In one embodiment, such as Figure 11As shown, after generating the target data generation script, the terminal can identify the target function marked with a target decorator in the target data generation script; register the target function with the model context protocol service of the large-scale data generation model through the target decorator indicated by the target decorator mark to obtain the target existing data generation tool that matches the data generation requirement information function, and store the target existing data generation tool in the existing data generation tool library; perform abstract syntax tree analysis on the target data generation script to extract the call meta-information of the target function in the target data generation script, and integrate the call meta-information into a structured special capability description file; deploy the special capability description file to the skill directory of the large-scale data generation model to obtain the special capability tool corresponding to the business scenario type, and store the special capability tool. In addition, the terminal can also parse the target function through the target decorator indicated by the target decorator mark to obtain the page rendering meta-information of the target function; integrate the page rendering meta-information into a standardized JSON configuration file; and render and generate the front-end operation interface corresponding to the target data generation script on the visual operation page based on the JSON configuration file.

[0113] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially, these steps are not necessarily executed in that order. Unless otherwise expressly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the above embodiments may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.

[0114] Based on the same inventive concept, this application also provides a test data construction apparatus for implementing the test data construction method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more test data construction apparatus embodiments provided below can be found in the limitations of the test data construction method described above, and will not be repeated here.

[0115] In one embodiment, such as Figure 12 As shown, a test data construction apparatus 1200 is provided, which specifically includes:

[0116] The acquisition module 1202 is used to acquire the data generation requirement information input by the user based on the test task;

[0117] The loading module 1204 is used to determine the business scenario type of the data creation requirement information through the data creation big model if no target existing data creation capability item matching the data creation requirement information function is found in the pre-built existing data creation capability library, and load the special capability tool corresponding to the business scenario type.

[0118] The acquisition module 1202 is also used to acquire script-generated data indicating the data generation requirements through specialized capability tools;

[0119] The retrieval module 1206 is used to retrieve similar existing data creation scripts that are semantically similar to the data creation requirement information from a pre-built existing data creation script library;

[0120] The generation module 1208 is used to generate a target data generation script based on the data generation requirement information, script generation data, and similar existing data generation scripts; and to call the target data generation script to perform data generation operations and obtain the test data required for the test task.

[0121] In one embodiment, the existing data generation capability library includes an existing data generation script library for storing candidate existing data generation scripts, and an existing data generation tool library for storing candidate existing data generation tools; the apparatus further includes:

[0122] The judgment module is used to determine that if a target existing data creation script matching the data creation requirement information function is found in the existing data creation script library, or a target existing data creation tool matching the data creation requirement information function is found in the existing data creation tool library, then a target existing data creation capability item matching the data creation requirement information function has been retrieved from the existing data creation capability library; otherwise, it is determined that no target existing data creation capability item matching the data creation requirement information function has been retrieved from the existing data creation capability library. The target existing data creation capability item is either a target existing data creation script or a target existing data creation tool.

[0123] In one embodiment, the apparatus further includes:

[0124] The storage module is used to store target data generation scripts into the existing data generation script library; identify target functions marked with target decorators in the target data generation scripts; register the target functions with the model context protocol service of the large-scale data generation model through the target decorators indicated by the target decorators to obtain target existing data generation tools that match the data generation requirement information functions, and store the target existing data generation tools into the existing data generation tool library; perform abstract syntax tree analysis on the target data generation scripts to extract the call meta-information of the target functions in the target data generation scripts, and integrate the call meta-information into a structured specialized capability description file; deploy the specialized capability description file to the skill directory of the large-scale data generation model to obtain specialized capability tools corresponding to the business scenario types, and store the specialized capability tools.

[0125] In one embodiment, the generation module 1208 is further configured to, if a target existing data creation capability item matching the data creation requirement information function has been retrieved from the pre-built existing data creation capability library, call the target existing data creation capability item to perform data creation operation and obtain the test data required for the test task.

[0126] In one embodiment, if the business scenario type is material generation, the script-generated data includes the cloud storage location and access path of the multimedia file indicated by the data generation requirement information; if the business scenario type is database query, the script-generated data includes the table structure, fields, indexes, and data relationships of the data table indicated by the data generation requirement information; if the business scenario type is interface operation, the script-generated data includes the interface address and input / output parameter definition data of the business interface indicated by the data generation requirement information.

[0127] In one embodiment, the generation module 1208 is further configured to compare the data generation requirement information with similar existing data generation scripts to determine the functional differences between the data generation requirement information and similar existing data generation scripts; determine the target lines of code in the similar existing data generation scripts corresponding to the functional differences; obtain a standardized script template pre-set for the business scenario type; modify the code areas related to the functional differences in the standardized script template with reference to the writing style of the target lines of code, and fill the variable placeholders in the standardized script template with script generation data to generate the target data generation script.

[0128] In one embodiment, the generation module 1208 is further configured to call the target data generation script through the data generation model to perform data generation operations; if the execution is successful, the test data required for the test task is obtained; if the execution fails, the execution error information is obtained, and the target data generation script is repeatedly repaired and executed based on the execution error information through the data generation model until the execution is successful and the test data required for the test task is obtained.

[0129] In one embodiment, the apparatus further includes:

[0130] The rendering module is used to identify target functions marked with target decorators in the target data generation script; parse the target functions through the target decorators indicated by the target decorators to obtain the page rendering metadata of the target functions; integrate the page rendering metadata into a standardized JSON configuration file; and render the front-end operation interface corresponding to the target data generation script on the visualization operation page based on the JSON configuration file.

[0131] In one embodiment, the generation module 1208 is further configured to extract script keywords from the JSON configuration file and construct a retrieval index for the target data generation script based on the script keywords; in response to the user entering script keywords on the visual operation page, locate and display the front-end operation interface corresponding to the target data generation script according to the retrieval index; and call the target data generation script again based on the front-end operation interface to perform data generation operations and obtain the test data required for the test task.

[0132] The aforementioned test data construction device acquires the data generation requirement information input by the user based on the test task. If no target existing data generation capability item matching the data generation requirement information is found in the pre-built existing data generation capability library, the device determines the business scenario type to which the data generation requirement information belongs through the data generation big data model and loads the special capability tool corresponding to the business scenario type. It then obtains the script generation data indicated by the data generation requirement information through the special capability tool; retrieves similar existing data generation scripts semantically similar to the data generation requirement information from the pre-built existing data generation script library; generates a target data generation script based on the data generation requirement information, script generation data, and similar existing data generation scripts; and calls the target data generation script to execute the data generation operation to obtain the test data required for the test task. Compared to traditional manual data generation methods, this application achieves intelligent on-demand generation of test data by relying on the data generation big data model and special capability tools. Addressing the pain points of high cost and low efficiency of traditional manual script writing, this application intelligently retrieves and reuses existing assets, and automatically adapts to the business scenario and loads dedicated tools to generate scripts when no matching item is found, significantly reducing human input and repetitive labor. At the same time, by combining semantically similar scripts to assist in generation, the accuracy and generalization ability of script construction are improved, ultimately achieving rapid and accurate output of test data, significantly shortening the data generation cycle, and comprehensively improving the test preparation efficiency throughout the entire software iteration lifecycle.

[0133] Each module in the aforementioned test data construction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0134] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 13As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a test data construction method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0135] Those skilled in the art will understand that Figure 13 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0136] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0137] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0138] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0139] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0140] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0141] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0142] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for constructing test data, characterized in that, The method includes: Obtain user data generation requirements based on test task input; If no target existing data creation capability item matching the data creation requirement information function is found in the pre-built existing data creation capability library, the business scenario type to which the data creation requirement information belongs is determined through the data creation big model, and the special capability tool corresponding to the business scenario type is loaded. The script generation data indicated by the data generation requirement information is obtained through the specialized capability tool; Retrieve similar existing data creation scripts that are semantically similar to the data creation requirement information from a pre-built existing data creation script library; Based on the data creation requirement information, the script generation data, and the similar existing data creation scripts, a target data creation script is generated. The target data generation script is invoked to perform data generation operations and obtain the test data required for the test task.

2. The method according to claim 1, characterized in that, The existing data generation capability library includes an existing data generation script library for storing candidate existing data generation scripts, and an existing data generation tool library for storing candidate existing data generation tools; the method further includes: If a target existing data creation script matching the data creation requirement information function is found in the existing data creation script library, or a target existing data creation tool matching the data creation requirement information function is found in the existing data creation tool library, then it is determined that a target existing data creation capability item matching the data creation requirement information function has been found in the existing data creation capability library; otherwise, it is determined that no target existing data creation capability item matching the data creation requirement information function has been found in the existing data creation capability library. The target stock data creation capability item is either the target stock data creation script or the target stock data creation tool.

3. The method according to claim 2, characterized in that, The method further includes: The target data generation script is stored in the existing data generation script library; Identify the target functions marked with target decorators in the target data generation script; The target function is registered to the model context protocol service of the large data model by the target decorator indicated by the target decorator mark, so as to obtain the target stock data creation tool that matches the data creation requirement information function, and the target stock data creation tool is stored in the stock data creation tool library. Abstract syntax tree analysis is performed on the target data generation script to extract the call meta-information of the target function in the target data generation script, and the call meta-information is integrated into a structured specialized capability description file; The specific capability description file is deployed to the skill directory of the data model to obtain the specific capability tools corresponding to the business scenario type, and the specific capability tools are stored.

4. The method according to claim 1, characterized in that, The method further includes: If a target existing data creation capability item matching the data creation requirement information function has been retrieved from the pre-built existing data creation capability library, then the target existing data creation capability item is invoked to perform the data creation operation and obtain the test data required for the test task.

5. The method according to claim 1, characterized in that, If the business scenario type is a material generation type, then the script generation data includes the cloud storage location and access path of the multimedia file indicated by the data generation requirement information; If the business scenario type is a database query type, then the script-generated data includes the table structure, fields, indexes, and data relationships of the data table indicated by the data generation requirement information; If the business scenario type is an interface operation type, then the script-generated data includes the interface address and input / output parameter definition data of the business interface indicated by the data generation requirement information.

6. The method according to claim 1, characterized in that, The step of generating a target data generation script based on the data generation requirement information, the script generation data, and the similar existing data generation scripts includes: The data creation requirement information is compared with the similar existing data creation scripts to determine the functional differences between the data creation requirement information and the similar existing data creation scripts. Identify the target lines of code in the similar stock data generation script that correspond to the functional differences; Obtain a standardized script template pre-set for the aforementioned business scenario type; Referring to the writing style of the target code line, modify the code area in the standardized script template related to the functional differences, and fill the variable placeholders in the standardized script template with the data generated by the script to generate the target data generation script.

7. The method according to claim 1, characterized in that, The step of calling the target data generation script to perform data generation operations and obtain the test data required for the test task includes: The target data generation script is invoked through the data generation model to perform data generation operations; If the execution is successful, the test data required for the test task will be obtained; If execution fails, an execution error message is obtained, and the target data generation script is repeatedly repaired and executed based on the execution error message using the data generation model until execution is successful, thereby obtaining the test data required for the test task.

8. The method according to claim 1, characterized in that, The method further includes: Identify the target functions marked with target decorators in the target data generation script; The target function is parsed by the target decorator indicated by the target decorator markup to obtain the page rendering metadata of the target function; The page rendering metadata is integrated into a standardized JSON configuration file; Based on the JSON configuration file, the front-end operation interface corresponding to the target data generation script is rendered and generated on the visualization operation page.

9. The method according to claim 8, characterized in that, The method further includes: Extract script keywords from the JSON configuration file and construct a retrieval index for the target data generation script based on the script keywords; In response to the user entering the script keywords on the visual operation page, the front-end operation interface corresponding to the target data generation script is located and displayed according to the search index; Based on the aforementioned front-end operation interface, the target data generation script is invoked again to perform data generation operations and obtain the test data required for the test task.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 9.

11. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 9.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 9.