Test data generation method and device, electronic equipment and storage medium
By using conditional generation adversarial network (cGAN) to optimize generator and discriminator networks, combined with consistency constraints and collaborative maintenance, the problem of lack of diversity and authenticity in test data generation in the prior art is solved, and efficient and diversified are achieved and consistent test data generation.
Patent Information
- Application Number
- CN202411348001.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-02-14
AI Technical Summary
It is difficult for the prior art to effectively generate diverse and authentic test data, especially in complex systems and multimodal data scenarios, and traditional methods have problems with insufficient data consistency and synergy.
Conditional Generative Adversarial Network (cGAN) is used to combine consistency constraints and collaborative maintenance, and the generator network and discriminator network are trained to optimize the cGAN model to generate diversity, authenticity and multimodal test data.
It improves the diversity, authenticity and consistency of test data, meets different test scenarios and needs, reduces the dependence of manual feature engineering and data marking, and improves the efficiency and quality of test data generation.
Smart Images

Figure CN119441022A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of test case technology, and in particular to a test data generation method, device, electronic device, and storage medium. Background Art
[0002] The quality and diversity of data in the test cases will largely determine the quality of the test, thereby affecting the quality of the system to be released.
[0003] How to effectively generate test data to meet different test scenarios and requirements is a problem that needs to be solved. Summary of the invention
[0004] The embodiments of the present application provide a test data generation method, device, electronic device, and storage medium to improve the authenticity and diversity of test data while improving the efficiency of test data generation.
[0005] The present application embodiment adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a test data generating method, wherein the method comprises:
[0007] According to different test scenarios, the data to be processed is collected;
[0008] According to the data to be processed, a generator network and a discriminator network in a conditional generative adversarial network cGAN are trained to obtain a cGAN model;
[0009] The cGAN model is optimized by using consistency constraints and / or synergy maintenance to obtain an optimized cGAN model;
[0010] According to the optimized cGAN model, test data is obtained.
[0011] In some embodiments, the training of the generator network and the discriminator network in the conditional generative adversarial network cGAN to obtain the cGAN model includes:
[0012] Select a corresponding neural network architecture, and determine that the model architecture of the cGAN model at least includes a generator network and a discriminator network;
[0013] Constructing the generator network and the discriminator network, and defining a loss function;
[0014] According to the generator network, the discriminator network and the loss function, multiple training iterations are performed to obtain the cGAN model.
[0015] In some embodiments, the collecting and obtaining the data to be processed according to different test scenarios includes:
[0016] When the test scenario includes a new system and there is no test data or actual production data, the data to be processed is collected by manually making data;
[0017] In the case where the test scenario includes that the system has been successfully run, the data to be processed is collected from actual production data;
[0018] In the test scenario, in which the system is already running but has defects, the data to be processed is collected by any one or more of annotating data, monitoring system behavior, feedback loops, improving data generation models, and manual intervention.
[0019] In some embodiments, the optimizing the cGAN model by using consistency constraints and / or synergy maintenance includes:
[0020] The cGAN model is optimized using consistency constraints based on ensuring that the generated data has similar features and attributes under different conditions;
[0021] and / or,
[0022] Based on ensuring the consistency of the generated test data under different conditions, the cGAN model is maintained collaboratively.
[0023] In some embodiments, obtaining test data according to the optimized cGAN model includes:
[0024] Determine the data type;
[0025] Select model training conditions;
[0026] Generate test data using the optimized cGAN model according to the data type and the model training condition;
[0027] The test data is labeled and classified.
[0028] In some embodiments, the method further comprises:
[0029] The test data is applied to a test scenario, wherein the test scenario includes at least one of the following: test case generation, performance testing, stability testing, and exception handling testing.
[0030] In some embodiments, the method further comprises:
[0031] According to different test scenarios, continuously enrich the collection of data to be processed;
[0032] and / or, regularly updating the cGAN model;
[0033] and / or, establish a monitoring system to track the performance and stability of the generated data during testing, and provide feedback to the model training process based on the monitoring results;
[0034] Establish a feedback loop to feed test results into the generation of processed data and model training.
[0035] In a second aspect, an embodiment of the present application further provides a test data generating device, wherein the device comprises:
[0036] The acquisition module is used to acquire the data to be processed according to different test scenarios;
[0037] A training module, used for training a generator network and a discriminator network in a conditional generative adversarial network cGAN according to the data to be processed, to obtain a cGAN model;
[0038] An optimization module, used to optimize the cGAN model by using consistency constraints and / or collaborative maintenance to obtain an optimized cGAN model;
[0039] The test data generation module is used to obtain test data according to the optimized cGAN model.
[0040] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor; and a memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to perform the above method.
[0041] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by an electronic device including multiple application programs, the electronic device executes the above method.
[0042] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: according to different test scenarios, the data to be processed is collected, and then according to the data to be processed, the generator network and the discriminator network in the conditional generative adversarial network cGAN are trained to obtain a cGAN model. The cGAN model is further optimized by using consistency constraints and / or collaborative maintenance to obtain an optimized cGAN model. Finally, test data is obtained based on the optimized cGAN model. Through the above method, the diversity, authenticity, comprehensiveness and efficiency of the test data are improved, and at the same time, it helps to evaluate the performance of software and systems more accurately and comprehensively. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0044] Figure 1 This is a flow chart of a method for generating test data in an embodiment of the present application;
[0045] Figure 2 A schematic diagram of a data generation process for one of the test data generation methods in an embodiment of the present application;
[0046] Figure 3 A schematic diagram of a data acquisition process for another situation in the test data generating method in an embodiment of the present application;
[0047] Figure 4 This is a schematic diagram of the cGAN training process in the test data generation method in an embodiment of the present application;
[0048] Figure 5 Schematic diagram of the implementation principle of the test data generation method in the embodiment of the present application;
[0049] Figure 6 This is a schematic diagram of the structure of a test data generating device in an embodiment of the present application;
[0050] Figure 7 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0052] There are many methods and technologies for generating test data. However, as the complexity of systems and production environments increases, the current common methods or technologies have shortcomings:
[0053] First, rule-based generation method
[0054] Lack of diversity and authenticity: Rule-based methods usually generate data of a single style or pattern, which makes it difficult to generate test data with high diversity and authenticity, thus limiting test coverage. Complexity limitation: When the test scenario becomes complex, it becomes difficult to write and maintain generation rules. Rule-based methods are often not applicable to the generation of multimodal data.
[0055] Second, random data generation method
[0056] Authenticity issue: Random data generation methods may generate data that does not conform to real scenarios, which may not be sufficient to effectively test complex systems. Consistency issue: Randomly generated data may lack consistency between modalities or between different scenarios, making it impossible to effectively simulate complex test requirements.
[0057] Third, manually label the dataset
[0058] Costly: The process of manually labeling datasets is time-consuming and labor-intensive, especially for multimodal datasets. Data Limitedness: Manually labeled datasets may not cover all test cases, especially rare or edge cases.
[0059] Fourth, template-based generation method
[0060] Highly restrictive: Template-based methods are usually limited to predefined templates and cannot flexibly adapt to changes in different test scenarios. Poor data relevance: The generated data may lack relevance, making it difficult to simulate complex test processes.
[0061] Fifth, traditional machine learning methods
[0062] Complex feature engineering: Traditional machine learning methods usually require manual design and extraction of features, which is particularly complex when multimodal data is generated. Model rigidity: Traditional machine learning models are usually relatively rigid and difficult to adapt to the flexibility requirements of different test scenarios.
[0063] In view of the above shortcomings, the test data generation method in the embodiment of the present application provides a way to effectively generate diverse, authentic, multimodal, consistent and conditional test data to meet different test scenarios and requirements, while ensuring that the process of generating test data is efficient and stable. The method in the embodiment of the present application solves the challenges of generating multiple types of data, handles the complexity of multimodal data generation, maintains data consistency and coordination, makes full use of conditional information for data generation, and optimizes performance to ensure high quality and high coverage of test data.
[0064] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0065] The present application embodiment provides a method for generating test data, such as Figure 1 As shown, a flow chart of a method for generating test data in an embodiment of the present application is provided, and the method at least includes the following steps S110 to S140:
[0066] Step S110: collecting and obtaining data to be processed according to different test scenarios.
[0067] Different test scenarios may include: a newly built system, no test data or actual production data, or a system that has been successfully running, or a system that has been running but has defects. It can be understood that "system" here refers to the system that needs to be tested. According to different test scenarios, data to be processed can be collected, and these data to be processed include but are not limited to test data collected in the system.
[0068] Step S120: training a generator network and a discriminator network in a conditional generative adversarial network cGAN according to the data to be processed to obtain a cGAN model.
[0069] The conditional generative adversarial network cGAN consists of a generator network and a discriminator network. The generator is responsible for generating data, and the discriminator is responsible for judging whether the generated data is real or fake. Conditional Generative Adversarial Network (CGAN): It is a variant of GAN that allows the generator network to generate data based on additional conditional information. In test data generation, the condition can be the characteristics or type of existing data to ensure that the generated data meets the condition.
[0070] Specifically, Generative Adversarial Networks (GAN) is a deep learning model composed of a generator and a discriminator. The generator is responsible for generating data, and the discriminator is responsible for evaluating the difference between the generated data and the real data. They continuously improve the quality of the generated data through adversarial training. It can be understood that the generator network is part of the GAN, which accepts input (usually random noise or conditional information) and generates synthetic data; in the test data generation scheme, the generator is used to generate test data. It can be understood that the discriminator network is also part of the GAN, which evaluates the authenticity of the input data, that is, it tries to distinguish between the generated data and the real data. During the training process, the discriminator helps the generator improve the fidelity of the generated data.
[0071] It should be noted that, depending on the complexity of the problem, an appropriate neural network architecture can be selected, such as a convolutional neural network (CNN) or a recurrent neural network (RNN), which is not specifically limited in the embodiments of the present application.
[0072] The generator network and the discriminator network are trained based on the stored or generated data to be processed as training data to obtain the cGAN model. The training process is an iterative process and usually requires multiple rounds of training.
[0073] Step S130, optimizing the cGAN model by using consistency constraints and / or synergy maintenance to obtain an optimized cGAN model.
[0074] It can be understood that consistency constraint is a mechanism used to ensure the consistency of generated test data under different conditions.
[0075] It can be understood that coherence maintenance is a mechanism to ensure that the generated data works together between different testing links.
[0076] Based on the above two types of mechanisms, the cGAN model is optimized to obtain an optimized cGAN model.
[0077] Step S140, obtaining test data according to the optimized cGAN model.
[0078] The optimized cGAN model is used to realize the generation of automated test data.
[0079] Through the above method, by introducing intelligent generative adversarial networks (GAN), it is possible to generate diverse, authentic and multimodal test data to meet different test scenarios and requirements, thereby solving the problem of lack of diversity and authenticity in traditional test data generation methods. At the same time, through conditional generative adversarial networks (cGAN) and consistency constraints, it is possible to ensure that the generated data maintains consistency and coordination between multiple test links, solving the data consistency problem.
[0080] Through the above method, by making full use of structures such as convolutional neural network (CNN) and recurrent neural network (RNN) in the discriminator network, it is possible to generate test data in multiple modalities, including images, texts, numbers, etc., which solves the problem that traditional methods are difficult to handle multimodal data.
[0081] By introducing the conditional generative adversarial network (cGAN) deep learning technology, the method in the embodiment of the present application can intelligently generate test data, solving the problem of lack of diversity and authenticity in traditional test data generation methods. This means that the generated test data is more representative, can better simulate real test situations, and improve the accuracy and credibility of the test.
[0082] In addition, the method in the embodiment of the present application can support the generation of multimodal data, including text, numerical values, amounts, percentages, dates and other types, overcoming the limitation that traditional methods are difficult to process multimodal data. This makes the test data more diverse, helps to cover a wider range of test cases, and improves the comprehensiveness of the test.
[0083] In addition, through the conditional generative adversarial network (cGAN) and consistency constraints, the method in the embodiment of the present application can maintain the consistency and coordination of the generated data between different test links. This helps to simulate complex test processes and ensure the coherence and integrity of the test.
[0084] Most importantly, the method in the embodiment of the present application automates the test data generation process, reduces manual work, and improves the efficiency of generating data. This reduces labor costs, enables the test team to generate a large amount of high-quality test data more quickly, and improves the efficiency and productivity of testing.
[0085] In summary, the above methods include the advantages of improving the diversity, authenticity, comprehensiveness and efficiency of test data, helping to evaluate the performance of software and systems more accurately and comprehensively, and bringing innovative solutions to the testing field.
[0086] The shortcomings or deficiencies in the related art are:
[0087] A. Lack of diversity and authenticity: Most existing methods are unable to generate test data with sufficient diversity and authenticity. They are restricted by predefined rules or limited data samples and therefore cannot effectively simulate diverse test scenarios in the real world.
[0088] B. It is difficult to generate multimodal data: Multimodal data includes multiple types such as images, texts, and numbers, but existing methods find it difficult to generate multimodal data simultaneously, which limits the diversity and applicability of test data.
[0089] C. Insufficient data consistency and coordination: In some test scenarios, different data modes or test steps need to maintain consistency and coordination, but existing technologies often cannot effectively solve this problem, resulting in a break in the test process.
[0090] D. High reliance on manual actions: Traditional methods usually require a lot of manual feature engineering, rule writing, or data labeling, which increases cost and complexity and is not flexible enough to adapt to changes.
[0091] The method in the embodiment of the present application has the following beneficial effects:
[0092] 1. Improve the diversity and authenticity of test data: Through intelligent generative adversarial networks (GANs), we can generate diverse, authentic, and multimodal test data to meet different test scenarios and requirements, solving the problem of lack of diversity and authenticity in traditional test data generation methods.
[0093] 2. Support multimodal data generation: By making full use of structures such as convolutional neural networks (CNN) and recurrent neural networks (RNN), it is able to generate test data in multiple modalities, including images, text, numbers, etc., solving the problem that traditional methods are difficult to handle multimodal data.
[0094] 3. Maintain data consistency and coordination: Through the conditional generative adversarial network (cGAN) and consistency constraints, it is possible to ensure that the generated data remains consistent and coordinated between multiple testing links, solving the data consistency problem.
[0095] 4. Reduce manual actions: Automating the test data generation process reduces the reliance on manual feature engineering, rule writing, or data labeling, reduces labor costs, and improves the efficiency of test data generation.
[0096] 5. Improve test coverage and quality: By generating diverse and multimodal test data, test coverage is improved, which helps to test software and systems more comprehensively and improves the quality of test data.
[0097] 6. Respond to complex testing requirements: It is applicable to various complex testing requirements, including multimodal data generation, data consistency maintenance, conditional data generation, etc., and provides a more flexible test data generation solution.
[0098] In one embodiment of the present application, the training conditional generative adversarial network cGAN generator network and discriminator network to obtain the cGAN model includes: selecting a corresponding neural network architecture, determining that the model architecture of the cGAN model includes at least a generator network and a discriminator network; constructing the generator network and the discriminator network, and defining a loss function; and performing multi-training iterations according to the generator network, the discriminator network and the loss function to obtain the cGAN model.
[0099] like Figure 4 As shown in the figure, when choosing a model architecture, cGAN consists of a generator network and a discriminator network. The generator is responsible for generating data, and the discriminator is responsible for judging whether the generated data is real or fake. Depending on the complexity of the problem, an appropriate neural network architecture can be selected, such as a convolutional neural network (CNN) or a recurrent neural network (RNN).
[0100] like Figure 4As shown, further, a generator network is constructed: the generator network receives condition information (usually anomaly type labels) and random noise as input, and generates test data that matches the conditions. Using CNN and RNN structures, condition labels are used as input to generate test data that meets the conditions; different conditions can include modality type, data type, anomaly type, etc.
[0101] like Figure 4 As shown, further, a discriminator network is constructed: the discriminator network receives the data generated by the generator and the real test data as input, and tries to distinguish which are real data and which are fake. Its main goal is to help the generator generate more realistic data.
[0102] Preferably, a loss function is defined, and an appropriate loss function is defined to measure the performance of the generator and the discriminator during the training process; the goal of the generator is to minimize the difference between the generated data and the real data, while the goal of the discriminator is to correctly identify the real data and the generated data. Generally, a binary cross entropy loss function is used. During the training process, the generator and the discriminator improve the model performance by alternately optimizing the loss function.
[0103] In one embodiment of the present application, the data to be processed is collected according to different test scenarios, including: when the test scenario includes a new system and there is no test data and actual production data, the data to be processed is collected by manually making data; when the test scenario includes a system that has successfully run, the data to be processed is collected from actual production data; when the test scenario includes a system that has run but has defects, the data to be processed is collected by any one or more of annotated data, monitoring system behavior, feedback loops, improving data generation models, and manual intervention.
[0104] like Figure 2 As shown, one possible situation is that the system has no new test data and actual production data.
[0105] When the system is newly built and there is no available test data or actual production data, you can take the approach of manually creating data. Data type determination: First, you need to determine the type of data to be generated, such as images, text, numbers, etc. Data structure design: Define a suitable data structure for each data type, including fields, attributes, labels, etc. Manual generation: Based on the data structure, manually create some sample data. The data can be virtual data that conforms to the actual situation, so as to conduct preliminary testing and verification of the system.
[0106] like Figure 3 As shown, another possible situation is: the system has successfully run
[0107] When the system has been running for a while and has generated actual production data, you can collect test data from the actual production data, including:
[0108] Normal operation data collection: Collect normal operation data samples from actual production data, which can be used for benchmarking and normal performance testing.
[0109] Abnormal data collection: For different types of abnormal situations, collect abnormal data samples from actual production data. These data can be used to simulate system abnormality tests.
[0110] In both cases, data labeling and classification are also very important so that the subsequent training of the cGAN model can distinguish between normal data and abnormal data, or different types of data.
[0111] Another possible situation is: a system that is already running but has defects. If the system under test is already running but still has many defects, it will inevitably generate some abnormal data due to incorrect process transmission or logical errors, but the model may misjudge it as normal data. For this reason, the following single or multiple means are needed to handle it:
[0112] Label the data: When training data, make sure that the dataset contains known system defect cases and mark them as abnormal data; the model can normally identify and learn these anomalies.
[0113] Monitor system behavior: System behavior should be continuously monitored while generating data and executing tests. If the data generated by the model triggers unusual behavior or errors in the actual system, the system should be able to automatically identify this and log it as a problem or anomaly.
[0114] Feedback loop: Establish a feedback loop to feed test results back into data generation and model training. If the model cannot accurately identify abnormal situations in the actual system, these situations can be added to the training data and the model can be retrained to improve its performance.
[0115] Improve the data generation model: If the model cannot accurately generate anomalous data that contains system defects, consider using more training data, a more complex model architecture, or an improved training strategy.
[0116] Manual intervention: For particularly complex or critical test scenarios, you can consider introducing manual intervention, where testers can manually create test cases that contain known defects in the system to ensure that these situations are adequately covered.
[0117] In one embodiment of the present application, the cGAN model is optimized by using consistency constraints and / or synergy maintenance, including: optimizing the cGAN model by using consistency constraints based on ensuring that the generated data has similar features and attributes under different conditions; and / or maintaining the cGAN model by using synergy based on ensuring the consistency of the generated test data under different conditions.
[0118] like Figure 5 As shown, consistency constraint: A consistency constraint is a mechanism to ensure the consistency of the generated test data under different conditions; it can be a mathematical or logical expression that ensures that the generated data has similar characteristics and properties under different conditions. For example, in the case of multimodal data generation, a consistency constraint can ensure that the generated text and numerical data are related under the same conditions, rather than completely unrelated data.
[0119] like Figure 5 As shown, Coherence Maintenance: Coherence Maintenance is a mechanism to ensure that the generated data works together between different test links. During the testing process, the generated data may need to be used in multiple test stages, and the data needs to maintain synergy to simulate the actual test process. It can include ensuring consistent data labels, data formats, and data structures. This helps ensure that the generated data can be used correctly in different test links to detect the performance and stability of the system. For example, if the generated data is used for normal performance testing and abnormal situation testing, then coherence maintenance can ensure that the format and labels of the data are consistent in both cases so that testers can compare and analyze.
[0120] Through the method, based on consistency constraints and coordination maintenance algorithms, the algorithm to maintain the consistency and coordination of generated data is the key technology of this solution, which may include constraint optimization, synchronization strategy, etc.
[0121] In one embodiment of the present application, obtaining test data according to the optimized cGAN model includes: determining a data type; selecting a model training condition; generating test data using the optimized cGAN model according to the data type and the model training condition; and performing data labeling and classification on the test data.
[0122] like Figure 5As shown, continuous optimization and monitoring, data type selection: determine the data type that needs to be generated for different test scenarios and requirements, such as integers, strings, dates, amounts, etc. Condition setting: in the cGAN model, set conditions, that is, abnormal type labels or other test conditions; these conditions will be used in the network model to generate data that meets different test scenarios. Generate data: use the trained cGAN model to generate test data based on the set conditions and random noise. Data labeling and classification: label and classify the generated data for subsequent testing; labeling includes determining the type of data (normal or abnormal) and the specific type of abnormality.
[0123] In one embodiment of the present application, the method further includes: applying the test data to a test scenario, wherein the test scenario includes at least one of the following: test case generation, performance testing, stability testing, and exception handling testing.
[0124] When applied to test scenarios, the following scenarios are mainly included:
[0125] a. Test case generation: Automatically generate test cases based on the generated test data. Test cases should include tests under normal conditions and tests under various abnormal conditions.
[0126] b. Performance testing: Use the generated data to perform performance testing to evaluate the performance of the system under normal and abnormal conditions.
[0127] c. Stability test: Test the stability of the system during long-term operation, including detection of resource consumption and memory leaks.
[0128] d. Exception handling test: Verify the system's ability to handle various abnormal situations, including error messages, logging and alarms.
[0129] Through the above methods, we also achieve fine optimization and continuous optimization of the automation process. Through the cleverly designed automation process, the steps of data collection, model training, data generation, etc. are closely connected to form an efficient pipeline. At the same time, a continuous optimization mechanism is introduced to continuously improve the generated model through feedback loops to ensure continuous adaptability in a dynamic test environment.
[0130] In one embodiment of the present application, the method further includes: continuously enriching the collection of data to be processed according to different test scenarios; and / or regularly updating the cGAN model; and / or establishing a monitoring system to track the performance and stability of the generated data in the test, and based on the monitoring results, feeding back to the model training process; establishing a feedback loop to feed back the test results to the generation of data to be processed and model training.
[0131] Data enrichment: Continuously collect actual production data to further enrich the training data set to ensure that the generated data is more in line with the actual situation. Model improvement: Regularly update the cGAN model to improve the quality and diversity of the generated data. You can consider using a more complex model architecture or increasing the diversity of the training data. Monitoring and feedback: Establish a monitoring system to track the performance and stability of the generated data in testing. Based on the monitoring results, feedback is provided to the model training process to correct problems and improve the model in a timely manner. Automated integration: Integrate the automated data generation process into the continuous integration / continuous delivery process to ensure that new test data can be generated and tested after each code change. Feedback loop: Establish a feedback loop to feed back the test results into data generation and model training to continuously improve data generation quality and testing efficiency.
[0132] Through the above method, the wide applicability of test data is improved, and the generated multimodal data is not only widely used in basic testing fields, but also adaptable in professional field testing scenarios; this breadth makes this solution a universal solution for testing needs in different fields, showing strong adaptability.
[0133] The present application embodiment also provides a test data generating device 600, such as Figure 6 As shown, a schematic diagram of the structure of a test data generating device in an embodiment of the present application is provided, wherein the test data generating device 600 at least includes: a collection module 610, a training module 620, an optimization module 630 and a test data generating module 640, wherein:
[0134] In one embodiment of the present application, the acquisition module 610 is specifically used to acquire the data to be processed according to different test scenarios.
[0135] Different test scenarios may include: a newly built system, no test data or actual production data, or a system that has been successfully running, or a system that has been running but has defects. It can be understood that "system" here refers to the system that needs to be tested. According to different test scenarios, data to be processed can be collected, and these data to be processed include but are not limited to test data collected in the system.
[0136] In one embodiment of the present application, the training module 620 is specifically used to: train the generator network and the discriminator network in the conditional generative adversarial network cGAN according to the data to be processed to obtain the cGAN model.
[0137] The conditional generative adversarial network cGAN consists of a generator network and a discriminator network. The generator is responsible for generating data, and the discriminator is responsible for judging whether the generated data is real or fake. Conditional Generative Adversarial Network (CGAN): It is a variant of GAN that allows the generator network to generate data based on additional conditional information. In test data generation, the condition can be the characteristics or type of existing data to ensure that the generated data meets the condition.
[0138] Specifically, Generative Adversarial Networks (GAN) is a deep learning model composed of a generator and a discriminator. The generator is responsible for generating data, and the discriminator is responsible for evaluating the difference between the generated data and the real data. They continuously improve the quality of the generated data through adversarial training. It can be understood that the generator network is part of the GAN, which accepts input (usually random noise or conditional information) and generates synthetic data; in the test data generation scheme, the generator is used to generate test data. It can be understood that the discriminator network is also part of the GAN, which evaluates the authenticity of the input data, that is, it tries to distinguish between the generated data and the real data. During the training process, the discriminator helps the generator improve the fidelity of the generated data.
[0139] It should be noted that, depending on the complexity of the problem, an appropriate neural network architecture can be selected, such as a convolutional neural network (CNN) or a recurrent neural network (RNN), which is not specifically limited in the embodiments of the present application.
[0140] The generator network and the discriminator network are trained based on the stored or generated data to be processed as training data to obtain the cGAN model. The training process is an iterative process and usually requires multiple rounds of training.
[0141] In one embodiment of the present application, the optimization module 630 is specifically used to optimize the cGAN model by using consistency constraints and / or collaborative maintenance to obtain an optimized cGAN model.
[0142] It can be understood that consistency constraint is a mechanism used to ensure the consistency of generated test data under different conditions.
[0143] It can be understood that coherence maintenance is a mechanism to ensure that the generated data works together between different testing links.
[0144] Based on the above two types of mechanisms, the cGAN model is optimized to obtain an optimized cGAN model.
[0145] In one embodiment of the present application, the test data generation module 640 is specifically used to obtain test data according to the optimized cGAN model.
[0146] The optimized cGAN model is used to realize the generation of automated test data.
[0147] In one embodiment of the present application, the training module 620 is also used to
[0148] Select a corresponding neural network architecture, determine that the model architecture of the cGAN model at least includes a generator network and a discriminator network; construct the generator network and the discriminator network, and define a loss function; perform multi-training iterations according to the generator network, the discriminator network and the loss function to obtain the cGAN model.
[0149] In one embodiment of the present application, the acquisition module 610 is also used to
[0150] When the test scenario includes a new system and there is no test data and actual production data, the data to be processed is collected by manually making data; when the test scenario includes a system that has been successfully running, the data to be processed is collected from actual production data; when the test scenario includes a system that has been running but has defects, the data to be processed is collected by any one or more of annotated data, monitoring system behavior, feedback loops, improving data generation models, and manual intervention.
[0151] In one embodiment of the present application, the optimization module 630 is also used to
[0152] Based on ensuring that the generated data has similar features and attributes under different conditions, the cGAN model is optimized using consistency constraints; and / or, based on ensuring the consistency of the generated test data under different conditions, the cGAN model is maintained using collaboration.
[0153] In one embodiment of the present application, the test data generation module 640 is also used to
[0154] Determine the data type; select the model training conditions; according to the data type and the model training conditions, use the optimized cGAN model to generate test data; and perform data labeling and classification on the test data.
[0155] In one embodiment of the present application, a test scenario application module is also included for
[0156] The test data is applied to a test scenario, wherein the test scenario includes at least one of the following: test case generation, performance testing, stability testing, and exception handling testing.
[0157] In one embodiment of the present application, it also includes: a persistence module for
[0158] According to different test scenarios, continuously enrich the collection of data to be processed; and / or, regularly update the cGAN model; and / or, establish a monitoring system to track the performance and stability of the generated data in the test, and feed back the monitoring results to the model training process; establish a feedback loop to feed back the test results to the generation of data to be processed and model training.
[0159] It can be understood that the above-mentioned test data generating device can implement each step of the test data generating method provided in the above-mentioned embodiment, and the relevant explanations about the test data generating method are applicable to the test data generating device, which will not be repeated here.
[0160] Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 7 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0161] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0162] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0163] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a test data generation device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0164] According to different test scenarios, the data to be processed is collected;
[0165] According to the data to be processed, a generator network and a discriminator network in a conditional generative adversarial network cGAN are trained to obtain a cGAN model;
[0166] The cGAN model is optimized by using consistency constraints and / or synergy maintenance to obtain an optimized cGAN model;
[0167] According to the optimized cGAN model, test data is obtained.
[0168] The above application Figure 1 The method performed by the test data generating device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0169] The electronic device may also perform Figure 1The method executed by the test data generating device in Figure 1 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0170] The present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by an electronic device including multiple application programs, enable the electronic device to execute Figure 1 The method performed by the test data generating device in the embodiment shown is specifically used to perform:
[0171] According to different test scenarios, the data to be processed is collected;
[0172] According to the data to be processed, a generator network and a discriminator network in a conditional generative adversarial network cGAN are trained to obtain a cGAN model;
[0173] The cGAN model is optimized by using consistency constraints and / or synergy maintenance to obtain an optimized cGAN model;
[0174] According to the optimized cGAN model, test data is obtained.
[0175] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0176] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0177] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0178] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0179] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0180] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0181] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0182] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0183] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0184] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A test data generation method, wherein: The method comprises: According to different test scenarios, the data to be processed is collected; According to the data to be processed, a generator network and a discriminator network in a conditional generative adversarial network cGAN are trained to obtain a cGAN model; The cGAN model is optimized by using consistency constraints and / or synergy maintenance to obtain an optimized cGAN model; According to the optimized cGAN model, test data is obtained.
2. The method of claim 1, wherein: The generator network and the discriminator network in the training conditional generative adversarial network cGAN are trained to obtain a cGAN model, including: Select a corresponding neural network architecture, and determine that the model architecture of the cGAN model at least includes a generator network and a discriminator network; Constructing the generator network and the discriminator network, and defining a loss function; According to the generator network, the discriminator network and the loss function, multiple training iterations are performed to obtain the cGAN model.
3. The method of claim 1, wherein: According to different test scenarios, the data to be processed are collected, including: When the test scenario includes a new system and there is no test data or actual production data, the data to be processed is collected by manually making data; In the case where the test scenario includes that the system has been successfully run, the data to be processed is collected from actual production data; In the test scenario, in which the system is already running but has defects, the data to be processed is collected by any one or more of annotating data, monitoring system behavior, feedback loops, improving data generation models, and manual intervention.
4. The method of claim 1, wherein: The adopting of consistency constraints and / or synergy maintenance to optimize the cGAN model includes: The cGAN model is optimized using consistency constraints based on ensuring that the generated data has similar features and attributes under different conditions; and / or, Based on ensuring the consistency of the generated test data under different conditions, the cGAN model is maintained collaboratively.
5. The method of claim 1, wherein: The step of obtaining test data according to the optimized cGAN model includes: Determine the data type; Select model training conditions; Generate test data using the optimized cGAN model according to the data type and the model training condition; The test data is labeled and classified.
6. The method of claim 1, wherein: The method further comprises: The test data is applied to a test scenario, wherein the test scenario includes at least one of the following: test case generation, performance testing, stability testing, and exception handling testing.
7. The method of claim 1, wherein: The method further comprises: According to different test scenarios, continuously enrich the collection of data to be processed; and / or, regularly updating the cGAN model; and / or, establish a monitoring system to track the performance and stability of the generated data during testing, and provide feedback to the model training process based on the monitoring results; Establish a feedback loop to feed test results into the generation of processed data and model training.
8. A test data generating device, wherein: The device comprises: The acquisition module is used to acquire the data to be processed according to different test scenarios; A training module, used for training a generator network and a discriminator network in a conditional generative adversarial network cGAN according to the data to be processed, to obtain a cGAN model; An optimization module, used to optimize the cGAN model by using consistency constraints and / or collaborative maintenance to obtain an optimized cGAN model; The test data generation module is used to obtain test data according to the optimized cGAN model.
9. An electronic device, comprising: processor; as well as A memory arranged to store computer executable instructions, which when executed cause the processor to perform the method of any one of claims 1 to 7.
10. A computer-readable storage medium storing one or more programs, which, when executed by an electronic device including a plurality of application programs, causes the electronic device to execute any one of the methods of claims 1 to 7.
Citation Information
Cited By
5G-A test method and device based on CGAN-PCA
CN120730343A
5g-a test method and device based on cgan-pca
CN120730343B