Test case generation method and system based on attention mechanism adversarial network
Through the test case generation method based on the attention mechanism to combat network, test cases are automatically generated, which solves the problem of a lot of manpower and time consuming generation of test cases in the existing technology, improves the coverage of test scenarios, and ensures project quality.
Patent Information
- Application Number
- CN202411023441.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-12-06
AI Technical Summary
The generation of test cases in the prior art consumes a lot of manpower and time during the software testing process, resulting in missing test points, compressing test execution time, increasing project delays and quality risks.
The test case generation method based on the attention mechanism is adopted to build a network model of the generator and discriminator, and the adversarial training optimization parameters are used to learn the mapping relationship between project functional requirements and test cases to achieve automatic generation of test cases.
This reduces manpower investment in the test case design stage, avoids omissions of test points caused by human factors, improves the coverage of test scenarios, and ensures project quality.
Smart Images

Figure CN119088675A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of case generation, software testing and data processing, and in particular to a test case generation method and system based on an attention mechanism adversarial network. Background Art
[0002] During the software testing process, test cases provide detailed test steps and expected results to guide testers in performing tests and ensure the consistency and repeatability of the testing process. By designing test cases for various functions and business scenarios, it can ensure that the testing work fully covers all requirements in the software requirements specification, which helps to discover defects and potential problems in the software, thereby improving software quality. It is an important step in the software testing process.
[0003] Test cases are the basis of system testing quality. The quality of test cases directly determines whether there will be missed tests or missed inspections during the test execution phase. In order to ensure the quality of test case generation, the prior art has proposed a variety of solutions. For example, the manual writing method based on the test guide document requires the tester to set the test point directory according to the test point outline, and then manually design and write the test case based on the test point and his own test experience. Whether the result is accurate depends on the reliable test point outline. It not only requires the tester to have a high degree of familiarity with the system to be tested, but also takes up a lot of time for the tester, and is prone to omission of test points, leading to project quality risks; the test case generation method based on user input information and keyword library, this method compares the keyword library with the obtained user input information, determines the keyword corresponding to the input information in the keyword library, finds the use case fragment associated with the keyword, and splices the use case fragment to form a test case, but the test keyword library in this method requires a lot of manpower to continuously update and maintain; the test case generation method based on neural network obtains the generated test case by training the neural network model. This method requires manual keyword extraction from historical project documents and labeling of test cases before they can be used as data sets for network model training. It also requires manual modification of test cases generated by the neural network before using them for network model correction. Manual processing of project documents and test cases in advance and modification of models to generate test cases during training will consume a lot of manpower.
[0004] It can be seen that the test case generation and acquisition methods under the existing technology have the problem of missing test points due to a lot of manpower and subjective factors. Since there are generally strict time limits for the system testing phase in software development, the testing process needs to be carried out within an extremely limited time. If a lot of manpower and time are spent in the test case design phase, the time for test execution and other test phases will be greatly compressed, leading to the risk of project delay; in addition, if test points are missed due to subjective factors of testers, it will also lead to quality risks in the project. Summary of the invention
[0005] In order to address the shortcomings of the prior art, the present invention proposes a test case generation method and system based on an attention mechanism adversarial network. The generative adversarial network method is adopted, and an attention mechanism is introduced to construct a test case generation network model including a generator and a discriminator. The attention mechanism is used to extract text features in training samples, and adversarial training between the generator and the discriminator is used to optimize the network model parameters. The mapping relationship between the project functional requirements and the test cases is learned, thereby realizing the automatic generation of test cases.
[0006] To achieve the above objectives, the technical solutions adopted by the present invention include:
[0007] A test case generation method based on an attention mechanism adversarial network, characterized by comprising:
[0008] S1. Construct a generator, wherein the generator includes an encoder, a feature learner, and a decoder, wherein the encoder includes a convolutional layer that introduces an attention mechanism, and the decoder includes a deconvolutional layer that introduces an attention mechanism;
[0009] S2, build a discriminator based on convolutional neural network;
[0010] S3. Configure a loss function, where the loss function includes adversarial loss and reconstruction loss;
[0011] S4. Obtain historical data, and perform data preprocessing operations based on the historical data to obtain functional requirement data and standard test case sample data;
[0012] S5, using the functional requirement data, the standard test case sample data and the loss function to perform adversarial training operations according to the generator and the discriminator to obtain a case generation model;
[0013] S6. Use the case generation model to perform a test case generation operation.
[0014] Furthermore, the encoder includes a plurality of encoding units, each of which includes a convolutional layer, a batch normalization layer, and an activation function layer connected in sequence, wherein the convolutional layer includes an attention weight calculation module for a spatial position;
[0015] The decoder comprises a plurality of decoding units, each of which comprises a deconvolution layer, a batch normalization layer and an activation function layer connected in sequence and introducing an attention mechanism, wherein the deconvolution layer introducing the attention mechanism comprises an attention weight calculation module for a spatial position.
[0016] Furthermore, the feature learner includes a plurality of residual units, each of which includes a first convolutional normalization layer, an activation function layer, and a second convolutional normalization layer connected in sequence, and the residual unit also includes a shortcut connection bypassing the first convolutional normalization layer, the activation function layer, and the second convolutional normalization layer.
[0017] Furthermore, the adversarial loss is shown in Formula 1, and the reconstruction loss is shown in Formula 2.
[0018]
[0019] L L1 =∑ x,y,z [‖yG(x,z)‖1] Formula 2
[0020] Among them, L cGAN represents the adversarial loss, L L1 represents reconstruction loss, G represents generator, D represents discriminator, x represents input, y represents learning target, z represents random noise, a represents generated sample, and b represents real sample;
[0021] The loss function is shown in Formula 3:
[0022] L total =W cGAN *L cGAN +W L1 *L L1 Formula 3
[0023] Among them, W cGAN represents the adversarial loss weight, W L1 represents the reconstruction loss weight.
[0024] Furthermore, the adversarial training operation includes:
[0025] Input the functional requirement data into the generator to obtain the generated samples;
[0026] Using the generated sample and the real sample selected from the standard test case sample data as input, using the discriminator to determine whether there is a difference between the generated sample and the real sample;
[0027] When it is determined that there is no difference between the generated sample and the real sample, the generator is output as a case generation model.
[0028] Furthermore, the adversarial training operation also includes:
[0029] When it is determined that the generated sample is different from the real sample, an error parameter is generated;
[0030] Use the error parameter to adjust the generator;
[0031] Re-obtain the generated samples using the adjusted generator.
[0032] The present invention also relates to a test case generation system based on an attention mechanism adversarial network, characterized in that it includes:
[0033] The generator management module is used to build and adjust generators;
[0034] Discriminator management module, used to build the discriminator;
[0035] Loss function management module, used to configure loss function;
[0036] A training data management module is used to perform data preprocessing operations based on historical data to obtain functional requirement data and standard test case sample data;
[0037] A model training module, used to perform adversarial training operations according to the generator and the discriminator using functional requirement data, standard test case sample data, and a loss function to obtain a case generation model;
[0038] The case generation module is used to perform test case generation operations using the case generation model.
[0039] The present invention also relates to a computer-readable storage medium, characterized in that a computer program is stored on the storage medium, and the computer program implements the above method when executed by a processor.
[0040] The present invention also relates to an electronic device, characterized in that it comprises a processor and a memory;
[0041] The memory is used to store functional requirement data and standard test case sample data;
[0042] The processor is used to execute the above method by calling functional requirement data and standard test case sample data.
[0043] The present invention also relates to a computer program product, comprising a computer program and / or instructions, characterized in that the computer program and / or instructions implement the steps of the above method when executed by a processor.
[0044] The beneficial effects of the present invention are:
[0045] The test case generation method and system based on the attention mechanism adversarial network described in the present invention are adopted, and the generative adversarial network method is adopted, and the attention mechanism is introduced to construct a test case generation network model including a generator and a discriminator, wherein the test case generator uses the historical requirements of the project as the input of the network model, and the historical test cases corresponding to the requirements as the learning target of the network model. First, the text features in the input sample are extracted through the attention mechanism in the network model, and then the parameters of the generated network are continuously optimized to generate test cases that are closer to the target test cases. The discriminator uses the test cases automatically generated by the generator or the historical standard test cases as input, judges whether the input test cases come from the generator or the historical standard samples, and uses the judgment results as the input. Feedback is given to the generator to optimize the parameters of the generated network, the parameters of the network model are optimized through mutual adversarial training between the generator and the discriminator, the mapping relationship between the project functional requirements and the test cases is learned, so as to realize the automatic generation of test cases, the network model adversarial training learning process does not require manual intervention, and does not require pre-processing of the training samples in advance, avoiding the time consumed by the early sample pre-processing and the large amount of manpower consumed in the test case design stage, alleviating the test manpower pressure, and at the same time the attention mechanism can better extract the features in the training samples, and the continuously optimized model parameters can also make the automatically generated test cases more refined, which can improve the coverage of the test scenarios, avoid the omission of test points caused by human subjective factors, and thus ensure the quality of the project. The test case generation method and system of the present invention can effectively solve the problems such as the large amount of manpower consumed in the test case design stage during the current system testing process, as well as the low generation efficiency and the omission of test points caused by subjective factors. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 This is a flow chart of the test case generation method based on the attention mechanism adversarial network of the present invention.
[0047] Figure 2 This is a schematic diagram of the test case generation system structure of the attention mechanism-based adversarial network of the present invention.
[0048] Figure 3 It is a schematic diagram of the structure of a preferred embodiment of the generator of the present invention.
[0049] Figure 4 Schematic diagram of the residual unit structure in a preferred embodiment of the generator of the present invention. DETAILED DESCRIPTION
[0050] In order to more clearly understand the content of the present invention, it will be described in detail with reference to the accompanying drawings and embodiments. It should be noted that in the embodiments of the present application, some existing solutions in the industry such as certain software, components, models, etc. may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0051] The acquisition, transmission, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.
[0052] The first aspect of the present invention relates to a process of steps as follows Figure 1 The test case generation method based on the attention mechanism adversarial network shown in FIG. 1 includes:
[0053] S1. Construct a generator, wherein the generator includes an encoder, a feature learner and a decoder, wherein the encoder includes a convolutional layer that introduces an attention mechanism, and the decoder includes a deconvolutional layer that introduces an attention mechanism.
[0054] Preferably, the encoder comprises a plurality of encoding units, the encoding units comprising a convolutional layer, a batch normalization layer and an activation function layer connected in sequence and introducing an attention mechanism, the convolutional layer introducing the attention mechanism comprising an attention weight calculation module for the spatial position; the decoder comprises a plurality of decoding units, the decoding units comprising a deconvolutional layer, a batch normalization layer and an activation function layer connected in sequence and introducing an attention mechanism, the deconvolutional layer introducing the attention mechanism comprising an attention weight calculation module for the spatial position.
[0055] Preferably, the feature learner includes a plurality of residual units, each of which includes a first convolutional normalization layer, an activation function layer, and a second convolutional normalization layer connected in sequence, and each of which also includes a shortcut connection bypassing the first convolutional normalization layer, the activation function layer, and the second convolutional normalization layer.
[0056] In the specific implementation, the function of the generator is to generate test cases that are as close to the target test cases as possible, that is, in the process of generating test cases, the detailed information in the functional requirements should be extracted to the maximum extent and refined, so as to generate test cases with relatively small granularity and improve the coverage of the test scenarios. In order to enable the neural network model to better learn detailed information and generate test cases with smaller granularity, the attention mechanism is introduced in the generative adversarial network model. The attention mechanism in deep learning draws on the human attention thinking mode. It can help the model better focus on important sentences and words in the input text, making the model more accurate and effective when processing data, thereby improving the accuracy and efficiency of the model. In addition, the design of the generative network does not use the traditional convolutional neural network, but draws on the basic ideas of U-Net and Resnet. U-Net is a deep learning model proposed by the University of Freiburg in Germany. It has an encoder-decoder structure and contains a skip connection structure in the model, which can splice detailed information with macro information by channel. This structure can well retain the detailed information in the learning process of the network model. Resnet is a deep convolutional network whose network model contains a residual structure with shortcut connection operations. This structure can speed up the training of neural networks and improve the performance of the network while expanding the depth of the network.
[0057] The network model of the generator of a preferred embodiment is as follows Figure 3 As shown in the figure, the historical functional requirements of the input project are finally output as generated test cases after the encoding stage, feature learning stage and decoding stage. The encoding stage includes a convolution layer (Attention CONV) with an attention mechanism, a batch normalization layer (BN) and an activation function layer (Peaky ReLU), the purpose of which is to extract the feature information of the input functional requirements. The input functional requirements are first encoded through the convolution operation of the attention mechanism. Batch normalization is used after each convolution layer, and PReLU is used as the activation function. In the feature learning stage, feature learning is performed through 4 consecutive Resnet structures (residual units) to realize the conversion from functional requirements to test cases. The residual unit structure of Resnet is shown in the figure. Figure 4 As shown in the figure, by directly transmitting the input to the output, the integrity of the test case information is protected, avoiding the information loss and other problems that are easy to occur in traditional convolutional neural networks. The decoding stage contains a deconvolution layer with an attention mechanism, a batch normalization layer, and an activation function layer, the purpose of which is to generate a generated test case that is close to the target test case.
[0058] S2. Build a discriminator based on convolutional neural network.
[0059] In specific implementation, the task of the discriminator is to determine whether the input test case comes from the test case generated by the generator or the standard test case sample, and then feed back the error parameters to the generator. Therefore, whether the discriminator can correctly judge the "truthfulness" of the input test case (whether it can distinguish the difference between the generated case and the real case) will directly affect the quality of the generated test case.
[0060] S3. Configure a loss function, where the loss function includes adversarial loss and reconstruction loss.
[0061] Preferably, the adversarial loss is as shown in Formula 1, and the reconstruction loss is as shown in Formula 2.
[0062]
[0063] L L1 =∑ x,y,z [‖yG(x,z)‖1] Formula 2
[0064] Among them, L cGAN represents the adversarial loss, L L1 represents reconstruction loss, G represents generator, D represents discriminator, x represents input, y represents learning target, z represents random noise, a represents generated sample, and b represents real sample;
[0065] The loss function is shown in Formula 3:
[0066] L total =W cGAN *L cGAN +W L1 *L L1 Formula 3
[0067] Among them, W cGAN represents the adversarial loss weight, W L1 represents the reconstruction loss weight.
[0068] In the specific implementation, the adversarial loss uses the least squares loss to alleviate the problem that the loss function easily leads to the vanishing gradient during the training process, making the training process more stable. The combined reconstruction loss can further improve the effectiveness of the discriminator's network model, making the generated test cases closer to the real target cases.
[0069] S4. Obtain historical data, and perform data preprocessing operations based on the historical data to obtain functional requirement data and standard test case sample data.
[0070] In specific implementation, the historical requirement documents of a test system and the test cases corresponding to the requirements can be collected and organized as training data sets, the historical requirements of the project can be used as input conditions, and the real test cases corresponding to the requirements can be used as learning targets to train the network model. During the training process, the discriminator continuously optimizes the parameters of the generator.
[0071] S5. Use functional requirement data, standard test case sample data, and loss function to perform adversarial training operations on the generator and discriminator to obtain a case generation model.
[0072] Preferably, the adversarial training operation includes:
[0073] Input the functional requirement data into the generator to obtain the generated samples;
[0074] Using the generated sample and the real sample selected from the standard test case sample data as input, using the discriminator to determine whether there is a difference between the generated sample and the real sample;
[0075] When it is determined that the generated sample is different from the real sample, an error parameter is generated;
[0076] Use the error parameter to adjust the generator;
[0077] Use the adjusted generator to regenerate the generated samples;
[0078] When it is determined that there is no difference between the generated sample and the real sample, the generator is output as a case generation model.
[0079] In the specific implementation, the training process of the network model is the process of the test case generator and the discriminator playing against each other. The specific training process is that the generator generates fake test cases, and then inputs the generated fake test case data and real test case data into the discriminator. The discriminator needs to determine which are real test cases and which are test cases generated by the generator. There will be a large error between the test cases generated by the generator in the early stage and the real test cases, and it is easy for the discriminator to judge the true and false. The discriminator passes the error parameters to the generator, and the generator continuously optimizes its generation level according to the error parameters. When the discriminator cannot determine whether the input test cases come from generated test cases or standard test cases, a usable generator is obtained.
[0080] S6. Use the case generation model to perform a test case generation operation.
[0081] During the specific implementation, new functional requirements are input into the trained network model, and test cases corresponding to the input functional requirements are automatically generated based on the trained model parameters.
[0082] Another aspect of the present invention also relates to a test case generation system based on an attention mechanism adversarial network, the structure of which is as follows: Figure 2 As shown, including:
[0083] The generator management module is used to build and adjust generators;
[0084] Discriminator management module, used to build the discriminator;
[0085] Loss function management module, used to configure loss function;
[0086] A training data management module is used to perform data preprocessing operations based on historical data to obtain functional requirement data and standard test case sample data;
[0087] A model training module, used to perform adversarial training operations according to the generator and the discriminator using functional requirement data, standard test case sample data, and a loss function to obtain a case generation model;
[0088] The case generation module is used to perform test case generation operations using the case generation model.
[0089] By using this system, the above-mentioned operation processing method can be executed and the corresponding technical effects can be achieved.
[0090] An embodiment of the present invention also provides a computer-readable storage medium capable of implementing all the steps in the method in the above embodiment, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, all the steps in the method in the above embodiment are implemented.
[0091] An embodiment of the present invention also provides an electronic device for executing the above method. As an implementation device of the method, the electronic device has at least a processor and a memory, and in particular, the memory stores data required for executing the method and related computer programs, such as functional requirement data and standard test case sample data, etc., and the processor calls the data and program in the memory to execute all steps of the implementation method and obtains the corresponding technical effect.
[0092] Preferably, the electronic device may include a bus architecture, the bus may include any number of interconnected buses and bridges, and the bus will include various circuits linked together by one or more processors and memories. The bus may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are all well known in the art and are therefore not further described herein. The bus interface provides an interface between the bus and the receiver and transmitter. The receiver and transmitter may be the same component, i.e., a transceiver, providing a unit for communicating with various other systems over a transmission medium. The processor is responsible for managing the bus and general processing, while the memory may be used to store data used by the processor when performing operations.
[0093] In addition, the electronic device may further include components such as a communication module, an input unit, an audio processor, a display, and a power supply. The processor (or controller, operation control) used may include a microprocessor or other processor device and / or a logic device, which receives input and controls the operation of various components of the electronic device; the memory may be one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory, or other suitable devices, which may store the above-mentioned related data information, and may also store a program for executing related information, and the processor may execute the program stored in the memory to realize information storage or processing, etc.; the input unit is used to provide input to the processor, for example, it may be a key or a touch input device; the power supply is used to provide power to the electronic device; the display is used to display display objects such as images and text, for example, it may be an LCD display. The communication module is a transmitter / receiver that sends and receives signals via an antenna. The communication module (transmitter / receiver) is coupled to the processor to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal. Based on different communication technologies, multiple communication modules may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless local area network module, etc. The communication module (transmitter / receiver) is also coupled to a speaker and a microphone via an audio processor to provide an audio output via the speaker and receive an audio input from the microphone, thereby realizing a common telecommunication function. The audio processor may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor is also coupled to a central processor, so that recording can be performed on the machine through the microphone, and the sound stored on the machine can be played through the speaker.
[0094] 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.
[0095] 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 system that specifies the functions of a box or multiple boxes.
[0096] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction system, which is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0097] 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 of the functions specified in a box or multiple boxes. Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they know the basic creative concept. Therefore, the attached claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0098] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A test case generation method based on attention mechanism adversarial network, characterized in that: include: S1. Construct a generator, wherein the generator includes an encoder, a feature learner, and a decoder, wherein the encoder includes a convolutional layer that introduces an attention mechanism, and the decoder includes a deconvolutional layer that introduces an attention mechanism; S2, build a discriminator based on convolutional neural network; S3. Configure a loss function, where the loss function includes adversarial loss and reconstruction loss; S4. Obtain historical data, and perform data preprocessing operations based on the historical data to obtain functional requirement data and standard test case sample data; S5, using the functional requirement data, the standard test case sample data and the loss function to perform adversarial training operations according to the generator and the discriminator to obtain a case generation model; S6. Use the case generation model to perform a test case generation operation.
2. The method according to claim 1, characterized in that The encoder comprises a plurality of encoding units, each of which comprises a convolutional layer, a batch normalization layer and an activation function layer connected in sequence, wherein the convolutional layer comprising an attention mechanism comprises an attention weight calculation module for a spatial position; The decoder comprises a plurality of decoding units, each of which comprises a deconvolution layer, a batch normalization layer and an activation function layer connected in sequence and introducing an attention mechanism, wherein the deconvolution layer introducing the attention mechanism comprises an attention weight calculation module for a spatial position.
3. The method according to claim 2, characterized in that The feature learner includes a plurality of residual units, each of which includes a first convolutional normalization layer, an activation function layer, and a second convolutional normalization layer connected in sequence, and the residual unit also includes a shortcut connection bypassing the first convolutional normalization layer, the activation function layer, and the second convolutional normalization layer.
4. The method according to claim 1, characterized in that The adversarial loss is shown in Formula 1, and the reconstruction loss is shown in Formula 2. L L1 =∑ x,y,z [‖yG(x,z)‖1] Formula 2 Among them, L cGAN represents the adversarial loss, L L1 represents reconstruction loss, G represents generator, D represents discriminator, x represents input, y represents learning target, z represents random noise, a represents generated sample, and b represents real sample; The loss function is shown in Formula 3: L total =W cGAN *L cGAN +W L1 *L L1 Formula 3 Among them, W cGAN represents the adversarial loss weight, W L1 represents the reconstruction loss weight.
5. The method according to claim 1, characterized in that The adversarial training operation includes: Input the functional requirement data into the generator to obtain the generated samples; Using the generated samples and the real samples selected from the standard test case sample data as input, using the discriminator to determine whether there is a difference between the generated samples and the real samples; When it is determined that there is no difference between the generated sample and the real sample, the generator is output as a case generation model.
6. The method according to claim 1, characterized in that The adversarial training operation further includes: When it is determined that the generated sample is different from the real sample, an error parameter is generated; Use the error parameter to adjust the generator; Re-obtain the generated samples using the adjusted generator.
7. A test case generation system based on attention mechanism adversarial network, characterized in that: include: The generator management module is used to build and adjust generators; Discriminator management module, used to build the discriminator; Loss function management module, used to configure loss function; A training data management module is used to perform data preprocessing operations based on historical data to obtain functional requirement data and standard test case sample data; A model training module, used to perform adversarial training operations according to the generator and the discriminator using functional requirement data, standard test case sample data, and a loss function to obtain a case generation model; The case generation module is used to perform test case generation operations using the case generation model.
8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
9. An electronic device, characterized in that: including a processor and a memory; The memory is used to store functional requirement data and standard test case sample data; The processor is used to execute the method according to any one of claims 1 to 6 by calling functional requirement data and standard test case sample data.
10. A computer program product comprising a computer program and / or instructions, characterized in that: When the computer program and / or the instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
