Test data generation method and apparatus, device, and storage medium
Patent Information
- Application Number
- CN202211648141.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-21
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2042-12-21
AI Technical Summary
因此,测试人员需要在不同的测试环境下准备不同的测试数据,现有的人工准备测试数据的方法工作量大且繁琐
[0050]接收客户端发送的接口报文;所述接口报文中包括真实测试数据;
Smart Images

Figure CN116010256B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of big data technology, and in particular to a method, apparatus, device and storage medium for generating test data. Background Technology
[0002] With the popularization of agile iteration concepts, software project deployment times are characterized by longer, more flexible, and dynamically modifiable durations. To cope with these flexible and changing agile requirements, it is often necessary to test in multiple testing environments. Generally, different testing environments require independent test data. For example, in the A function testing environment, login data consisting of mobile phone accounts and verification codes can be used. Moreover, in some testing environments, test data cannot be reused after a single use, requiring the preparation of a large amount of test data. For example, in transaction testing environments such as coupon grabbing and points redemption, a large amount of test data is needed. Therefore, testers need to prepare different test data for different testing environments, and existing methods for manually preparing test data are labor-intensive and tedious. Summary of the Invention
[0003] Therefore, it is necessary to provide a test data generation method, apparatus, device, and storage medium that can improve testing efficiency in response to the above-mentioned technical problems.
[0004] Firstly, this application provides a method for generating test data, the method comprising:
[0005] Retrieve the first production data from the production database;
[0006] Based on the first production data and the initial data, a production model is created to obtain candidate test data;
[0007] Receive interface messages sent by the client; the interface messages include real test data;
[0008] The initial data production model is trained based on the candidate test data and the real test data to obtain the target data production model;
[0009] Obtain the second production data from the production database, and generate test data based on the second production data and the target data production model.
[0010] In one embodiment, the candidate test data includes training data and validation data; the step of training the initial data production model based on the candidate test data and the real test data to obtain the target data production model includes:
[0011] Determine the degree of difference between the training data and the real test data;
[0012] The candidate data production model is determined based on the degree of difference.
[0013] Based on the real test data and the verification data, the candidate data production model is trained to obtain the target data production model.
[0014] In one embodiment, determining the candidate model based on the degree of difference includes:
[0015] If the degree of difference is greater than a preset degree of difference, then the initial data production model is trained based on the degree of difference between the training data and the real test data to obtain the candidate data production model.
[0016] In one embodiment, the method further includes:
[0017] If the degree of difference is not greater than the preset degree of difference, then the initial data production model is used as the candidate data production model.
[0018] In one embodiment, training the candidate data production model based on the real test data and the verification data to obtain the target data production model includes:
[0019] Based on the verification data and the candidate data production model, the data to be tested is determined;
[0020] Based on the test data and the actual test data, the candidate data production model is trained to obtain the target data production model.
[0021] In one embodiment, the interface message further includes the source address of the client, and the method further includes:
[0022] The data type of the actual test data is determined based on the source address of the client;
[0023] The step of training the initial data production model based on the candidate test data and the real test data to obtain the target data production model includes:
[0024] The initial data production model is trained based on the candidate test data and the real test data of different data types from different clients to obtain the target data production model.
[0025] In one embodiment, the method further includes:
[0026] The test data is stored in the target database;
[0027] Obtain log information corresponding to the test data stored in the target database; the log information includes the storage time corresponding to the test data;
[0028] Determine the test data corresponding to the storage time within a preset time period, and store the test data corresponding to the storage time within the preset time period in other test databases.
[0029] Secondly, this application also provides a test data generation apparatus, the apparatus comprising:
[0030] The first acquisition module is used to acquire the first production data from the production database.
[0031] The first determining module is used to produce a model based on the first production data and the initial data to obtain candidate test data;
[0032] The receiving module is used to receive interface messages sent by the client; the interface messages include real test data.
[0033] The training module is used to train the initial data production model based on the candidate test data and the real test data to obtain the target data production model;
[0034] The second acquisition module is used to acquire the second production data in the production database and generate test data based on the second production data and the target data production model.
[0035] Thirdly, this application also provides a computer device, the computer device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0036] Retrieve the first production data from the production database;
[0037] Based on the first production data and the initial data, a production model is created to obtain candidate test data;
[0038] Receive interface messages sent by the client; the interface messages include real test data;
[0039] The initial data production model is trained based on the candidate test data and the real test data to obtain the target data production model;
[0040] Obtain the second production data from the production database, and generate test data based on the second production data and the target data production model.
[0041] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0042] Retrieve the first production data from the production database;
[0043] Based on the first production data and the initial data, a production model is created to obtain candidate test data;
[0044] Receive interface messages sent by the client; the interface messages include real test data;
[0045] The initial data production model is trained based on the candidate test data and the real test data to obtain the target data production model;
[0046] Obtain the second production data from the production database, and generate test data based on the second production data and the target data production model.
[0047] Fifthly, this application also provides a computer program product, which includes a computer program that, when executed by a processor, performs the following steps:
[0048] Retrieve the first production data from the production database;
[0049] Based on the first production data and the initial data, a production model is created to obtain candidate test data;
[0050] Receive interface messages sent by the client; the interface messages include real test data;
[0051] The initial data production model is trained based on the candidate test data and the real test data to obtain the target data production model;
[0052] Obtain the second production data from the production database, and generate test data based on the second production data and the target data production model.
[0053] The aforementioned test data generation method, apparatus, device, and storage medium obtain first production data from a production database, generate candidate test data based on the first production data and an initial data production model, receive interface messages sent by the client (since the interface messages include real test data), train the initial data production model based on the candidate test data and real test data to obtain a target data production model, obtain second production data from the production database, and generate test data based on the second production data and the target data production model. In this method, the initial data production model is trained based on real test data and the first production data to obtain the target data production model. Since the production database includes all basic data, a large amount of test data can be generated based on the second production data in the production database and the target production data model, avoiding the large workload and tediousness caused by manually preparing different test data for different test environments. Attached Figure Description
[0054] Figure 1 This is a diagram illustrating the application environment of a test data generation method in one embodiment;
[0055] Figure 2 This is a flowchart illustrating a test data generation method in one embodiment;
[0056] Figure 3 This is a flowchart illustrating the process of determining the target data production model in one embodiment;
[0057] Figure 4 This is a flowchart illustrating the process of determining the target data production model in another embodiment;
[0058] Figure 5 This is a flowchart illustrating the process of determining the target data production model in yet another embodiment;
[0059] Figure 6 This is a flowchart illustrating the test data generation method in another embodiment;
[0060] Figure 7 This is a structural block diagram of a test data generation device in one embodiment;
[0061] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0062] 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.
[0063] It should be noted that the test data generation method, apparatus, computer equipment, storage medium and program products disclosed in this application can be applied in the field of big data technology or other technical fields.
[0064] The test data generation method provided in this application embodiment can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located in the cloud or on other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0065] In one embodiment, such as Figure 2 As shown, a test data generation method is provided, which can be applied to... Figure 1 Taking the server in the example, the following steps are included:
[0066] S201, retrieve the first production data from the production database.
[0067] The production database refers to the database actually used in business operations, which contains the necessary basic data resources.
[0068] In this embodiment, the server obtains the first production data from the production database. Since the production database includes all the basic data actually used in the business, the first production data also includes various data, such as mobile phone numbers, verification codes, matrices representing images, Chinese characters, accounts, login passwords, etc.
[0069] S202, Based on the first production data and the initial data production model, candidate test data is obtained.
[0070] In this embodiment, the initial data production model can be a deep learning network, a shallow learning network, or a mathematical algorithm. When the initial data production model is a network, it can be an existing learning network or a network constructed by the user based on the actual situation.
[0071] In one possible implementation, the first production data is input into the initial data production model, and the initial data production model is used to filter the first production data to obtain candidate test data.
[0072] S203, Receive interface messages sent by the client; the interface messages include real test data.
[0073] In this embodiment, a network connection is first established between the client and the server. The client sends an interface message to the server. After receiving the interface message, the server parses it to obtain the actual test data corresponding to the client at that moment. Optionally, the actual test data can be a mobile phone number, a verification code, a login account, etc.
[0074] S204. Train the initial data production model based on the candidate test data and the real test data to obtain the target data production model.
[0075] In this embodiment, the initial data production model can be trained directly using candidate test data, and the trained model can be validated using real test data to obtain the target data production model. For example, candidate test data can be compared with real test data, and the initial data production model can be trained based on the comparison results until the difference between the candidate test data and the real test data is less than a preset level, at which point the training is complete, and the target data production model is obtained.
[0076] Alternatively, candidate test data can be divided into training data and validation data. The training data is compared with real test data, and the initial data production model is trained based on the comparison results. Finally, the trained data production model is validated using validation data to obtain the target data production model. For example, the training data is compared with real test data, and if the comparison results do not meet the first preset requirement, the initial data production model is trained based on the comparison results to obtain a candidate data production model. Then, the candidate data production model is trained using validation data and real test data to obtain the target data production model.
[0077] Alternatively, candidate test data can be divided into training data and validation data. All three types of data—training, validation, and real test data—are then input into the initial data production model. Since the real test data serves as the gold standard, its output in the target network model should be close to 100% recognition, meaning all real test data is more likely to be recognized and output. Therefore, by ensuring that the outputs of both the training and validation data closely approximate the outputs of the real test data (with as many real test data as possible being recognized and output), the initial data production model can be trained, resulting in the target data production model.
[0078] S205, Obtain the second production data from the production database, and generate test data based on the second production data and the target data production model.
[0079] In this embodiment, the server obtains the second production data from the production database, inputs the second production data into the target data production model, and uses the target data production model to identify and filter the second production data to obtain test data.
[0080] Furthermore, the obtained test data can be sent to the client in the form of an interface message, so that the client can complete the functional test based on the generated test data.
[0081] In the aforementioned test data generation method, first production data is obtained from the production database. Candidate test data is then generated based on the first production data and an initial data production model. Interface messages sent by the client are received; since these messages contain real test data, the initial data production model is trained using the candidate test data and the real test data to obtain a target data production model. Second production data is then obtained from the production database, and test data is generated based on this second production data and the target data production model. This method trains the initial data production model using real test data and the first production data to obtain the target data production model. Because the production database contains all the basic data, a large amount of test data can be generated based on the second production data and the target production data model, avoiding the large workload and tediousness of manually preparing different test data for different testing environments.
[0082] Figure 3 This is a flowchart illustrating the process of determining a target data production model in one embodiment. This embodiment relates to a possible implementation of how to train an initial data production model based on candidate test data and real test data to obtain the target data production model. Figure 3 As shown, it includes the following steps:
[0083] S301, determine the degree of difference between the training data and the real test data.
[0084] In this embodiment, the degree of difference between training data and real test data can be the percentage of training data that meets the requirements out of the entire training data, or it can be the degree of deviation of the inconsistent data when the training data and real test data are inconsistent.
[0085] In one possible implementation, the training data can be directly compared with the real test data one by one to obtain the degree of difference between the training data and the real test data. For example, if the real test data is a mobile phone number, the training data can be directly compared to see if it is an integer. If the training data is an integer, it can be compared to see if it meets the requirement of eleven digits. If it does, it can be further determined whether the first digit of the eleven digits is 1. If so, the training data is considered to be consistent with the real test data. Finally, the percentage of training data that meets the requirements is obtained.
[0086] Alternatively, if the training data does not conform to the integer type, this case is recorded as a deviation of 5 from the actual test data; if the training data conforms to the integer type but does not meet the requirement of eleven digits, this case is recorded as a deviation of 3 from the actual test data; if the training data meets the requirement of eleven digits, but the first digit is not 1, this case is recorded as a deviation of 2 from the actual test data; if the training data meets the requirement of eleven digits and the first digit is 1, i.e., consistent with the actual test data, this case is recorded as a deviation of 0 from the actual test data. Statistical methods can be used to obtain the deviation of all training data, and this deviation can be used as the degree of difference between the training data and the actual test data.
[0087] In another possible implementation, the network model can be used to determine the degree of difference between the training data and the real test data. For example, by inputting the real test data and the training data into the network classification model respectively, if the classification accuracy of the real test data is 100% (only one class is classified), and the training data is classified into four classes, then the degree of difference between the training data and the real test data can be considered to be 75%.
[0088] S302, determine the candidate data production model based on the degree of difference.
[0089] In this embodiment, when determining the candidate data production model based on the degree of difference, the degree of difference can be compared with a preset degree of difference. If the degree of difference is greater than the preset degree of difference, the initial data production model is trained to obtain the candidate data production model. Alternatively, the initial data production model can be trained directly based on the degree of difference, i.e., the magnitude of the degree of difference is not considered.
[0090] Furthermore, "determining the candidate data production model based on the degree of difference" includes the following two methods:
[0091] The first approach: If the degree of difference is greater than the preset degree of difference, then train the initial data production model based on the degree of difference between the training data and the real test data to obtain the candidate data production model.
[0092] Optionally, the preset difference level can be a percentage or a deviation level, depending on the degree of difference between the training data and the actual test data determined in S301 above. When the difference level is a percentage, the corresponding preset difference level is also a percentage.
[0093] In this embodiment, when the degree of difference is greater than a preset degree of difference, it proves that the initial data production model has certain defects in identifying mobile phone numbers. For example, if the degree of difference is 50% and the preset degree of difference is 15%, the parameters in the initial data model, the number of network layers, etc., can be adjusted, or the training method of the initial data production model can be changed. Then, the first production data is input into the adjusted data model to obtain new candidate test data. The degree of difference between the training data and the real test data in the candidate test data is further compared until the degree of difference is less than the preset degree of difference.
[0094] It should be noted that when the first production data is input into the adjusted data production model to complete a new round of iteration, the degree of difference between the training data and the real test data can be determined in the same way and comparison form as before, or a different method can be used each time.
[0095] The second approach is to use the initial data production model as a candidate data production model if the degree of difference is not greater than the preset degree of difference.
[0096] In this embodiment, if the degree of difference is not greater than the preset degree of difference, it proves that the selected initial data production model can be used to generate test data, and then the initial data production model is directly used as the candidate data production model.
[0097] S303: Based on real test data and validation data, train the candidate data production model to obtain the target data production model.
[0098] In this embodiment, a candidate data production model is trained based on real test data and validation data. The validation output can be input into the candidate data production model to obtain the data to be tested. The data to be tested is compared with the real test data to obtain a comparison result. Based on the comparison result, the candidate data production model is trained to obtain the target data production model. Although both validation data and training data are candidate test data, i.e., both are obtained from the initial data production model, there are still some differences between the training data and validation data when dividing the candidate test data. Therefore, the real test data and validation data can also be compared first to obtain a comparison result. Based on the comparison result, the candidate data production model can be trained to obtain the target data production model.
[0099] In the above embodiments, by determining the degree of difference between training data and real test data, candidate data production models are determined based on the degree of difference. Then, based on the real test data and validation data, the candidate data production models are trained to obtain the target data production model. This embodiment provides multiple implementation methods for determining the target data production model, offering users a variety of choices. Furthermore, this embodiment provides two possible implementation methods for determining the candidate data production model: when the degree of difference is greater than a preset degree of difference, an initial data production model is trained based on the degree of difference between the training data and real test data to obtain a candidate data production model; when the degree of difference is not greater than a preset degree of difference, the initial data production model is used as the candidate data production model, thus improving the training speed of the target data production model.
[0100] Figure 4 This is a flowchart illustrating the process of determining the target data production model in another embodiment. This embodiment relates to a possible implementation of how to train a candidate data production model based on real test data and validation data to obtain the target data production model, such as... Figure 4 As shown, it includes the following steps:
[0101] S401, Based on the validation data and candidate data, a model is generated to determine the data to be tested.
[0102] In this embodiment, the verification data can be input into the candidate data production model, and the candidate data production model can be used to filter the verification data to obtain the test data.
[0103] S402, Based on the test data and the actual test data, train the candidate data production model to obtain the target data production model.
[0104] In this embodiment, a candidate data production model is trained based on the test data and the actual test data to obtain the target data production model. For specific implementation details, please refer to the above. Figure 3 In the illustrated embodiment, the test data is input into the candidate data production model to obtain the output result. The output result is compared with the real test data to obtain the comparison result. The candidate data production model is then trained based on the comparison result to obtain the target data production model.
[0105] In one possible implementation, both the test data and the actual test data can be simultaneously input into the candidate data production model, with the output of the actual test data serving as the gold standard. Since the candidate data production model is constantly being adjusted, the results of the test data change, and the output of the actual test data also changes. As long as the output of the actual test data remains within the fluctuation range of the gold standard, the candidate data production model can be trained based on the output of the test data to obtain the target data production model.
[0106] In the above embodiments, the test data is determined based on the validation data and the candidate data production model. Then, based on the test data and the actual test data, the candidate data production model is trained to obtain the target data production model. In this embodiment, further training based on the validation data and the actual test data makes the determined target data production model more accurate, thereby ensuring that the test data obtained from the target data production model better reflects the actual testing functions.
[0107] Figure 5 This is a flowchart illustrating the process of determining the target data production model in another embodiment. This embodiment involves a possible implementation of how to train an initial data production model based on candidate test data and real test data of different data types from different clients to obtain the target data production model, such as... Figure 5 As shown, it includes the following steps:
[0108] S501 determines the data type of the actual test data based on the client's source address.
[0109] In this embodiment, the interface message sent by the client is received. The interface message includes actual test data and the client's source address. The data type of the actual test data can be determined based on the client's source address, or in other words, the corresponding test function can be determined based on the client's source address. For example, client A tests the payment function, client B tests the login function, and client C tests the sending function. Then, the actual test data in the interface message sent by client A includes the payment amount, payment password, and received amount; the actual test data in the interface message sent by client B includes the verification code, login account, and login password; and the actual test data in the interface message sent by client C includes sending information and receiving information.
[0110] In one possible implementation, the data type of the actual test data can refer to the data storage type: the data type of the actual test data in the interface message sent by client A may include integer and floating-point types, the data type of the actual test data in the interface message sent by client B may include string and integer types, and the data type of the actual test data in the interface message sent by client C may include string, integer, floating-point, etc.
[0111] Alternatively, the data type of the actual test data can be different types of information. For example, the data type of the actual test data in the interface message sent by client A may be numbers, the data type of the actual test data in the interface message sent by client B may be images, and the data type of the actual test data in the interface message sent by client C may be voice information and Chinese text information, etc.
[0112] It should be noted that the test data in the interface messages sent by the same client can include only one type or multiple types.
[0113] S502: Based on candidate test data and real test data of different data types from different clients, train the initial data production model to obtain the target data production model.
[0114] In this embodiment, an initial data production model is trained based on candidate test data and real test data of different data types from different clients, resulting in target data production models for different data types.
[0115] Furthermore, since the data type of the actual test data can be determined based on the source address of the client, the resulting target data production model is more targeted. When the data types of test function A and test function B are similar, the resulting target data production model for test function A can be used as the initial data production model for test function B, thereby improving the training speed of the target data production model for test function B.
[0116] In the above embodiments, the data type of the real test data is determined based on the client's source address. An initial data production model is trained using candidate test data and real test data of different data types from different clients to obtain the target data production model. In this embodiment, different test data types can be determined based on the client's source address, making the resulting target data type more targeted.
[0117] In one embodiment, a test data generation method is provided, such as... Figure 6 As shown, it includes the following steps:
[0118] S601, retrieve the first production data from the production database.
[0119] S602, based on the first production data and the initial data production model, candidate test data is obtained.
[0120] S603 receives interface messages sent by the client; the interface messages include real test data.
[0121] S604, determine the degree of difference between the training data and the real test data. Execute S605 or S606.
[0122] S605, if the degree of difference is greater than the preset degree of difference, then train the initial data production model according to the degree of difference between the training data and the real test data to obtain the candidate data production model.
[0123] S606 If the degree of difference is not greater than the preset degree of difference, then the initial data production model will be used as the candidate data production model.
[0124] S607, Based on the validation data and candidate data, a model is generated to determine the data to be tested.
[0125] S608: Based on the test data and the actual test data, train the candidate data production model to obtain the target data production model.
[0126] S609, Obtain the second production data from the production database, and generate test data based on the second production data and the target data production model.
[0127] In this embodiment, first production data is obtained from the production database. Candidate test data is obtained based on the first production data and an initial data production model. Interface messages sent by the client are received. Since the interface messages include real test data, the initial data production model is trained based on the candidate test data and the real test data to obtain a target data production model. Second production data is obtained from the production database, and test data is generated based on the second production data and the target data production model. This method trains the initial data production model based on real test data and the first production data to obtain the target data production model. Because the production database includes all basic data, a large amount of test data can be generated based on the second production data and the target production data model in the production database. This avoids the large workload and tediousness caused by manually preparing different test data for different testing environments.
[0128] In one embodiment, a method for generating test data is provided, including the following steps:
[0129] Store the test data in the target database; obtain the log information corresponding to the test data stored in the target database; the log information includes the storage time corresponding to the test data; determine the test data corresponding to the storage time within the preset time period, and store the test data corresponding to the storage time within the preset time period in other test databases.
[0130] In this embodiment, after obtaining test data according to the target data production model, it can be recorded in the target database as relational data. The target database can include test data of various test types, and general relational databases have log information recording database changes, including the storage time corresponding to the test data. Based on the storage time, different test types of test data can be identified. By determining the test data corresponding to the storage time within a preset time period, test data of different test types can be obtained. In this embodiment, after obtaining test data according to the target data production model, the test data can also be copied extensively, providing multiple methods for generating test data.
[0131] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly 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 steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0132] Based on the same inventive concept, this application also provides a test data generation apparatus for implementing the test data generation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more test data generation apparatus embodiments provided below can be found in the limitations of the test data generation method described above, and will not be repeated here.
[0133] In one embodiment, such as Figure 7 As shown, a test data generation device is provided, comprising: a first acquisition module 11, a first determination module 12, a receiving module 13, a training module 14, and a second acquisition module 15, wherein:
[0134] The first acquisition module 11 is used to acquire the first production data in the production database;
[0135] The first determining module 12 is used to produce a model based on the first production data and the initial data to obtain candidate test data;
[0136] The receiving module 13 is used to receive interface messages sent by the client; the interface messages include real test data.
[0137] Training module 14 is used to train the initial data production model based on candidate test data and real test data to obtain the target data production model;
[0138] The second acquisition module 15 is used to acquire the second production data in the production database and generate test data based on the second production data and the target data production model.
[0139] In one embodiment, the training module includes:
[0140] The first determining unit is used to determine the degree of difference between the training data and the real test data;
[0141] The second determining unit is used to determine the candidate data production model based on the degree of difference.
[0142] The training unit is used to train the candidate data production model based on real test data and validation data, and obtain the target data production model.
[0143] In one embodiment, the second determining unit is further configured to, if the degree of difference is greater than a preset degree of difference, train an initial data production model based on the degree of difference between the training data and the real test data to obtain a candidate data production model.
[0144] In one embodiment, the second determining unit is further configured to use the initial data production model as a candidate data production model if the degree of difference is not greater than a preset degree of difference.
[0145] In one embodiment, the training unit is further configured to generate a model based on validation data and candidate data, determine the test data, and train the candidate data production model based on the test data and real test data to obtain the target data production model.
[0146] In one embodiment, the test data generation apparatus further includes:
[0147] The second determining module is used to determine the data type of the actual test data based on the source address of the client;
[0148] The training module is also used to train the initial data production model based on candidate test data and real test data of different data types from different clients, so as to obtain the target data production model.
[0149] In one embodiment, the test data generation apparatus further includes:
[0150] The storage module is used to store test data in the target database;
[0151] The third acquisition module is used to acquire log information corresponding to the test data stored in the target database; the log information includes the storage time of the test data.
[0152] The third determining module is used to determine the test data corresponding to the storage time within a preset time period, and to store the test data corresponding to the storage time within the preset time period into other test databases.
[0153] Each module in the aforementioned test data generation 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.
[0154] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores test data-related data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a test data generation method.
[0155] Those skilled in the art will understand that Figure 8 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.
[0156] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0157] Retrieve the first production data from the production database;
[0158] Based on the first production data and the initial data production model, candidate test data are obtained;
[0159] Receive interface messages sent by the client; the interface messages include real test data;
[0160] The initial data production model is trained based on candidate test data and real test data to obtain the target data production model;
[0161] Obtain the second production data from the production database, and generate test data based on the second production data and the target data production model.
[0162] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0163] Determine the degree of difference between the training data and the real test data;
[0164] Determine the candidate data production model based on the degree of difference;
[0165] Based on real test data and validation data, a candidate data production model is trained to obtain a target data production model.
[0166] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0167] If the degree of difference is greater than the preset degree of difference, then the initial data production model is trained based on the degree of difference between the training data and the real test data to obtain the candidate data production model.
[0168] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0169] If the degree of difference is not greater than the preset degree of difference, the initial data production model will be used as the candidate data production model.
[0170] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0171] Based on the validation data and candidate data, a model is generated to determine the data to be tested;
[0172] Based on the test data and the actual test data, a candidate data production model is trained to obtain the target data production model.
[0173] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0174] The data type of the actual test data is determined based on the source address of the client;
[0175] The initial data production model is trained based on candidate test data and real test data to obtain the target data production model, including:
[0176] Based on candidate test data and real test data of different data types from different clients, an initial data production model is trained to obtain the target data production model.
[0177] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0178] Store the test data in the target database;
[0179] Retrieve log information corresponding to the test data stored in the target database; the log information includes the storage time of the test data;
[0180] Determine the test data corresponding to the storage time within the preset time period, and store the test data corresponding to the storage time within the preset time period in other test databases.
[0181] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0182] Retrieve the first production data from the production database;
[0183] Based on the first production data and the initial data production model, candidate test data are obtained;
[0184] Receive interface messages sent by the client; the interface messages include real test data;
[0185] The initial data production model is trained based on candidate test data and real test data to obtain the target data production model;
[0186] Obtain the second production data from the production database, and generate test data based on the second production data and the target data production model.
[0187] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0188] Determine the degree of difference between the training data and the real test data;
[0189] Determine the candidate data production model based on the degree of difference;
[0190] Based on real test data and validation data, a candidate data production model is trained to obtain a target data production model.
[0191] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0192] If the degree of difference is greater than the preset degree of difference, then the initial data production model is trained based on the degree of difference between the training data and the real test data to obtain the candidate data production model.
[0193] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0194] If the degree of difference is not greater than the preset degree of difference, the initial data production model will be used as the candidate data production model.
[0195] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0196] Based on the validation data and candidate data, a model is generated to determine the data to be tested;
[0197] Based on the test data and the actual test data, a candidate data production model is trained to obtain the target data production model.
[0198] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0199] The data type of the actual test data is determined based on the source address of the client;
[0200] The initial data production model is trained based on candidate test data and real test data to obtain the target data production model, including:
[0201] Based on candidate test data and real test data of different data types from different clients, an initial data production model is trained to obtain the target data production model.
[0202] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0203] Store the test data in the target database;
[0204] Retrieve log information corresponding to the test data stored in the target database; the log information includes the storage time of the test data;
[0205] Determine the test data corresponding to the storage time within the preset time period, and store the test data corresponding to the storage time within the preset time period in other test databases.
[0206] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0207] Retrieve the first production data from the production database;
[0208] Based on the first production data and the initial data production model, candidate test data are obtained;
[0209] Receive interface messages sent by the client; the interface messages include real test data;
[0210] The initial data production model is trained based on candidate test data and real test data to obtain the target data production model;
[0211] Obtain the second production data from the production database, and generate test data based on the second production data and the target data production model.
[0212] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0213] Determine the degree of difference between the training data and the real test data;
[0214] Determine the candidate data production model based on the degree of difference;
[0215] Based on real test data and validation data, a candidate data production model is trained to obtain a target data production model.
[0216] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0217] If the degree of difference is greater than the preset degree of difference, then the initial data production model is trained based on the degree of difference between the training data and the real test data to obtain the candidate data production model.
[0218] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0219] If the degree of difference is not greater than the preset degree of difference, the initial data production model will be used as the candidate data production model.
[0220] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0221] Based on the validation data and candidate data, a model is generated to determine the data to be tested;
[0222] Based on the test data and the actual test data, a candidate data production model is trained to obtain the target data production model.
[0223] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0224] The data type of the actual test data is determined based on the source address of the client;
[0225] The initial data production model is trained based on candidate test data and real test data to obtain the target data production model, including:
[0226] Based on candidate test data and real test data of different data types from different clients, an initial data production model is trained to obtain the target data production model.
[0227] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0228] Store the test data in the target database;
[0229] Retrieve log information corresponding to the test data stored in the target database; the log information includes the storage time of the test data;
[0230] Determine the test data corresponding to the storage time within the preset time period, and store the test data corresponding to the storage time within the preset time period in other test databases.
[0231] 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.
[0232] 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 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, etc., and are not limited to these.
[0233] 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 specification.
[0234] 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 generating test data, characterized in that, The method includes: Retrieve the first production data from the production database; Based on the first production data and the initial data, a production model is generated to obtain candidate test data; the candidate test data includes training data and validation data. Receive interface messages sent by the client; the interface messages include real test data; The initial data production model is trained based on the candidate test data and the real test data to obtain the target data production model; Obtain the second production data from the production database, and generate test data based on the second production data and the target data production model; The step of training the initial data production model based on the candidate test data and the real test data to obtain the target data production model includes: The degree of difference between the training data and the real test data is determined; if the degree of difference is greater than a preset degree of difference, the initial data production model is trained according to the degree of difference between the training data and the real test data to obtain a candidate data production model; if the degree of difference is not greater than the preset degree of difference, the initial data production model is used as the candidate data production model; the candidate data production model is trained according to the verification data and the real test data to obtain a target data production model.
2. The method according to claim 1, characterized in that, The step of training the candidate data production model based on the verification data and the real test data to obtain the target data production model includes: Based on the verification data and the candidate data production model, the data to be tested is determined; Based on the test data and the actual test data, the candidate data production model is trained to obtain the target data production model.
3. The method according to claim 1, characterized in that, The interface message also includes the source address of the client, and the method further includes: The data type of the actual test data is determined based on the source address of the client; The step of training the initial data production model based on the candidate test data and the real test data to obtain the target data production model includes: The initial data production model is trained based on the candidate test data and the real test data of different data types from different clients to obtain the target data production model.
4. The method according to claim 1, characterized in that, The method further includes: The test data is stored in the target database; Obtain log information corresponding to the test data stored in the target database; the log information includes the storage time corresponding to the test data; Determine the test data corresponding to the storage time within a preset time period, and store the test data corresponding to the storage time within the preset time period in other test databases.
5. A test data generation device, characterized in that, The device includes: The first acquisition module is used to acquire the first production data from the production database. The first determining module is used to generate a model based on the first production data and the initial data to obtain candidate test data; the candidate test data includes training data and validation data. The receiving module is used to receive interface messages sent by the client; the interface messages include real test data. The training module is used to train the initial data production model based on the candidate test data and the real test data to obtain the target data production model; The second acquisition module is used to acquire the second production data in the production database and generate test data based on the second production data and the target data production model. The training module includes: The first determining unit is used to determine the degree of difference between the training data and the real test data; The second determining unit is configured to, if the degree of difference is greater than a preset degree of difference, train the initial data production model based on the degree of difference between the training data and the real test data to obtain a candidate data production model; if the degree of difference is not greater than the preset degree of difference, use the initial data production model as the candidate data production model. The training unit is used to train the candidate data production model based on the verification data and the real test data to obtain the target data production model.
6. 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 4.
7. A computer-readable storage medium having a computer program stored thereon, 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 4.
8. 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 4.
Citation Information
Patent Citations
Power generation data prediction method and device of power station, computer equipment and storage medium
CN111310963A
System testing method, device and equipment based on production flow and storage medium
CN115344478A