Test data generation method and apparatus, device, and storage medium

By initializing the generative adversarial network and using pre-trained discriminant neural network for iterative training, the synthetic data generated by the generator is dispersible on the basis of meeting the business technical logic requirements, solving the problem of low coverage of test data in the existing technology, and achieving more comprehensive coverage of test data.

WO2025152718A1PCT designated stage expired Publication Date: 2025-07-24CHINA UNIONPAY
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/141353
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-01-17
Filing Date
2024-12-23
Publication Date
2025-07-24

AI Technical Summary

Technical Problem

In the prior art, test data synthesized based on real business data can only reflect the business data characteristics with high frequency, resulting in low coverage of test data and it is difficult to cover the business data characteristics with low frequency, which in turn affects the test coverage.

Method used

By initializing the generative adversarial network, including generators and discriminators, and using pre-trained discriminant neural networks to iteratively train the generative adversarial network, the synthetic data generated by the generator is dispersible on the basis of meeting the business technical logic requirements, improving the coverage of the synthetic data.

Benefits of technology

The generated test data not only contains real service data characteristics with high frequency of occurrence, but also contains characteristics with low frequency of occurrence, which significantly improves the coverage of test data and test coverage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024141353_24072025_PF_FP_ABST
    Figure CN2024141353_24072025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the field of data processing, and discloses a test data generation method and apparatus, a device, and a storage medium. The method comprises: initializing a generative adversarial network on the basis of test data model information, wherein the generative adversarial network comprises a generator and a discriminator, and the discriminator comprises a discriminative neural network trained in advance on the basis of training data having elements meeting a service technical logic requirement; performing iterative training on the generative adversarial network on the basis of obtained real service data and synthetic data generated by the generator, wherein in each iterative training process, the discriminator transmits to the generator gradient data of combinational domain data having the highest comprehensive score, and the comprehensive score represents the correlation between the combinational domain data and real service data and the degree of compliance of the combinational domain data with the service technical logic requirement; and determining the generator in the generative adversarial network that satisfies a first training termination condition as a test data generator, and generating test data by means of the test data generator.
Need to check novelty before this filing date? Find Prior Art

Description

Test data generation method, device, equipment and storage medium

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to Chinese patent application No. 202410071439.7, filed on January 17, 2024, entitled “Test data generation method, device, equipment and storage medium,” and the entire contents of that application are incorporated herein by reference. Technical Field

[0003] The present application relates to the field of data processing, and in particular to a test data generation method, apparatus, device and storage medium. Background Art

[0004] During the construction of business systems, long-term testing of the services within them is necessary. Testing requires test data, but due to the need to protect real business data, the amount of real business data that can be used as test data is limited. Furthermore, sensitive information in this data must be desensitized, resulting in low test data quality. To improve test data quality, synthetic data can be synthesized based on real business data and used as test data. However, the synthetic data currently produced can only reflect the characteristics of business data that appear frequently in real business data, resulting in low test data coverage, and therefore low coverage for tests conducted using this test data. Summary of the Invention

[0005] The embodiments of the present application provide a test data generation method, apparatus, device, and storage medium, which can improve the coverage of test data.

[0006] In a first aspect, an embodiment of the present application provides a test data generation method, comprising: initializing a generative adversarial network according to test data model information, the generative adversarial network comprising a generator and a discriminator, the discriminator comprising a discriminative neural network pre-trained based on training data whose elements meet the business technical logic requirements; iteratively training the generative adversarial network based on the acquired real business data and the synthetic data generated by the generator until the generative adversarial network meets the first training cutoff condition, in each iterative training, the discriminator passes the gradient data corresponding to the combined domain data with the highest comprehensive score to the generator, the combined domain data is obtained based on the real business data and the synthetic data, and the comprehensive score represents the correlation between the combined domain data and the real business data and the degree of compliance of the combined domain data with the business technical logic requirements; the generator in the generative adversarial network that meets the first training cutoff condition is determined as the test data generator, and the test data generator is used to generate test data.

[0007] In the second aspect, an embodiment of the present application provides a test data generation device, including: an initialization module, used to initialize a generative adversarial network according to test data model information, the generative adversarial network including a generator and a discriminator, the discriminator including a discriminative neural network pre-trained based on training data whose elements meet the business technical logic requirements; a training module, used to iteratively train the generative adversarial network based on the acquired real business data and the synthetic data generated by the generator until the generative adversarial network meets the first training cutoff condition, in each iterative training, the discriminator passes the gradient data corresponding to the combined domain data with the highest comprehensive score to the generator, the combined domain data is obtained based on the real business data and the synthetic data, and the comprehensive score represents the correlation between the combined domain data and the real business data and the degree of compliance of the combined domain data with the business technical logic requirements; a data generation module, used to determine the generator in the generative adversarial network that meets the first training cutoff condition as the test data generator, and use the test data generator to generate test data.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the test data generation method of the first aspect is implemented.

[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the test data generation method of the first aspect is implemented.

[0010] The embodiments of the present application provide a test data generation method, apparatus, device and storage medium. According to the test data model, a generative adversarial network including a generator and a discriminator is initialized, and the generative adversarial network is iteratively trained based on real business data and synthetic data generated by the generator. In each iterative training, the discriminator passes the gradient data corresponding to the combined domain data with the highest comprehensive score that can characterize the correlation with the real business data and the load degree required by the business technical logic to the generator, so that the generator generates new synthetic data based on the gradient data. The synthetic data generated by the generator has random dispersion, and the discriminator includes a discriminant neural network that is pre-trained based on training data whose elements meet the business technical logic requirements. The discriminant neural network can constrain the generator's synthetic data in terms of the business technical logic requirements, thereby reducing the possibility of the synthetic data generated by the generator being dispersed in a direction that does not meet the business technical logic requirements, so that the synthetic data generated by the generator has dispersion on the basis of meeting the business technical logic requirements. The generator in the generative adversarial network that meets the training cutoff conditions generates richer types of test data as a test data generator, including data that can reflect the characteristics of real business data with high frequency of occurrence, as well as data that can reflect the characteristics of real business data with low frequency of occurrence, thereby improving the coverage of test data. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0012] FIG1 is a flow chart of a test data generation method provided by an embodiment of the present application;

[0013] FIG2 is a flow chart of a test data generating method provided by another embodiment of the present application;

[0014] FIG3 is a flow chart of a test data generating method provided by another embodiment of the present application;

[0015] FIG4 is a flow chart of an example of the training phase of the discriminant neural network provided in an embodiment of the present application;

[0016] FIG5 is a flowchart of an example of the training phase of a generative adversarial network provided in an embodiment of the present application;

[0017] FIG6 is a schematic diagram of the structure of a test data generating device provided in an embodiment of the present application;

[0018] FIG7 is a schematic structural diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0019] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present application by illustrating examples of the present application. It should be noted that the acquisition, storage, use, processing, etc. of information and data in the embodiments of the present application are authorized by the user or relevant agencies and comply with the relevant provisions of national laws and regulations.

[0020] During the construction of a business system, it is necessary to conduct long-term testing of the businesses in the business system. Testing requires test data, but due to the security protection of real business data, the amount of real business data that can be used as test data is limited, and sensitive information in the business data also needs to be desensitized, resulting in low quality of test data. In order to improve the quality of test data, data can be synthesized based on real business data through synthesis methods, and the synthesized data can be used as test data. However, the synthetic data currently obtained can only reflect the characteristics of business data that appear frequently in real business data. The characteristics of business data that appear infrequently in real business data are difficult to reflect in the synthetic data, making it difficult for test data to cover the characteristics of business data that appear infrequently in real business data, that is, the coverage of the test data is low. Correspondingly, the coverage of the test conducted using this test data is also low.

[0021] The present application provides a test data generation method, apparatus, device and storage medium, which can add a pre-trained discriminant neural network to the discriminator of a generative adversarial network (GAN), and iteratively train the generative adversarial network based on real business data and synthetic data generated by the generator in the generative adversarial network. The discriminant neural network is trained based on training data whose elements meet the business technical logic requirements, so that the data synthesis capability of the generator in the generative adversarial network that has been successfully iteratively trained complies with the business technical logic requirements and can enrich the types of synthetic data generated by the generator. The synthetic data generated by the generator as test data includes not only data that can reflect the characteristics of real business data with high frequency of occurrence, but also data that can reflect the characteristics of real business data with low frequency of occurrence, thereby improving the coverage of the test data, and correspondingly, the coverage of the test performed using the test data can also be improved.

[0022] The test data generation method, device, equipment and storage medium provided in this application are described below respectively.

[0023] In a first aspect, the present application provides a test data generation method that can be applied to scenarios where business systems are tested, such as long-term parallel diversion testing of business systems, or other tests, without limiting the types of business systems and tests. The test data generation method can be executed by a test data generation device, equipment, etc., without limiting the types of tests. FIG1 is a flow chart of a test data generation method provided in an embodiment of the present application. As shown in FIG1 , the test data generation method may include steps S101 to S103.

[0024] In step S101, a generative adversarial network is initialized according to the test data model information.

[0025] Test data model information can represent the format, structure, and other attribute information of the test data required for testing the business system under test. This is not limited to the type of business system under test. For example, if the business system under test is a transaction-related system, the corresponding test data model information may include data fields such as the payer, payee, transaction time, transaction amount, and transaction location. In some examples, the test data model information can be obtained by parsing the model of the data required for testing the business system under test.

[0026] The training parameters of the generative adversarial network can be initialized based on the test data model information, thereby achieving the initialization of the generative adversarial network. The generative adversarial network includes a generator and a discriminator. The generator is used to generate synthetic data. The discriminator is used to distinguish whether the input data is synthetic data generated by the generator. The generator and the discriminator are trained against each other. The training goal of the generator is to generate data that is difficult for the discriminator to distinguish, and the training goal of the discriminator is to be able to distinguish the synthetic data generated by the generator. In an embodiment of the present application, the discriminator includes a discriminative neural network that is pre-trained based on training data whose elements meet the business technology logic requirements. The business technology logic requirements can represent the logical relationship between elements in the test data that meets the requirements of the business system under test. The test data can be data in the form of a message, and each message-formed data may include multiple elements. There is an association relationship between at least some of the multiple elements, and the values ​​of the elements also have a logical relationship, such as each element has its own corresponding value range. The training data used to train the discriminative neural network is data whose elements meet the business technology logic requirements. The discriminative neural network can learn the business technology logic requirements through the training data. The trained discriminant neural network can reconstruct the input data and output the reconstructed data; if the input data meets the business technical logic requirements, the reconstructed data output by the discriminant neural network is consistent with the input data; if the input data does not meet the business technical logic requirements, the reconstructed data output by the discriminant neural network is different from the input data.

[0027] In step S102, the generative adversarial network is iteratively trained based on the acquired real business data and the synthetic data generated by the generator until the generative adversarial network meets the first training cutoff condition.

[0028] The generator in the initialized generative adversarial network can first generate a batch of synthetic data that conforms to the attribute information represented by the test data model information. Some business data in the business system under test can be obtained as real business data. In some examples, a communication connection can be established with the business system under test to obtain real business data from the business system under test. The real business data and the synthetic data generated by the generator can be mixed and input into the discriminator. The real business data and the synthetic data can be processed by the discriminator to obtain combined domain data. The data domains in the combined domain data are consistent with the data domains of the real business data and the data domains of the synthetic data, but the value of at least one data domain in the combined domain data is different from the value of the corresponding data domain in the real business data, and the value of at least one data domain in the combined domain data is different from the combination of the values ​​of the corresponding data domains in the synthetic data.

[0029] During each training iteration, the discriminator passes the gradient data corresponding to the combined domain data with the highest comprehensive score to the generator. The combined domain data is derived from real business data and synthetic data. The discriminator, which includes a discriminant neural network, generates a comprehensive score for the combined domain data. This score represents the relevance of the combined domain data to real business data and its degree of compliance with business technical logic requirements. The combined domain data with the highest comprehensive score is the one with the highest combined relevance to real business data and the highest degree of compliance with business technical logic requirements. The load level of the combined domain data in line with business technical logic requirements is determined based on the discriminant neural network in the discriminator. Passing the gradient data corresponding to the combined domain data with the highest comprehensive score to the generator increases the relevance of the synthetic data generated by the generator based on the gradient data to real business data and its degree of compliance with business technical logic requirements. The synthetic data generated by the generator has random dispersion. In the embodiment of the present application, the discriminant neural network in the discriminator can be used to judge whether the combined domain data obtained based on real business data and synthetic data meets the business technical logic requirements, thereby constraining the synthetic data of the generator in terms of business technical logic requirements, which can reduce the possibility of the synthetic data generated by the generator dispersing in a direction that does not meet the business technical logic requirements, so that the synthetic data generated by the generator has dispersion on the basis of meeting the business technical logic requirements, and enrich the types of synthetic data generated by the generator.

[0030] The first training cutoff condition includes a cutoff condition for iterative training of the generative adversarial network. When the generative adversarial network meets the first training cutoff condition, iterative training is stopped. In some examples, the first training cutoff condition may include the number of iterations reaching the initialization number of iterations, and / or the loss value of the generative adversarial network being less than a preset standard threshold. The first training cutoff condition is not limited to the above examples, and other training cutoff conditions are also within the scope of protection of the embodiments of the present application.

[0031] In step S103, the generator in the generative adversarial network that meets the first training cutoff condition is determined as a test data generator, and the test data generator is used to generate test data.

[0032] The synthetic data generated by the generator in the generative adversarial network that meets the first training cutoff condition can be used as test data, that is, the generator in the generative adversarial network that meets the first training cutoff condition can be used as a test data generator to generate test data, and the test data generated by the test data generator can be used to test the business system under test.

[0033] In an embodiment of the present application, a generative adversarial network including a generator and a discriminator is initialized according to a test data model, and the generative adversarial network is iteratively trained based on real business data and synthetic data generated by the generator. In each iterative training, the discriminator passes the gradient data corresponding to the combined domain data with the highest comprehensive score that can characterize the correlation with the real business data and the load degree required by the business technical logic to the generator, so that the generator generates new synthetic data based on the gradient data. The synthetic data generated by the generator has random dispersion, and the discriminator includes a discriminant neural network that is pre-trained based on training data whose elements meet the business technical logic requirements. The discriminant neural network can constrain the generator's synthetic data in terms of the business technical logic requirements, thereby reducing the possibility of the synthetic data generated by the generator dispersing in a direction that does not meet the business technical logic requirements, so that the synthetic data generated by the generator has dispersion on the basis of meeting the business technical logic requirements. The generator in the generative adversarial network that meets the training cutoff conditions can generate richer types of test data as a test data generator, including data that can reflect the characteristics of real business data with high frequency of occurrence, as well as data that can reflect the characteristics of real business data with low frequency of occurrence, thereby improving the coverage of test data and thus improving the coverage of tests performed using test data.

[0034] In some embodiments, real business data and synthetic data can be processed by a discriminator including a discriminative neural network to obtain a comprehensive score, thereby using the gradient data corresponding to the combined domain data with the highest comprehensive score for iterative training. Figure 2 is a flowchart of the test data generation method provided by another embodiment of the present application. The difference between Figure 2 and Figure 1 is that step S102 in Figure 1 can be specifically refined into steps S1021 to S1024 in Figure 2.

[0035] In step S1021, the real business data and the synthetic data are mixed and input into the discriminator, and the discriminator generates combined domain data based on the real business data and the synthetic data.

[0036] Real business data and synthetic data are input into the discriminator, which then performs data domain sampling on the real business data and synthetic data, obtaining data domains and data domain values ​​in the real business data, as well as data domains and data domain values ​​in the synthetic data. The data domain values ​​of the real business data and the data domain values ​​of the synthetic data can be randomly swapped. This random swapping includes randomly swapping data domain values ​​of different real business data, randomly swapping data domain values ​​of real business data with data domain values ​​of synthetic data, and randomly swapping data domain values ​​of different synthetic data. After randomly swapping data domain values, combined domain data can be generated.

[0037] For example, the data domains of real business data and synthetic data may include user ID, transaction time and transaction amount. The real business data may include "User A1, January 3, 2024, 56 yuan", and the synthetic data includes "User A2, December 15, 2023, 120 yuan" and "User A3, January 8, 2024, 95 yuan". After data domain sampling and random exchange of data domain values, the combined domain data "User A2, January 3, 2024, 95 yuan" and "User A3, December 15, 2023, 56 yuan" can be obtained.

[0038] In step S1022, the combined domain data is input into the discriminant neural network to obtain first reconstructed data.

[0039] The discriminant neural network can reconstruct the input data and output the reconstructed data. The first reconstructed data includes the data output by the discriminant neural network based on the input combined domain data.

[0040] In some examples, the combined domain data can be input into a discriminant neural network; the discriminant neural network performs dimensionality compression on the combined domain data to obtain reduced-dimensionality representation data; and the discriminant neural network processes the combined domain data based on the reduced-dimensionality representation data to obtain first reconstructed data. Some of the multiple data fields in the combined domain data have correlations, while others do not. To facilitate processing, the discriminant neural network can perform dimensionality compression, i.e., dimensionality reduction, on the combined domain data to preserve the values ​​of the associated data fields in the combined domain data. The reduced-dimensionality representation data can be obtained based on the values ​​of the associated data fields in the combined domain data. The discriminant neural network reconstructs the combined domain data based on the reduced-dimensionality representation data, outputting first reconstructed data. The difference between the first reconstructed data and the combined domain data can be used to determine the degree to which the combined domain data complies with business and technical logic requirements. The higher the degree of compliance of the combined domain data with business and technical logic requirements, the smaller the difference between the first reconstructed data and the combined domain data. If the first reconstructed data is consistent with the combined domain data, it indicates that the combined domain data fully complies with the business and technical logic requirements.

[0041] In step S1023 , a comprehensive score is obtained based on the combined domain data and the first reconstructed data by a discriminator.

[0042] The comprehensive score can reflect the relevance of the combined domain data to the actual business data, as well as the degree of conformance of the combined domain data to the business technical logic requirements. Based on the combined domain data and the first reconstructed data, a score reflecting the relevance of the combined domain data to the actual business data and a score reflecting the degree of conformance of the combined domain data to the business technical logic requirements can be obtained, thereby obtaining a comprehensive score. Specifically, a discriminator can be used to obtain a relevance score for the combined domain data to the actual business data based on the combined domain data; a discriminator can be used to obtain a difference score between the first reconstructed data and the combined domain data based on the combined domain data and the first reconstructed data; and a comprehensive score can be obtained based on the relevance score, the weight coefficient corresponding to the relevance score, the difference score, and the weight coefficient corresponding to the difference score.

[0043] A discriminator can use a correlation algorithm based on the combined domain data to obtain a correlation score between the combined domain data and the real business data. The correlation score can represent the correlation between the combined domain data and the real business data, and the correlation score can be positively correlated with the correlation between the combined domain data and the real business data. The correlation algorithm can include a Monte Carlo search algorithm or other algorithms. Any algorithm capable of calculating the correlation between the combined domain data and the real business data is within the scope of protection of the embodiments of this application.

[0044] The discriminator can calculate the mean squared error (MSE) between the combined domain data and the first reconstructed data, and a difference score can be obtained based on the MSE. The difference score can indicate the degree of conformance of the combined domain data with the business technical logic requirements. The smaller the MSE, the higher the difference score. The difference score can be positively correlated with the degree of conformance of the combined domain data with the business technical logic requirements. That is, the higher the difference score, the higher the degree of conformance of the combined domain data with the business technical logic requirements.

[0045] The weight coefficients for the relevance score and the difference score can be set based on scenarios, requirements, and experience, and are not limited here. Using a weighted algorithm, a comprehensive score can be derived that represents both the relevance of the combined domain data to real business data and the degree of conformance of the combined domain data to business technical logic requirements. The higher the comprehensive score, the closer the corresponding combined domain data meets the test data requirements.

[0046] In step S1024, the generator and the discriminator are iteratively trained using the gradient data corresponding to the combined domain data with the highest comprehensive score until the generative adversarial network meets the first training cutoff condition.

[0047] The generator and the discriminator can each use the gradient data corresponding to the combined domain data with the highest comprehensive score for iterative training. Specifically, the discriminator is trained based on the gradient data corresponding to the combined domain data with the highest comprehensive score; the gradient data corresponding to the combined domain data with the highest comprehensive score is passed to the generator through the discriminator; the generator is trained based on the gradient data corresponding to the combined domain data with the highest comprehensive score, and the generator is made to generate new synthetic data. The synthetic data generated by the generator after training based on the gradient data corresponding to the combined domain data with the highest comprehensive score can better meet the business technical logic requirements on the basis of a higher degree of coverage, and the quality of the synthetic data is improved. The new synthetic data generated by the generator can be mixed with the real business data and input into the discriminator, and the above steps S1021 to S1024 are repeated again until the generative adversarial network meets the first training cutoff condition.

[0048] In some embodiments, a discriminative neural network can be pre-trained using training data whose elements meet the business technical logic requirements. Figure 3 is a flowchart of a test data generation method provided by another embodiment of the present application. The difference between Figure 3 and Figure 1 is that the test data generation method shown in Figure 3 can also include steps S104 to S106.

[0049] In step S104, the neural network model is initialized.

[0050] The neural network model can be initialized and parameters such as the initial parameters and the number of iterative training cycles of the neural network model can be set.

[0051] In step S105, the training data whose elements meet the business technical logic requirements are input into the neural network model, and the training data is reconstructed by the neural network model to obtain second reconstructed data.

[0052] The second reconstructed data includes data output by the neural network model based on the input training data. In some examples, the training data can be dimensionally compressed by the neural network model to obtain compressed feature data; and the training data can be processed by the neural network model based on the compressed feature data to obtain the second reconstructed data. The data domain of the training data is the same as the data domain of the real business data, the data domain of the synthetic data, and the data domain of the combined domain data in the above-mentioned embodiment. Some of the multiple data domains of the training data have an association relationship, while some of the data domains do not have an association relationship. For the convenience of processing, the training data can be dimensionally compressed, i.e., dimensionality reduced, by the neural network model to retain the values ​​of the data domains with an association relationship in the training data. The compressed feature data can be obtained based on the values ​​of the data domains with an association in the training data. The neural network model reconstructs the training data based on the compressed feature data and outputs the second reconstructed data.

[0053] In step S106, the model parameters of the neural network model are adjusted according to the difference between the second reconstructed data and the training data, and the neural network model is trained based on the adjusted model parameters until the neural network model meets the second training cutoff condition, and the neural network model is determined as the discriminant neural network in the discriminator.

[0054] The purpose of training the neural network model is to become a discriminative neural network. When the input data meets the business technical logic requirements, the output second reconstructed data is consistent with the input data. During the training process of the neural network model, the model parameters of the neural model can be continuously adjusted according to the difference between the second reconstructed data and the training data until the neural network model meets the second training cutoff condition. The neural network model that meets the second training cutoff condition is the discriminative neural network in the discriminator. The difference between the second reconstructed data and the training data can be reflected as the mean square error between the second reconstructed data and the training data. The smaller the mean square error, the smaller the difference between the second reconstructed data and the training data. The difference between the second reconstructed data and the training data can also be reflected as other parameters that can characterize the difference, which is not limited here.

[0055] The second training cutoff condition includes a cutoff condition for iterative training of the neural network model. When the neural network model satisfies the second training cutoff condition, iterative training is stopped. In some examples, the second training cutoff condition may include the number of iterations reaching the initialization number of iterations, and / or the difference between the second reconstructed data and the training data being less than a preset difference threshold. The second training cutoff condition is not limited to the above examples, and other training cutoff conditions are also within the scope of protection of the embodiments of the present application.

[0056] To obtain test data with relatively high coverage, a test data generator capable of generating such data is required. Obtaining this test data generator requires two training phases: the discriminative neural network training phase and the generative adversarial network training phase. To facilitate understanding, the following two examples illustrate the training processes for the discriminative neural network and the generative adversarial network, respectively.

[0057] FIG4 is a flowchart of an example of the training phase of the discriminant neural network provided in an embodiment of the present application. As shown in FIG4 , the training phase of the discriminant neural network may include steps a1 to a10.

[0058] In step a1, training data is introduced. The elements of the training data meet the business technical logic requirements and can be obtained from professional data databases or provided by professionals.

[0059] In step a2, the neural network model in the discriminator is initialized, and the initial model parameters, number of iterations and other parameters are set.

[0060] In step a3, the training of the neural network model is started.

[0061] In step a4, check whether the neural network model has completed iterative training. If so, proceed to step a10; if not, proceed to step a5. Whether the neural network model has completed iterative training can be determined by whether the neural network model meets the second training cutoff condition in the above embodiment.

[0062] In step a5, the training data is input into the neural network model.

[0063] In step a6, feature extraction and dimension compression are performed on the training data through a neural network model.

[0064] In step a7, the compressed feature data after dimension compression is reconstructed by the neural network model to obtain reconstructed data. The reconstructed data here is the second reconstructed data in the above embodiment.

[0065] In step a8, the mean square error between the reconstructed data and the training data is calculated. The mean square error between the reconstructed data and the training data can be calculated using the values ​​of the data domain of the reconstructed data and the values ​​of the data domain of the training data.

[0066] In step a9, new model parameters are obtained based on the mean square error, and step a3 is executed. The new model parameters can be obtained by adjusting the model parameters of the neural network model.

[0067] In step a10, the iterative training of the neural network model is completed, and the neural network model is saved as the discriminant neural network in the discriminator.

[0068] The specific contents of the above steps a1 to a10 can be found in the relevant descriptions in the above embodiments, which will not be repeated here.

[0069] FIG5 is a flowchart of an example of the training phase of a generative adversarial network provided in an embodiment of the present application. As shown in FIG5 , the training phase of the generative adversarial network may include steps b1 to b17.

[0070] In step b1, a data source of the business system to be tested is introduced, from which real business data and a data model of test data required by the business system to be tested can be obtained.

[0071] In step b2, the data model is parsed to obtain test data model information.

[0072] In step b3, the generative adversarial network is initialized, and the number of iterative training times and model parameters of the generative adversarial network are initialized.

[0073] In step b4, a discriminator including a pre-trained discriminative neural network is loaded.

[0074] In step b5, the generator in the generative adversarial network generates a batch of synthetic data.

[0075] In step b6, determine whether the generative adversarial network has completed iterative training; if so, execute step b17; if not, execute step b7.

[0076] In step b7, the synthetic data generated this time is mixed with the real business data and input into the discriminator of the generative adversarial network.

[0077] In step b8, the discriminator performs data domain sampling on the input data. After data domain sampling, the values ​​of the data domain of the synthetic data and the values ​​of the data domain of the real business data can be obtained.

[0078] In step b9, the values ​​of the data domain obtained by sampling the data domain are randomly combined by the discriminator to obtain combined domain data.

[0079] In step b10, the discriminator performs relevance scoring on the combined domain data based on the Monte Carlo search algorithm.

[0080] In step b11, the combination domain data is reconstructed by the discriminator to obtain reconstructed data. The reconstructed data here is the first reconstructed data in the above embodiment.

[0081] In step b12, the discriminator calculates the mean square error between the reconstructed data and the combined domain data to perform a difference score.

[0082] In step b13, the relevance score and the difference score are weighted by the discriminator to obtain a comprehensive score.

[0083] In step b14, the discriminator determines whether the combined domain data is the data with the highest comprehensive score; if so, execute step b15; if not, execute step b9.

[0084] In step b15, the gradient of the combined domain data with the highest comprehensive score is passed to the generator through the discriminator.

[0085] In step b16, the generator is iteratively trained using the gradient of the combined domain data with the highest comprehensive score, and step b5 is executed.

[0086] In step b17, the iterative training of the generative adversarial network is completed, and the generator in the generative adversarial network is saved as a test data generator. The test data generator is used to generate test data for testing the business system to be tested.

[0087] The specific contents of the above steps b1 to b17 can be found in the relevant descriptions in the above embodiments and will not be repeated here.

[0088] FIG6 is a schematic diagram of the structure of a test data generating device provided in an embodiment of the present invention. As shown in FIG6 , the test data generating device 200 may include an initialization module 201 , a training module 202 , and a data generating module 203 .

[0089] The initialization module 201 can be used to initialize the generative adversarial network based on the test data model information. The generative adversarial network includes a generator and a discriminator. The discriminator includes a discriminative neural network pre-trained based on training data whose elements meet the business technical logic requirements.

[0090] The training module 202 can be used to iteratively train the generative adversarial network based on the acquired real business data and the synthetic data generated by the generator until the generative adversarial network meets the first training cutoff condition. In each iterative training, the discriminator passes the gradient data corresponding to the combined domain data with the highest comprehensive score to the generator. The combined domain data is obtained based on the real business data and the synthetic data. The comprehensive score represents the correlation between the combined domain data and the real business data and the degree of compliance of the combined domain data with the business technical logic requirements.

[0091] The data generation module 203 may be configured to determine a generator in a generative adversarial network that satisfies a first training cutoff condition as a test data generator, and generate test data using the test data generator.

[0092] In an embodiment of the present application, a generative adversarial network (GAN) comprising a generator and a discriminator is initialized based on a test data model. The GAN is then iteratively trained based on real business data and synthetic data generated by the generator. During each iterative training, the discriminator passes gradient data corresponding to the combined domain data with the highest comprehensive score for both correlation with real business data and the degree of load required by the business technology logic to the generator, so that the generator generates new synthetic data based on the gradient data. The synthetic data generated by the generator has random dispersion. The discriminator includes a discriminative neural network pre-trained based on training data whose elements meet the business technology logic requirements. The discriminative neural network can constrain the generator's synthetic data based on the business technology logic requirements, thereby reducing the possibility that the synthetic data generated by the generator will disperse in directions that do not meet the business technology logic requirements, ensuring that the synthetic data generated by the generator has dispersion while meeting the business technology logic requirements. The generator in the GAN that meets the training cutoff condition, as a test data generator, generates a richer variety of test data, including both data that reflects the characteristics of real business data with high frequency of occurrence and data that reflects the characteristics of real business data with low frequency of occurrence, thereby improving the coverage of the test data.

[0093] In some embodiments, the training module 202 can be used to: input a mixture of real business data and synthetic data into the discriminator, and generate combined domain data based on the real business data and the synthetic data through the discriminator; input the combined domain data into the discriminant neural network to obtain first reconstructed data; obtain a comprehensive score based on the combined domain data and the first reconstructed data through the discriminator; and iteratively train the generator and the discriminator using the gradient data corresponding to the combined domain data with the highest comprehensive score.

[0094] In some examples, the training module 202 can be specifically used to: input the combined domain data into the discriminant neural network; perform dimensionality compression processing on the combined domain data through the discriminant neural network to obtain reduced dimensionality representation data; process the combined domain data based on the reduced dimensionality representation data through the discriminant neural network to obtain first reconstructed data, wherein the higher the degree of compliance of the combined domain data with the business technical logic requirements, the smaller the difference between the first reconstructed data and the combined domain data.

[0095] In some examples, the training module 202 can be specifically used to: obtain a correlation score between the combined domain data and the real business data based on the combined domain data through a discriminator; obtain a difference score between the first reconstructed data and the combined domain data based on the combined domain data and the first reconstructed data through a discriminator, wherein the higher the difference score, the higher the degree of compliance of the combined domain data with the business technical logic requirements; and obtain a comprehensive score based on the correlation score, the weight coefficient corresponding to the correlation score, the difference score, and the weight coefficient corresponding to the difference score.

[0096] In some examples, the training module 202 can be specifically used to: train the discriminator based on the gradient data corresponding to the combined domain data with the highest comprehensive score; pass the gradient data corresponding to the combined domain data with the highest comprehensive score to the generator through the discriminator; train the generator based on the gradient data corresponding to the combined domain data with the highest comprehensive score, and enable the generator to generate new synthetic data.

[0097] In some embodiments, the test data generating apparatus 200 may further include a pre-training module.

[0098] The pre-training module can be used to: initialize the neural network model; input training data whose elements meet the business technical logic requirements into the neural network model, reconstruct the training data through the neural network model to obtain second reconstructed data; adjust the model parameters of the neural network model according to the difference between the second reconstructed data and the training data, train the neural network model based on the adjusted model parameters until the neural network model meets the second training cutoff condition, and determine the neural network model as the discriminant neural network in the discriminator.

[0099] In some examples, the pre-training module can be specifically used to: perform dimension compression processing on the training data through a neural network model to obtain compressed feature data; and process the training data based on the compressed feature data through a neural network model to obtain second reconstructed data.

[0100] In a third aspect, the present application further provides an electronic device. FIG7 is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. As shown in FIG7 , the electronic device 300 includes a memory 301, a processor 302, and a computer program stored in the memory 301 and executable on the processor 302.

[0101] In some examples, the processor 302 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0102] The memory 301 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the test data generation method according to the embodiments of the present application.

[0103] The processor 302 reads the executable program code stored in the memory 301 to run a computer program corresponding to the executable program code, so as to implement the test data generating method in the above embodiment.

[0104] In some examples, the electronic device 300 may further include a communication interface 303 and a bus 304. As shown in FIG7, the memory 301, the processor 302, and the communication interface 303 are connected via the bus 304 and communicate with each other.

[0105] The communication interface 303 is mainly used to implement communication between the modules, devices, units and / or equipment in the embodiment of the present application. Input devices and / or output devices can also be connected through the communication interface 303.

[0106] Bus 304 includes hardware, software, or both that couples components of electronic device 300 to each other. By way of example, and not limitation, bus 304 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-E) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of the above. Bus 304 may include one or more buses, where appropriate. Although embodiments herein describe and illustrate a particular bus, this application contemplates any suitable bus or interconnect.

[0107] In a fourth aspect, the present application further provides a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the test data generation method in the above-mentioned embodiment can be implemented, and the same technical effect can be achieved. To avoid repetition, the above-mentioned computer-readable storage medium may include a non-transitory computer-readable storage medium, such as a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., which is not limited here.

[0108] An embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the test data generation method in the above embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0109] It should be understood that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. For device embodiments, equipment embodiments, and computer-readable storage medium embodiments, the relevant parts can be referred to the description part of the method embodiment. This application is not limited to the specific steps and structures described above and shown in the figures. Those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of this application. In addition, for the sake of brevity, a detailed description of known method technologies is omitted here.

[0110] Aspects of the present application have been described above with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed via the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. This processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit. It is also understood that each box in the block diagram and / or the flowchart and the combination of the boxes in the block diagram and / or the flowchart can also be implemented by the dedicated hardware that performs the specified function or action, or can be implemented by the combination of dedicated hardware and computer instructions.

[0111] Those skilled in the art should understand that the above embodiments are illustrative rather than restrictive. Different technical features appearing in different embodiments can be combined to achieve beneficial effects. Based on a study of the drawings, the specification and the claims, those skilled in the art should be able to understand and implement other variations of the disclosed embodiments. In the claims, the term "comprising" does not exclude other devices or steps; the quantifier "one" does not exclude a plurality; the terms "first" and "second" are used to identify names rather than to indicate any specific order. Any figure marks in the claims should not be understood as limiting the scope of protection. The functions of multiple parts appearing in the claims can be implemented by a separate hardware or software module. The fact that certain technical features appear in different dependent claims does not mean that these technical features cannot be combined to achieve beneficial effects.

Claims

1. A test data generation method, comprising: Initializing a generative adversarial network according to test data model information, where the generative adversarial network includes a generator and a discriminator, and the discriminator includes a discriminative neural network pre-trained with training data where elements meet the requirements of business technical logic; Based on the obtained real business data and the synthetic data generated by the generator, iteratively training the generative adversarial network until the generative adversarial network meets the first training termination condition. In each iterative training, the discriminator transmits the gradient data corresponding to the combined domain data with the highest comprehensive score to the generator, where the combined domain data is obtained from the real business data and the synthetic data, and the comprehensive score represents the relevance between the combined domain data and the real business data and the degree of compliance of the combined domain data with the requirements of the business technical logic; Determining the generator in the generative adversarial network that meets the first training termination condition as a test data generator, and using the test data generator to generate test data.

2. The method according to claim 1, wherein, The iteratively training the generative adversarial network based on the obtained real business data and the synthetic data generated by the generator includes: Mixing and inputting the real business data and the synthetic data into the discriminator, and generating the combined domain data by the discriminator according to the real business data and the synthetic data; Inputting the combined domain data into the discriminative neural network to obtain first reconstructed data; Based on the combined domain data and the first reconstructed data, obtaining the comprehensive score by the discriminator; Using the gradient data corresponding to the combined domain data with the highest comprehensive score to iteratively train the generator and the discriminator.

3. The method according to claim 2, wherein, The inputting the combined domain data into the discriminative neural network to obtain first reconstructed data includes: Inputting the combined domain data into the discriminative neural network; Performing dimensionality reduction processing on the combined domain data through the discriminative neural network to obtain dimension-reduced representation data; Processing the combined domain data according to the dimension-reduced representation data through the discriminative neural network to obtain the first reconstructed data, where the higher the degree of compliance of the combined domain data with the requirements of the business technical logic, the smaller the difference between the first reconstructed data and the combined domain data.

4. The method according to claim 2, wherein, The obtaining the comprehensive score by the discriminator based on the combined domain data and the first reconstructed data includes: Obtaining the relevance score between the combined domain data and the real business data by the discriminator according to the combined domain data; Obtaining the difference score between the first reconstructed data and the combined domain data by the discriminator according to the combined domain data and the first reconstructed data, where the higher the difference score, the higher the degree of compliance of the combined domain data with the requirements of the business technical logic; Obtaining the comprehensive score according to the relevance score, the weight coefficient corresponding to the relevance score, the difference score, and the weight coefficient corresponding to the difference score.

5. The method according to claim 2, wherein, Iteratively training the generator and the discriminator by using the gradient data corresponding to the combined domain data with the highest comprehensive score includes: Training the discriminator according to the gradient data corresponding to the combined domain data with the highest comprehensive score; Passing the gradient data corresponding to the combined domain data with the highest comprehensive score to the generator through the discriminator; Training the generator according to the gradient data corresponding to the combined domain data with the highest comprehensive score through the generator, and enabling the generator to generate new synthetic data.

6. The method according to claim 1, further comprising, before initializing the generative adversarial network according to the test data model information: Initializing a neural network model; Inputting the training data whose elements meet the requirements of the business technical logic into the neural network model, and performing reconstruction processing on the training data through the neural network model to obtain second reconstructed data; According to the difference between the second reconstructed data and the training data, adjusting the model parameters of the neural network model, and training the neural network model based on the adjusted model parameters until the neural network model meets the second training cut-off condition, and determining the neural network model as the discriminative neural network in the discriminator.

7. The method according to claim 6, wherein, The performing reconstruction processing on the training data through the neural network model to obtain second reconstructed data includes: Performing dimensionality reduction processing on the training data through the neural network model to obtain compressed feature data; Processing the training data through the neural network model according to the compressed feature data to obtain the second reconstructed data.

8. A test data generation device, comprising: An initialization module, configured to initialize a generative adversarial network according to test data model information, where the generative adversarial network includes a generator and a discriminator, and the discriminator includes a discriminative neural network pre-trained according to training data whose elements meet the requirements of the business technical logic; A training module, configured to iteratively train the generative adversarial network based on the obtained real business data and the synthetic data generated by the generator until the generative adversarial network meets the first training cut-off condition. In each iterative training, the discriminator passes the gradient data corresponding to the combined domain data with the highest comprehensive score to the generator, the combined domain data is obtained according to the real business data and the synthetic data, and the comprehensive score represents the relevance between the combined domain data and the real business data and the degree of compliance of the combined domain data with the requirements of the business technical logic; A data generation module, configured to determine the generator in the generative adversarial network that meets the first training cut-off condition as a test data generator, and use the test data generator to generate test data.

9. An electronic device, comprising: A processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the test data generation method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having computer program instructions stored thereon, and when the computer program instructions are executed by a processor, implementing the test data generation method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data protection processing method and device, equipment and storage medium

    CN115391837A

  • Business model training method and device, equipment and storage medium

    CN115438736A

  • Test data generation method and device, equipment and storage medium

    CN117215924A

  • Data issuing method and device, equipment and storage medium

    CN117216557A

  • Test data generation method and device, equipment and storage medium

    CN117931653A