Test data generation method and device, equipment and storage medium
Generate data construction scripts through large language models and determine target standard instructions from the standard instruction library, solving the problem of low efficiency in the securities and futures industry, achieving efficient test data generation, and reducing development costs.
Patent Information
- Application Number
- CN202411213146.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2025-01-14
AI Technical Summary
In the securities and futures industry, the generation efficiency of test data is low, and test data needs to be generated in different test scenarios, which leads to developers need to manually write data construction scripts and execute them on the basic mirror data, which is inefficient.
By generating data construction scripts based on a large language model, multiple target standard instructions corresponding to the target basic mirror data of the target system to be tested are determined from the standard instruction library, and test data is generated based on these instructions, which improves the generation efficiency of test data.
Without manual writing of data construction scripts, test data is directly determined and generated from the standard instruction library, which significantly improves the efficiency of obtaining test data and reduces the development and operation and maintenance costs of data construction scripts.
Smart Images

Figure CN119311573A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for generating test data. Background Art
[0002] In the securities and futures industry, the testing requirements for different test scenarios vary greatly. Therefore, it is usually necessary to generate corresponding test data for different test scenarios.
[0003] Currently, when generating test data corresponding to a test scenario, developers need to manually write a data construction script and obtain the basic image data corresponding to the test scenario with a full understanding of the test requirements, and then execute the data construction script on the basic image data to generate the test data corresponding to the test scenario.
[0004] However, the above method will result in low efficiency in generating test data. Summary of the invention
[0005] The present application provides a test data generation method, apparatus, device and storage medium to solve the defect of low test data generation efficiency in the prior art, thereby improving the test data generation efficiency.
[0006] The present application provides a method for generating test data, which may include: In response to a test data generation instruction for a target system under test, based on the target basic image data of the target system under test, a plurality of target standard instructions corresponding to the target basic image data are determined from a standard instruction library; wherein the standard instructions stored in the standard instruction library are obtained based on a data construction script, the data construction script is generated by inputting a data requirement description into a large language model, and the large language model is obtained by training based on a plurality of data requirement description samples; Based on the multiple target standard instructions, target test data corresponding to the target system under test is generated.
[0007] According to a test data generation method provided by the present application, generating target test data corresponding to the target system under test based on the multiple target standard instructions includes: sorting the plurality of target standard instructions based on respective execution status parameters of the plurality of target standard instructions; Traversing the sorted multiple target standard instructions, and inputting the traversed target standard instructions into the target system under test when the current execution state parameters of the target system under test meet the execution state parameters of the traversed target standard instructions; The target test data is generated based on the response results of the target system under test to each of the plurality of target standard instructions.
[0008] According to a method for generating test data provided by the present application, the method further includes: When the current execution state parameters of the target system under test do not meet the execution state parameters of the traversed target standard instructions, the current execution state parameters are adjusted to the execution state parameters of the traversed target standard instructions, and the traversed target standard instructions are input into the target system under test after adjusting the current execution state parameters.
[0009] According to a method for generating test data provided by the present application, the method further includes: Get multiple data requirement descriptions; Inputting the plurality of data requirement descriptions into the large language model respectively to obtain a data construction script corresponding to each of the data requirement descriptions; The data construction script corresponding to each of the data requirement descriptions is split to obtain the standard instructions.
[0010] According to a test data generation method provided by the present application, the data construction script corresponding to each data requirement description is split to obtain the standard instruction, including: Determine the basic image data corresponding to each of the multiple data requirement descriptions; For each of the basic image data, determine a plurality of instructions corresponding to the basic image data after the data construction script is split; In response to a selection operation on the plurality of instructions, a standard instruction corresponding to the basic image data is determined from the plurality of instructions.
[0011] According to a method for generating test data provided by the present application, the method further includes: For each standard instruction corresponding to the basic image data, if the standard instruction is not marked with instruction description information, instruction description information is randomly added to the standard instruction.
[0012] The present application also provides a device for generating test data, which may include: A first processing unit is configured to generate instructions for test data of a target system under test, and determine, from a standard instruction library, a plurality of target standard instructions corresponding to the target basic image data based on the target basic image data of the target system under test; wherein the standard instructions stored in the standard instruction library are obtained based on a data construction script, the data construction script is generated by inputting a data requirement description into a large language model, and the large language model is obtained by training based on a plurality of data requirement description samples; The second processing unit is used to generate target test data corresponding to the target system under test based on the multiple target standard instructions.
[0013] The present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for generating test data as described above is implemented.
[0014] The present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for generating test data as described in any one of the above is implemented.
[0015] The present application also provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, the method for generating test data as described above is implemented.
[0016] The test data generation method, apparatus, device and storage medium provided in the present application respond to the test data generation instruction for the target system under test, and determine multiple target standard instructions corresponding to the target basic image data from the standard instruction library based on the target basic image data of the target system under test; wherein the standard instructions stored in the standard instruction library are obtained based on a data construction script, and the data construction script is generated by inputting a data requirement description into a large language model, and the target test data corresponding to the target system under test are generated based on multiple target standard instructions. In this way, based on the target basic image data of the target system under test, multiple target standard instructions corresponding to the target basic image data are directly determined from the standard instruction library, and the target test data corresponding to the target system under test are generated based on the multiple target standard instructions, which solves the problem in the prior art that it is necessary to manually write a data construction script and execute the data construction script on the basic image data to generate test data, thereby effectively improving the efficiency of obtaining test data. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 A flowchart of a method for generating test data provided in an embodiment of the present application.
[0019] Figure 2 A schematic diagram of a process for generating target test data corresponding to a target system under test provided in an embodiment of the present application.
[0020] Figure 3 A schematic diagram of a flow chart for obtaining standard instructions provided in an embodiment of the present application.
[0021] Figure 4 A schematic diagram of a framework of a method for generating test data provided in an embodiment of the present application.
[0022] Figure 5 A schematic diagram of the structure of a test data generating device provided in an embodiment of the present application.
[0023] Figure 6 A schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] In the embodiments of the present application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. In the text description of the present application, the character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0026] In the securities and futures industry, the testing requirements for different test scenarios vary greatly. For example, test scenario A requires hitting the daily limit for three consecutive trading days; test scenario B requires constructing a 50-lot yesterday position for a certain contract on the previous trading day. The data required for the two test scenarios has a different number of trading days and different trading statuses. Therefore, it is usually necessary to generate corresponding test data for different test scenarios.
[0027] At present, when generating test data corresponding to a test scenario, developers need to form a test scenario data requirement document with full understanding of the test requirements, and manually write a data construction script based on the test scenario requirement document, and obtain the basic image data corresponding to the test scenario, and then execute the data construction script on the basic image data to generate the test data corresponding to the test scenario. However, the above method will result in low efficiency in generating test data.
[0028] In order to improve the efficiency of test data generation, the embodiment of the present application provides a method for generating test data. The following specific embodiments will be used to describe the method for generating test data provided by the present application in detail. It is understood that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0029] Figure 1 A flow chart of a method for generating test data provided in an embodiment of the present application, for example, see Figure 1 As shown, the method for generating the test data may include: S101 , in response to generating an instruction for test data of a target system under test, based on target basic image data of the target system under test, determining a plurality of target standard instructions corresponding to the target basic image data from a standard instruction library.
[0030] For example, business requirements for a target system under test may be received first, and test data generation instructions may be automatically generated based on the business requirements.
[0031] For example, the target system under test may be a transaction system, a business system, a data service system, etc., and may be specifically configured according to actual needs.
[0032] Among them, the trading system can include its Application Programming Interface (API) service, business system API service, database service, etc. The API service of the trading system is responsible for processing the trading behaviors such as traders' orders and order withdrawals; the business system can include its API service, and the API service of the business system is mainly responsible for processing the exchange's management of the system such as administrator position limit settings and trading day settings; the data service system is mainly responsible for adding, deleting, modifying and checking the database.
[0033] For example, the test data generation instruction may be a screen trigger instruction, or a voice trigger instruction, etc., and may be specifically set according to actual needs.
[0034] Among them, the standard instructions stored in the standard instruction library are obtained based on the data construction script, and the data construction script is generated by inputting the data requirement description into the large language model, and the large language model is obtained by training based on multiple data requirement description samples.
[0035] For example, when acquiring the target basic image data of the target system under test, the basic data of the target system under test may be acquired first, and the basic data may be cleaned and expanded to generate corresponding target basic image data.
[0036] Among them, data cleaning is to remove all permissions such as position limits and quota limits in production data that may affect the execution of normal use cases at one time, so as to reduce the difficulty of developing automated scripts; due to the special structure of the securities system, closing settlement takes a lot of time in a test environment, and the time cost of rolling trading days is huge. Therefore, it is necessary to expand the basic data so that on the same trading day, the automated script can generate test data for more use cases to reduce data construction costs.
[0037] It is understandable that in the embodiment of the present application, a plurality of standard instructions are pre-stored in the standard instruction library. For example, when a plurality of standard instructions are stored in the standard instruction library, the plurality of standard instructions can be packaged together in a packaged manner, and the corresponding basic image data can be marked, so that in the actual test scenario, the plurality of target standard instructions corresponding to the target basic image data can be directly determined from the standard instruction library based on the target basic image data of the target system under test, so that the acquisition efficiency of the target standard instructions can be effectively improved.
[0038] For example, in an embodiment of the present application, the types of standard instructions may include two types, one type of standard instruction is a basic data acquisition instruction, and the other type of standard instruction is a trading system atomic operation instruction.
[0039] Among them, the basic data acquisition instruction is usually used to call the database service to query a piece of basic data that meets the business requirements, such as varieties, members, customers, etc. After data cleaning, these basic data can ensure that subsequent operations are not restricted by any permissions. If the business needs to set certain restrictions, such as position limits, quota limits, etc., they will be met through the atomic operation instructions of the trading system. In this way, by calling the database service, the query efficiency of the database can be significantly improved and too many joint table queries can be avoided. At the same time, it also greatly simplifies the implementation of the data construction script, without having to consider removing non-essential permissions first and then adding permissions required by the business.
[0040] The atomic operation instructions of the trading system are mainly used to realize the operation of basic data. For example, through the basic data acquisition service, a self-operated customer under a member is obtained, and then the futures contract under a certain variety is obtained. Through the order submission service of the atomic operation instructions of the trading system, the order submission function of the self-operated customer on the futures contract can be realized.
[0041] Each standard instruction includes static parameters, dynamic parameters and execution status parameters. Static parameters include order quantity, transaction type, etc., dynamic parameters include contract code, which is the output parameter of the previous instruction, and execution status parameters include trading day, transaction status, etc., which can be seen in the following description.
[0042] #On the first day, in system status 30, get a group x, get warehouses A, B, C, D, get varieties M, N
[0043] GroupID_X = step('getGroupID',{},'T+0','30','Group X')
[0044] StorageID_A = step('getStorageID',{'MainStorageID':'','GroupID':''},'T+0','30','Warehouse A')
[0045] StorageID_B = step('getStorageID',{'MainStorageID':'','GroupID':''},'T+0','30','Warehouse B')
[0046] StorageID_C = step('getStorageID',('MainStorageID':"','GroupID':''},'T+0','30','Warehouse C')
[0047] StorageID_D= step('getStorageID',{'MainStorageID':'''GroupID':''},'T+0','30','Warehouse D')
[0048] VarietyID_M = step('get_VarietyID', {}, 'T+0', '30', 'Variety M') VarietyID_N = step('get_VarietyID', {}, 'T+0', '30', 'Variety N')
[0049] For example, in an embodiment of the present application, the large language model can be an AIGC code generation model, which is obtained by training based on multiple data requirement description samples. The input of the large language model is the data requirement description, and the output is the corresponding data construction script. In this way, there is no need to manually write the data construction script, which not only reduces the data construction script development cost and operation and maintenance cost, but also can effectively improve the efficiency of obtaining the data construction script.
[0050] After determining multiple target standard instructions corresponding to the target basic image data from the standard instruction library, the following S102 may be executed: S102: Generate target test data corresponding to the target system under test based on multiple target standard instructions.
[0051] The target test data is used to test the target system under test, which can be done manually or automatically, and can be set according to actual needs.
[0052] It can be seen that in the embodiment of the present application, in response to the test data generation instruction for the target system under test, based on the target basic image data of the target system under test, multiple target standard instructions corresponding to the target basic image data are determined from the standard instruction library; wherein, the standard instructions stored in the standard instruction library are obtained based on the data construction script, and the data construction script is generated by inputting the data requirement description into the large language model, and based on the multiple target standard instructions, the target test data corresponding to the target system under test is generated. In this way, based on the target basic image data of the target system under test, the multiple target standard instructions corresponding to the target basic image data are directly determined from the standard instruction library, and based on the multiple target standard instructions, the target test data corresponding to the target system under test is generated, which solves the problem in the prior art that it is necessary to manually write a data construction script and execute the data construction script on the basic image data to generate test data, thereby effectively improving the efficiency of obtaining test data.
[0053] Based on the above Figure 1 In the embodiment shown in the above S103, how to generate target test data corresponding to the target system under test based on multiple target standard instructions, please refer to the following Figure 2 The embodiment shown.
[0054] Figure 2 A schematic diagram of a process for generating target test data corresponding to a target system under test provided in an embodiment of the present application, for example, can be seen in Figure 2 As shown, the method may include: S201. Sort multiple target standard instructions based on their respective execution status parameters.
[0055] For example, the execution status parameter may be a transaction day, a transaction status, etc., which may be set according to actual needs.
[0056] Taking the execution status parameters including trading day and trading status as an example, when sorting multiple target standard instructions, the sorting rules can be: trading days from far to near, and trading status from opening to closing. Assume that target standard instruction A needs to be executed for two trading days, and target standard instruction B needs to be executed for three trading days. The scheduling engine will execute the first trading day of target standard instruction B on the first day; execute the first trading day of target standard instruction A and the second trading day of target standard instruction B on the second day; and execute the second trading day of target standard instruction A and the third trading day of target standard instruction B on the third day. That is, the third day will meet the needs of target standard instruction A and target standard instruction B at the same time, realizing the sorting of multiple target standard instructions, and obtaining multiple sorted target standard instructions.
[0057] S202 , traversing the sorted multiple target standard instructions, and inputting the traversed target standard instructions into the target system under test when the current execution state parameters of the target system under test meet the execution state parameters of the traversed target standard instructions.
[0058] By way of example, in an embodiment of the present application, when the current execution state parameters of the target system under test do not meet the execution state parameters of the traversed target standard instructions, the current execution state parameters are adjusted to the execution state parameters of the traversed target standard instructions, and then the traversed target standard instructions are input into the target system under test after the current execution state parameters are adjusted.
[0059] Assuming that the multiple target standard instructions after sorting are target standard instruction 1, target standard instruction 2 and target standard instruction 3, target standard instruction 1 can be executed first to determine the trading day and trading status of target standard instruction 1, and whether the current trading day and current trading status of the target system under test meet the trading day and trading status of target standard instruction 1. If they do not meet the trading day and trading status of target standard instruction 1, the current trading day and current trading status of the target system under test are adjusted so that the adjusted trading day and trading status meet the trading day and trading status of target standard instruction 1, and target standard instruction 1 is input into the target system under test; secondly, target standard instruction 2 is executed to determine the trading day and trading status of target standard instruction 2. And re-determine whether the current trading day and current trading status of the target system under test meet the trading day and trading status of target standard instruction 2. If so, input target standard instruction 2 into the target system under test; finally, execute target standard instruction 3, determine the trading day and trading status of target standard instruction 3, and re-determine whether the current trading day and current trading status of the target system under test meet the trading day and trading status of target standard instruction 3. If so, input target standard instruction 3 into the target system under test, thereby inputting target standard instruction 1, target standard instruction 2 and target standard instruction 3 into the target system under test in sequence.
[0060] After the target standard instructions are input into the target system under test respectively, the following S203 can be executed: S203 : Generate target test data based on the response results of the target system under test to each of the multiple target standard instructions.
[0061] For example, in an embodiment of the present application, after obtaining the response results of the target system under test to multiple target standard instructions, the multiple target standard instructions and the response results to the multiple target standard instructions can be stored in the instruction execution storage module. On the one hand, an execution log can be generated to help testers investigate execution anomalies; on the other hand, by storing the response results to multiple target standard instructions, it is used for parameter reference of subsequent standard instructions. Since standard instructions usually include dynamic parameters, that is, the parameters depend on the output of the previous step. For example, the order submission operation needs to read dynamic customer and contract information from the previous step. During execution, the customer and contract information obtained in the previous step can be obtained from the instruction execution storage module, which is conducive to parameter reference for subsequent standard instructions.
[0062] It can be seen that in the embodiment of the present application, when generating target test data corresponding to the target system under test based on multiple target standard instructions, the multiple target standard instructions can be first sorted based on the execution status parameters of each of the multiple target standard instructions; and the sorted multiple target standard instructions are traversed, and when the current execution status parameters of the target system under test meet the execution status parameters of the traversed target standard instructions, the traversed target standard instructions are input into the target system under test; and then based on the response results of the target system under test to each of the multiple target standard instructions, the target test data is generated, which solves the problem in the prior art that it is necessary to manually write a data construction script and execute the data construction script on the basic image data to generate test data, thereby effectively improving the efficiency of obtaining test data.
[0063] Based on any of the above embodiments, before storing the standard instruction in the standard instruction library, it is necessary to obtain the standard instruction first. For details, see the following Figure 3 The embodiment shown.
[0064] Figure 3 A schematic diagram of a process for obtaining a standard instruction provided in an embodiment of the present application, for example, can be found in Figure 3 As shown, the method may include: S301. Obtain multiple data requirement descriptions.
[0065] The data requirement description is a natural language description.
[0066] S302: Input multiple data requirement descriptions into the large language model respectively to obtain a data construction script corresponding to each data requirement description.
[0067] Among them, the large language model is trained based on multiple data demand description samples.
[0068] For example, in an embodiment of the present application, the large language model may be an artificial intelligence generated content (AIGC) code generation model.
[0069] After business personnel write the corresponding data requirement description according to the test requirements, they can input the data requirement description into the AIGC code generation model and use the AIGC code generation model to convert the data requirement description into the corresponding data construction script. This eliminates the need to manually write data construction scripts, which not only reduces the data construction script development cost and operation and maintenance cost, but also effectively improves the efficiency of obtaining data construction scripts.
[0070] It is understandable that after using the AIGC code generation model to convert the data requirement description into the corresponding data construction script, the accuracy of the converted data construction script can be further verified to ensure the accuracy of the data construction script. In this way, by obtaining an accurate data construction script, on the one hand, standard instructions can be generated based on the accurate data construction script; on the other hand, the accurate data construction script can be used as a training sample to fine-tune the AIGC code generation model, thereby improving the accuracy of the AIGC code generation model.
[0071] For example, in an embodiment of the present application, when training the AIGC code generation model, the exchange business documents and data construction interface documents can be used as unlabeled data to pre-train the initial AIGC code generation model for the target system under test business. The initial AIGC code generation model can learn common features on a large amount of unlabeled data related to the exchange business, and the learned common features have wide applicability. When the initial AIGC code generation model is fine-tuned to generate data construction script tasks, it can accelerate the convergence process and improve the generalization ability of the final AIGC code generation model. After the AIGC code generation model is trained, the technician can implement the description and scenario description through the interface, so that the AIGC code generation model can recognize the data requirement description, thereby converting the data requirement description into the corresponding data construction script, so that there is no need to manually write the data construction script, which not only reduces the data construction script development cost and operation and maintenance cost, but also can effectively improve the acquisition efficiency of the data construction script.
[0072] S303: Split the data construction script corresponding to each data requirement description to obtain standard instructions.
[0073] By way of example, in an embodiment of the present application, when splitting the data construction script corresponding to each data requirement description, the basic image data corresponding to each of the multiple data requirement descriptions can be first determined; for each base image data, multiple instructions after the data construction script corresponding to the basic image data is split are determined; and in response to a selection operation for multiple instructions, standard instructions corresponding to the basic image data are determined from the multiple instructions.
[0074] For example, when determining the standard instructions corresponding to the basic image data from multiple instructions, an upper limit on the number of standard instructions corresponding to the basic image data is usually set. If the upper limit is exceeded, they will be automatically allocated to the next basic image and a warning message will be issued, so that business personnel can reset the upper limit on the number of standard instructions corresponding to the basic image data based on the warning message.
[0075] Assume that there are three data requirement descriptions, namely data requirement description 1, data requirement description 2 and data requirement description 3, among which the basic image data corresponding to data requirement description 1 is basic image data 1, the basic image data corresponding to data requirement description 2 is basic image data 2, and the basic image data corresponding to data requirement description 3 is basic image data 1. The data construction script corresponding to data requirement description 1 is split, and it is assumed that the instructions after the split include instruction 1, instruction 2, and instruction 3; the data construction script corresponding to data requirement description 2 is split, and it is assumed that the instructions after the split include instruction 4, instruction 5, instruction 6 and instruction 7; the data construction script corresponding to data requirement description 3 is split, and it is assumed that the instructions after the split include instruction 8, instruction 9, instruction 10 and instruction 11, the instructions after splitting corresponding to the basic image data 1 include: instruction 1, instruction 2, instruction 3, instruction 8, instruction 9, instruction 10 and instruction 11; the instructions after splitting corresponding to the basic image data 1 include: instruction 4, instruction 5, instruction 6 and instruction 7; assuming that for the basic image data 1, the user selects instruction 1, instruction 2, instruction 3, instruction 8 and instruction 9, then it is determined that the instructions after splitting corresponding to the basic image data 1 include: instruction 1, instruction 2, instruction 3, instruction 8 and instruction 9; for the basic image data 2, the user selects instruction 9, instruction 10 and instruction 11, then it is determined that the instructions after splitting corresponding to the basic image data 2 include: instruction 9, instruction 10 and instruction 11.
[0076] In this way, by splitting the data construction scripts corresponding to data requirement description 1 and data requirement description 3, standardized instructions are obtained; and through the same basic image data 1, the instructions after the data construction scripts corresponding to data requirement description 1 and data requirement description 3 are split, packaged and recombined, so that the same basic image data can execute multiple data construction scripts, thereby increasing the construction data density of the basic image data and achieving the purpose of generating more test data in one execution.
[0077] By way of example, in an embodiment of the present application, for the standard instructions corresponding to each basic image data, instruction description information is randomly added to the standard instructions when the standard instructions are not marked with instruction description information, thereby achieving diversified processing of the standard instructions. In this way, through multiple rounds of execution, the diversity of test data can be effectively improved.
[0078] For example, when randomly adding instruction description information to standard instructions, it can be based on the basic data dictionary, as shown in Tables 1 and 2 below, where Table 1 is a contract data attribute dictionary and Table 2 is a customer data attribute dictionary. Instruction description information is randomly added to standard instructions, thereby achieving diversified processing of standard instructions.
[0079] Table 1
[0080] Table 2
[0081] In order to facilitate understanding of the method for generating test data provided in the embodiment of the present application, the following will be combined with Figure 4 The framework shown is used to describe in detail the method for generating test data provided in the embodiment of the present application.
[0082] Figure 4 A schematic diagram of a test data generation method provided in an embodiment of the present application, combined with Figure 4 As shown, the framework can include a data requirement description module, an AIGC code generation module, a standard instruction entry module, a diversity processing module, an instruction storage module, a scheduling center module, an instruction interface service module, an environment-driven service module, and an execution storage module.
[0083] Among them, the data requirement description module is used to receive the data requirement description input by the user, and the AIGC code generation module uses the AIGC code generation model to convert the data requirement description into the corresponding data construction script; the standard instruction entry module is used to split the data construction script to obtain multiple corresponding instructions, and package the instructions corresponding to the same basic image data to obtain multiple standard instructions corresponding to the basic image data; the diversity processing module is used to randomly add instruction description information to the standard instructions when the standard instructions are not marked with instruction description information, so as to realize diversified processing of the standard instructions; and the standard instructions packaged with each basic image data are stored in the instruction storage module.
[0084] In this way, in an actual application scenario, if it is necessary to generate target test data corresponding to the target system under test, the scheduling center module is used to search for multiple target standard instructions corresponding to the target basic image data from the instruction storage module based on the target basic image data corresponding to the target test data, and sort the multiple target standard instructions based on the execution state parameters of each of the multiple target standard instructions. When the sorted multiple target standard instructions are input into the target system under test in turn, for each target standard instruction, it is determined whether the current execution state parameters of the target system under test meet the execution state parameters of the traversed target standard instructions. If not, the current execution state parameters of the target system under test are adjusted through the environment driving service module. If satisfied, the target standard instruction is input into the target system under test through the instruction interface service module. The execution storage module is used to store multiple target standard instructions and the response results for each of the multiple target standard instructions. On the one hand, an execution log can be generated to help testers investigate execution anomalies; on the other hand, by storing the response results for each of the multiple target standard instructions, it is used for parameter reference of subsequent standard instructions.
[0085] The test data generating device provided in the present application is described below. The test data generating device described below and the test data generating method described above can be referenced to each other.
[0086] Figure 5 A schematic diagram of a test data generating device provided in an embodiment of the present application, for example, see Figure 5 As shown, the test data generating device 50 may include: A first processing unit 501 is configured to generate instructions for test data of a target system under test, and determine, based on target basic image data of the target system under test, a plurality of target standard instructions corresponding to the target basic image data from a standard instruction library; wherein the standard instructions stored in the standard instruction library are obtained based on a data construction script, the data construction script is generated by inputting a data requirement description into a large language model, and the large language model is obtained by training based on a plurality of data requirement description samples; The second processing unit 502 is configured to generate target test data corresponding to the target system under test based on the multiple target standard instructions.
[0087] For example, in the embodiment of the present application, the second processing unit 502 is used to generate target test data corresponding to the target system under test based on the multiple target standard instructions, including: sorting the plurality of target standard instructions based on respective execution status parameters of the plurality of target standard instructions; Traversing the sorted multiple target standard instructions, and inputting the traversed target standard instructions into the target system under test when the current execution state parameters of the target system under test meet the execution state parameters of the traversed target standard instructions; The target test data is generated based on the response results of the target system under test to each of the plurality of target standard instructions.
[0088] For example, in the embodiment of the present application, the test data generating device 50 further includes: The third processing unit is used to adjust the current execution state parameters to the execution state parameters of the traversed target standard instructions when the current execution state parameters of the target system under test do not meet the execution state parameters of the traversed target standard instructions, and input the traversed target standard instructions to the target system under test after adjusting the current execution state parameters.
[0089] For example, in the embodiment of the present application, the test data generating device 50 further includes: An acquisition unit, used for acquiring multiple data requirement descriptions; A fourth processing unit, configured to input the plurality of data requirement descriptions into the large language model respectively, to obtain a data construction script corresponding to each of the data requirement descriptions; The fifth processing unit is used to split the data construction script corresponding to each of the data requirement descriptions to obtain the standard instructions.
[0090] For example, in the embodiment of the present application, the fifth processing unit is used to split the data construction script corresponding to each of the data requirement descriptions to obtain the standard instructions, including: Determine the basic image data corresponding to each of the multiple data requirement descriptions; For each of the basic image data, determine a plurality of instructions corresponding to the basic image data after the data construction script is split; In response to a selection operation on the plurality of instructions, a standard instruction corresponding to the basic image data is determined from the plurality of instructions.
[0091] For example, in the embodiment of the present application, the test data generating device 50 further includes: The sixth processing unit is configured to randomly add instruction description information to the standard instructions corresponding to each of the basic image data when the standard instructions are not marked with instruction description information.
[0092] The test data generating device 50 provided in the embodiment of the present application can execute the technical solution of the test data generating method in any of the above-mentioned embodiments, and its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the test data generating method. Please refer to the implementation principle and beneficial effects of the test data generating method, which will not be repeated here.
[0093] Figure 6 A schematic diagram of the physical structure of an electronic device provided in an embodiment of the present application, such as Figure 6As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the test data generation method, the method comprising: in response to the test data generation instruction for the target system under test, based on the target basic image data of the target system under test, determining multiple target standard instructions corresponding to the target basic image data from the standard instruction library; wherein the standard instructions stored in the standard instruction library are obtained based on the data construction script, the data construction script is generated by inputting the data requirement description into the large language model, and the large language model is obtained based on the training of multiple data requirement description samples; based on the multiple target standard instructions, generating the target test data corresponding to the target system under test.
[0094] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0095] On the other hand, the present application also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the test data generation method provided by the above methods, the method including: in response to a test data generation instruction for a target system under test, based on the target basic image data of the target system under test, determining from a standard instruction library a plurality of target standard instructions corresponding to the target basic image data; wherein the standard instructions stored in the standard instruction library are obtained based on a data construction script, the data construction script is generated by inputting a data requirement description into a large language model, and the large language model is obtained based on training of multiple data requirement description samples; based on the multiple target standard instructions, generating target test data corresponding to the target system under test.
[0096] On the other hand, the present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the test data generation method provided by the above-mentioned methods, the method comprising: in response to a test data generation instruction for a target system under test, based on the target basic image data of the target system under test, determining from a standard instruction library a plurality of target standard instructions corresponding to the target basic image data; wherein the standard instructions stored in the standard instruction library are obtained based on a data construction script, the data construction script is generated by inputting a data requirement description into a large language model, and the large language model is obtained by training based on a plurality of data requirement description samples; based on the plurality of target standard instructions, generating target test data corresponding to the target system under test.
[0097] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0098] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for generating test data, characterized in that: include: In response to a test data generation instruction for a target system under test, based on the target basic image data of the target system under test, a plurality of target standard instructions corresponding to the target basic image data are determined from a standard instruction library; wherein the standard instructions stored in the standard instruction library are obtained based on a data construction script, the data construction script is generated by inputting a data requirement description into a large language model, and the large language model is obtained by training based on a plurality of data requirement description samples; Based on the multiple target standard instructions, target test data corresponding to the target system under test is generated.
2. The method for generating test data according to claim 1, characterized in that: The step of generating target test data corresponding to the target system under test based on the multiple target standard instructions includes: sorting the plurality of target standard instructions based on respective execution status parameters of the plurality of target standard instructions; Traversing the sorted multiple target standard instructions, and inputting the traversed target standard instructions into the target system under test when the current execution state parameters of the target system under test meet the execution state parameters of the traversed target standard instructions; The target test data is generated based on the response results of the target system under test to each of the multiple target standard instructions.
3. The method for generating test data according to claim 2, characterized in that: The method further comprises: When the current execution state parameters of the target system under test do not meet the execution state parameters of the traversed target standard instructions, the current execution state parameters are adjusted to the execution state parameters of the traversed target standard instructions, and the traversed target standard instructions are input into the target system under test after adjusting the current execution state parameters.
4. The method for generating test data according to any one of claims 1 to 3, characterized in that: The method further comprises: Get multiple data requirement descriptions; Inputting the plurality of data requirement descriptions into the large language model respectively to obtain a data construction script corresponding to each of the data requirement descriptions; The data construction script corresponding to each of the data requirement descriptions is split to obtain the standard instructions.
5. The method for generating test data according to claim 4, characterized in that: The step of splitting the data construction script corresponding to each of the data requirement descriptions to obtain the standard instructions includes: Determine the basic image data corresponding to each of the multiple data requirement descriptions; For each of the basic image data, determine a plurality of instructions corresponding to the basic image data after the data construction script is split; In response to a selection operation on the plurality of instructions, a standard instruction corresponding to the basic image data is determined from the plurality of instructions.
6. The method for generating test data according to claim 5, characterized in that: The method further comprises: For each standard instruction corresponding to the basic image data, if the standard instruction is not marked with instruction description information, instruction description information is randomly added to the standard instruction.
7. A test data generating device, characterized in that: include: A first processing unit is configured to generate instructions for test data of a target system under test, and determine, from a standard instruction library, a plurality of target standard instructions corresponding to the target basic image data based on the target basic image data of the target system under test; wherein the standard instructions stored in the standard instruction library are obtained based on a data construction script, the data construction script is generated by inputting a data requirement description into a large language model, and the large language model is obtained by training based on a plurality of data requirement description samples; The second processing unit is used to generate target test data corresponding to the target system under test based on the multiple target standard instructions.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method for generating test data according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating test data according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for generating test data according to any one of claims 1 to 6 is implemented.