Training method of integrated test case model, and test case generation method and system
Through the training method of integrating the test case model, test cases are automatically generated, which solves the problem of time-consuming and quality different caused by the dependence of manual test case generation in the existing technology, and achieves efficient and reliable test case generation.
Patent Information
- Application Number
- CN202411426813.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, the generation of test cases depends on the experience and manual operations of software engineers, which is time-consuming and labor-intensive and vulnerable to personal subjective factors, resulting in different coverage and quality of test cases.
Provide a training method for integrating test case models. By obtaining the correlation information and original test data of the target system, establishing an integrated test case model, generating predictive test data, and executing it in the test environment to obtain test results, update model parameters, and obtain Trained integrated test case model.
It realizes automated generation of integrated test cases, reduces the time and cost of test case generation, improves generation efficiency and test case quality, and ensures comprehensive and reliable testing of the software.
Smart Images

Figure CN119415386A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a training method for an integrated test case model, a test case generation method and a system. Background Art
[0002] At present, with the development of information technology, more and more software applications have been developed and put into various industries for wide application. In the field of software technology, integration testing is often required. Integration testing refers to the process of combining modules that have been unit tested separately and testing them as a whole during the software development process; in the software development process, the generation of test cases is a key step, which ensures that the software product can work as expected.
[0003] In related technologies, traditional test cases usually rely on the experience of software engineers and manual operation generation. Although there are many automated testing tools on the market, they tend to focus on the automation of test execution rather than the automation of test case generation. Many tools still require testers to manually design test cases, which is not only time-consuming and labor-intensive, but also easily affected by personal subjective factors, resulting in inconsistent coverage and quality of test cases.
[0004] In summary, the problems existing in related technologies need to be solved urgently. Summary of the invention
[0005] The purpose of this application is to solve one of the technical problems existing in the related art to at least a certain extent.
[0006] To this end, an object of an embodiment of the present application is to provide a training method, a test case generation method and a system for an integrated test case model.
[0007] In order to achieve the above technical objectives, the technical solutions adopted by the embodiments of the present application include:
[0008] On the one hand, an embodiment of the present application provides a training method for an integrated test case model, the method comprising:
[0009] Acquire relevant information of the target system and existing original test data of the target system;
[0010] According to the association information, establishing an integrated test case model corresponding to the target system;
[0011] Generate predicted test data through the integrated test case model according to the original test data;
[0012] Execute the predicted test data in the test environment corresponding to the target system to obtain a test result corresponding to the predicted test data;
[0013] According to the test result, the training loss value is determined, and the parameters of the integrated test case model are updated based on the loss value to obtain a trained integrated test case model.
[0014] In addition, the training method of the integrated test case model according to the above embodiment of the present application may also have the following additional technical features:
[0015] Furthermore, in one embodiment of the present application, the obtaining of the associated information of the target system includes:
[0016] Obtaining the requirement specification and system design documents of the target system;
[0017] The requirement specification includes functional requirement information and non-functional requirement information of the target system, and the system design document includes at least one of system architecture information, module division information, data flow diagram and component interface information of the target system.
[0018] Further, in one embodiment of the present application, establishing an integrated test case model corresponding to the target system according to the association information includes:
[0019] Determining a corresponding modeling algorithm according to the association information;
[0020] Module definition, interaction modeling and scenario design are performed according to the associated information, and an integrated test case model corresponding to the target system is built based on the modeling algorithm; wherein the module definition is used to identify and determine the type and format of the input and output of each module in the target system, the interaction modeling is used to define the interface of each module and the interaction path between the modules, and the scenario design is used to determine the functional scenarios that need to be simulated.
[0021] Furthermore, in one embodiment of the present application, obtaining the original test data already available in the target system includes:
[0022] Acquire original test data from historical test records, user feedback, and error reports of the target system;
[0023] The original test data is cleaned and formatted.
[0024] Further, in one embodiment of the present application, executing the predicted test data in the test environment corresponding to the target system to obtain a test result corresponding to the predicted test data includes:
[0025] Querying the production environment information corresponding to the target system;
[0026] According to the production environment information, build a test environment corresponding to the target system;
[0027] The predicted test data is executed in a test environment corresponding to the target system to obtain a test result corresponding to the predicted test data.
[0028] On the other hand, an embodiment of the present application provides a test case generation method, the method further comprising:
[0029] Acquire existing original test data of the target system;
[0030] Inputting the original test data into the integrated test case model trained by the aforementioned integrated test case model training method, and generating first test data through the integrated test case model;
[0031] The similarity between the original test data and the first test data is calculated, and redundant test data is removed from the first test data according to the similarity to obtain target test data.
[0032] Furthermore, in one embodiment of the present application, the method further includes:
[0033] Using a mutation technique, generating second test data based on the original test data, and generating third test data based on the first test data;
[0034] The second test data and the third test data are used as new target test data.
[0035] On the other hand, an embodiment of the present application provides a training system for an integrated test case model, the system comprising:
[0036] An acquisition unit, used to acquire the associated information of the target system and the original test data already existing in the target system;
[0037] An establishing unit, used to establish an integrated test case model corresponding to the target system according to the associated information;
[0038] A generating unit, configured to generate predicted test data through the integrated test case model according to the original test data;
[0039] An execution unit, configured to execute the predicted test data in a test environment corresponding to the target system to obtain a test result corresponding to the predicted test data;
[0040] An updating unit is used to determine a training loss value according to the test result, and to update the parameters of the integrated test case model based on the loss value to obtain a trained integrated test case model.
[0041] On the other hand, an embodiment of the present application provides an electronic device, including:
[0042] at least one processor;
[0043] at least one memory for storing at least one program;
[0044] When the at least one program is executed by the at least one processor, the at least one processor is enabled to implement the above method.
[0045] On the other hand, an embodiment of the present application further provides a computer-readable storage medium, which stores a program executable by a processor, and the above-mentioned processor-executable program is used to implement the above-mentioned method when executed by the processor.
[0046] The advantages and benefits of the present application will be partially given in the following description, and partially become apparent from the following description, or be understood through the practice of the present application:
[0047] The training method, test case generation method and system of the integrated test case model disclosed in the embodiment of the present application, the training method obtains the associated information of the target system and the original test data already existing in the target system; according to the associated information, an integrated test case model corresponding to the target system is established; according to the original test data, predictive test data is generated through the integrated test case model; the predictive test data is executed in the test environment corresponding to the target system to obtain the test result corresponding to the predictive test data; according to the test result, the loss value of the training is determined, and the parameters of the integrated test case model are updated based on the loss value to obtain a trained integrated test case model. The present application can make full use of the potential of artificial intelligence to automatically generate integrated test cases, which can reduce the time and cost of test case generation, improve the generation efficiency and the quality of the generated test cases, and thus facilitate the comprehensive and reliable testing of software to help the efficient development of software. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following introduction is made to the drawings of the embodiments of the present application or the related technical solutions in the prior art. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present application. For technical personnel in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0049] Figure 1 A schematic diagram of an implementation environment of a training method for an integrated test case model provided in an embodiment of the present application;
[0050] Figure 2A flowchart of a training method for an integrated test case model provided in an embodiment of the present application;
[0051] Figure 3 A schematic diagram of a process for establishing an integrated test case model provided in an embodiment of the present application;
[0052] Figure 4 A schematic diagram of a process for obtaining original test data provided in an embodiment of the present application;
[0053] Figure 5 A schematic diagram of a process for obtaining a test result provided in an embodiment of the present application;
[0054] Figure 6 A flow chart of a test case generation method provided in an embodiment of the present application;
[0055] Figure 7 A flowchart of another test case generation method provided in an embodiment of the present application;
[0056] Figure 8 A schematic diagram of the structure of a training system for an integrated test case model provided in an embodiment of the present application;
[0057] Fig. 9 A schematic diagram of the structure of a test case generation system provided in an embodiment of the present application;
[0058] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] The present application is further described below in conjunction with the accompanying drawings and specific embodiments. The described embodiments should not be regarded as limiting the present application, and all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0060] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0062] 1) Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making. Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level technology and software-level technology. Basic artificial intelligence technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0063] 2) Machine Learning (ML) is a multi-disciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning (deep learning) usually includes artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0064] 3) Test Case: A test case is a document used in the software testing process that describes in detail the steps, expected results, and any relevant test data for testing a specific function or component.
[0065] At present, with the development of information technology, more and more software applications have been developed and put into various industries for wide application. In the field of software technology, integration testing is often required. Integration testing refers to the process of combining modules that have been unit tested separately and testing them as a whole during the software development process; in the software development process, the generation of test cases is a key step, which ensures that the software product can work as expected.
[0066] In related technologies, traditional test cases usually rely on the experience of software engineers and manual operation generation. Although there are many automated testing tools on the market, they tend to focus on the automation of test execution rather than the automation of test case generation. Many tools still require testers to manually design test cases, which is not only time-consuming and labor-intensive, but also easily affected by personal subjective factors, resulting in inconsistent coverage and quality of test cases.
[0067] In view of this, a training method, a test case generation method and a system for an integrated test case model are provided in an embodiment of the present application, wherein the training method obtains the associated information of the target system and the original test data already existing in the target system; according to the associated information, an integrated test case model corresponding to the target system is established; according to the original test data, predictive test data is generated through the integrated test case model; the predictive test data is executed in the test environment corresponding to the target system to obtain the test result corresponding to the predictive test data; according to the test result, the loss value of the training is determined, and the parameters of the integrated test case model are updated based on the loss value to obtain a trained integrated test case model. The present application can make full use of the potential of artificial intelligence to automatically generate integrated test cases, which can reduce the time and cost of test case generation, improve generation efficiency and the quality of generated test cases, and thus facilitate the realization of comprehensive and reliable testing of software to help efficient software development.
[0068] Please refer to Figure 1 , Figure 1 The schematic diagram of the implementation environment of a training method for an integrated test case model provided in an embodiment of the present application is shown. In the implementation environment, the main hardware and software entities involved include a terminal device 110 and a backend server 120. The terminal device 110 and the backend server 120 are connected in communication.
[0069] Specifically, the training method and test case generation method of the integrated test case model provided in the embodiments of the present application can be executed separately on the terminal device 110 side, or can be executed separately on the background server 120 side, or can be executed based on data interaction between the terminal device 110 and the background server 120, and the present application does not impose any restrictions on this.
[0070] For example, in some embodiments, the training method of the integrated test case model provided by the present application can be executed on the background server 120 side, and the background server 120 side can train the integrated test case model, and then send the trained integrated test case model to the terminal device 110. The training method of the integrated test case model provided by the present application can be executed on the terminal device 110 side, so that more test cases corresponding to the target system can be generated.
[0071] Among them, the terminal device 110 of the above embodiment may include a mobile phone, a computer, a smart wearable device, a PDA device, an intelligent voice interaction device, a vehicle terminal, etc., but is not limited thereto.
[0072] The backend server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0073] The terminal device 110 and the backend server 120 may establish a communication connection via a wireless network or a wired network. The wireless network or wired network uses standard communication technology and / or protocols, and the network may be set to the Internet or any other network, such as but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network.
[0074] Of course, it is understandable that Figure 1 The implementation environment in the embodiment of the present application is only some optional application scenarios of the training method of the integrated test case model provided in the embodiment of the present application. The actual application is not fixed. Figure 1 The hardware and software environment shown.
[0075] Below, in combination with the introduction of the aforementioned implementation environment, a training method for an integrated test case model provided in an embodiment of the present application is introduced and explained.
[0076] Please refer to Figure 2 , Figure 2 : is a schematic diagram of a training method for an integrated test case model provided in an embodiment of the present application, and the training method for the integrated test case model includes but is not limited to:
[0077] Step 210: Obtaining the associated information of the target system and the original test data already existing in the target system;
[0078] Step 220: Establish an integrated test case model corresponding to the target system according to the association information;
[0079] Step 230: Generate predicted test data through the integrated test case model according to the original test data;
[0080] Step 240: execute the predicted test data in the test environment corresponding to the target system to obtain a test result corresponding to the predicted test data;
[0081] Step 250: Determine a training loss value according to the test result, and update the parameters of the integrated test case model based on the loss value to obtain a trained integrated test case model.
[0082] In an embodiment of the present application, a method for training an integrated test case model is provided, which can train an integrated test case model that can generate test cases for software.
[0083] In the embodiment of the present application, when training the integrated test case model, the associated information of the target system and the original test data corresponding to the existing target system can be obtained. Here, the associated information of the target system may include but is not limited to the architecture of the target system, the dependencies between modules, interface definitions, etc. This information can help understand the overall structure and internal operation of the system. In addition to the above-mentioned associated information, the original test data corresponding to the existing target system is also obtained, and these original test data can be used for subsequent model training.
[0084] According to the collected association information, an integrated test case model that matches the target system can be established. Specifically, in the embodiment of the present application, a suitable algorithm or framework (such as a machine learning model, a deep learning network, etc.) can be selected to construct an integrated test case model, and the association information can be converted into basic parameters that can be used for model application, such as call relationships between modules, interface parameters, etc. Then, the integrated test case model corresponding to the target system can be preliminarily constructed based on feature engineering. After obtaining the constructed integrated test case model, the integrated test case model can be used to generate new predicted test data based on the original test data. In the embodiment of the present application, the integrated test case model can be designed to input some original test data, and new test data related to the original test data can be generated and can be used for software function testing. It should be noted that for the constructed integrated test case model, its performance may not meet the expected requirements, and it needs to be trained to improve the availability and comprehensiveness of the test data generated by it, so as to make the generated predicted test data cover various possible test scenarios and boundary conditions as much as possible.
[0085] In the embodiment of the present application, after obtaining the predicted test data, the predicted test data can be executed in the test environment corresponding to the target system to obtain the test results corresponding to the predicted test data. Specifically, in the embodiment of the present application, a test environment similar to the actual production environment can be built to ensure the reliability of the test results. Then run the predicted test data, observe the actual behavior and output of the system, and record the results of each test case (i.e., predicted test data) in detail, including success or failure, error type, etc., to obtain the corresponding test results. Then, according to the test results, the loss value of the training can be determined, and the parameters of the integrated test case model can be updated based on the loss value, so as to obtain the trained integrated test case model. Here, it should be noted that when calculating the loss value, it is necessary to select a suitable loss function to measure the gap between the test result and the expected result. In the embodiment of the present application, the specific type of the loss function is not limited, and it can be flexibly selected according to actual needs. In the embodiment of the present application, based on the loss function and the test results, the loss value of the current training stage can be determined, and the loss value can be used to evaluate the performance of the current integrated test case model. Based on the loss value, the parameters of the model can be optimized by the back propagation algorithm, thereby improving the performance of the model.
[0086] It should be noted that, in the embodiments of the present application, for the training of the integrated test case model, it generally requires multiple iterations. Specifically, the process of generating predicted test data based on the original test data, and then calculating the loss value to update the parameters of the integrated test case model can be repeated until the model reaches the expected accuracy and stability. Here, there are many ways to determine whether the training of the integrated test case model is completed. For example, in some embodiments, the performance of the integrated test case model can be tested on the test set. If the accuracy on the test set is found to be good, the current training can be considered to be completed. In some embodiments, the total rounds of training can also be set in advance. If the number of iterative rounds reaches the set total rounds, the training can be considered to be completed.
[0087] Specifically, in some embodiments, obtaining the associated information of the target system includes:
[0088] Obtaining the requirement specification and system design documents of the target system;
[0089] The requirement specification includes functional requirement information and non-functional requirement information of the target system, and the system design document includes at least one of system architecture information, module division information, data flow diagram and component interface information of the target system.
[0090] In the embodiment of the present application, the purpose of obtaining the associated information of the target system is to perform demand and design analysis, understand the functional and non-functional requirements of the system, and the interaction between modules. Therefore, in the embodiment of the present application, the requirement specification (SRS) and system design document (SSD) of the target system can be obtained. Among them, the requirement specification (SRS) can understand the functional requirement information (such as input, output, business process) and non-functional requirement information (such as performance indicators, security requirements, availability) of the system, and the system design document can help understand the system architecture information, module division information, data flow diagram and component interface information of the target system. In the embodiment of the present application, there is no restriction on the specific content covered by the associated information.
[0091] In the embodiment of the present application, interaction identification and test scope determination can also be performed based on the associated information of the target system. Among them, interaction identification can list all the interfaces for communication between modules, analyze the dependencies between modules, determine which modules interact directly with each other, and confirm how data flows between modules, as well as the data format and transmission protocol, identify possible abnormal situations and corresponding processing mechanisms; test scope determination can sort functions according to the importance of requirements, determine which functions are core functions, evaluate the risk level of each function, identify high-risk areas, formulate different test strategies (smoke test, regression test, performance test) for functions of different levels, set priorities for each test case, and ensure that key functions are fully tested first.
[0092] In some embodiments, reference Figure 3 , establishing an integrated test case model corresponding to the target system according to the association information, including:
[0093] Determining a corresponding modeling algorithm according to the association information;
[0094] Module definition, interaction modeling and scenario design are performed according to the associated information, and an integrated test case model corresponding to the target system is built based on the modeling algorithm; wherein the module definition is used to identify and determine the type and format of the input and output of each module in the target system, the interaction modeling is used to define the interface of each module and the interaction path between the modules, and the scenario design is used to determine the functional scenarios that need to be simulated.
[0095] In the embodiment of the present application, when the integrated test case model corresponding to the target system is established according to the associated information, it can mainly include processes such as model selection, module definition, interactive modeling and scenario design. Specifically, model selection is to determine the modeling algorithm suitable for the target system, such as selecting the most suitable modeling algorithm according to the characteristics (scale, complexity, demand) of the target system. Module definition is used to identify and determine the type and format of input and output of each module in the target system. It can identify all modules based on the requirements specification and system design documents of the target system, determine all input types and formats received by each module, clarify the output type and format generated by each module, and describe the operations that each module should perform after receiving a specific input and the expected output generated. Interaction modeling is used to define the interface of each module and the interaction path between modules, and can define the behavior of the module when an error or abnormal situation occurs. If applicable, a state machine model can also be used to describe the state change of the module. Scenario design is used to determine the functional scenarios that need to be simulated, design reasonable input data for each scenario, define the expected output results, describe the module interaction process under each scenario, consider boundary conditions and abnormal situations, and ensure that the scenario covers various possible situations.
[0096] In some embodiments, reference Figure 4 , obtain the original test data of the target system, including:
[0097] Acquire original test data from historical test records, user feedback, and error reports of the target system;
[0098] The original test data is cleaned and formatted.
[0099] In an embodiment of the present application, when obtaining the original test data already in the target system, first, data can be collected from historical test records, user feedback, and error report sources to obtain the original test data. Then, the original test data can be preprocessed, and the preprocessing here can include data cleaning and data formatting, but is not limited to this. Exemplarily, for example, the original test data can be detected, and in some embodiments, it is determined whether they are valid data and the invalid content is deleted. In some embodiments, the original test data is checked for missing data points. For numerical data, the average, median or mode can be used to fill; for categorical data, the most frequent category can be used to fill, or the row containing missing values can be directly deleted. If there are multiple identical records, one can be selected to be retained as needed. Data formatting can include operations such as format unification and normalization to convert these data into a uniformly set format to facilitate the use of subsequent models. In an embodiment of the present application, the present application can also divide the original test data into a training set, a validation set, and a test set for use in stages during subsequent model training.
[0100] In the present application embodiment, for the integrated test case model, its task type (classification, regression, clustering) can be clarified, a suitable algorithm is selected according to task characteristics, several possible candidate algorithms are listed, and the candidate algorithms are quickly evaluated to narrow the selection range. And it can be initially configured with parameters to determine which hyperparameters have a significant impact on model performance, given a reasonable initial value, select a hyperparameter search strategy (grid search, random search or Bayesian optimization), and iteratively adjust the hyperparameter until a satisfactory performance level is reached. Data set is divided into training set, validation set and test set, the model is initialized according to the selected model and configuration, the model is trained on the training set, and performance is evaluated on the validation set, and the model parameters are adjusted according to the performance on the validation set, if the performance of the model on the validation set is no longer improved, then training is stopped, it is ensured that the test set is not used for training or verification process, the model is run on the test set and performance indicators (accuracy, F1 score) are calculated, and the performance of the model is analyzed, potential deviations or variance problems are identified, and a model performance report is written according to the evaluation result.
[0101] Specifically, in some embodiments, referring to Figure 5 , executing the predicted test data in the test environment corresponding to the target system to obtain a test result corresponding to the predicted test data includes:
[0102] Querying the production environment information corresponding to the target system;
[0103] According to the production environment information, build a test environment corresponding to the target system;
[0104] The predicted test data is executed in a test environment corresponding to the target system to obtain a test result corresponding to the predicted test data.
[0105] In the embodiment of the present application, when testing the predicted test data, the environment can be set up first to ensure that the hardware configuration of the test environment is the same or similar to that of the production environment. For example, the same software version as in the production environment can be installed, including the operating system, database and other dependencies, and the network configuration in the production environment can be copied, including firewall rules and port mappings. After that, the necessary test data is imported to ensure the integrity and consistency of the data, and preliminary functional testing is performed to ensure that the test environment works properly. Then, the generated test cases can be loaded into the test execution tool, and the test cases can be executed in a predetermined order. According to the characteristics of the test cases, automatic or manual testing methods can be selected, and any abnormal situations encountered during the execution process can be recorded. In this way, the effectiveness of the test cases can be evaluated to determine whether the expected goals have been achieved.
[0106] In some embodiments, the test results can be analyzed to find potential problems and room for improvement, and the design of the test cases can be improved, new test cases can be added, and the model can be updated according to the newly discovered problems; the optimized test cases can be put into the test again to form a closed-loop feedback. Specifically, in the embodiments of the present application, the test results can be reviewed to identify where the model performs poorly, the feature set can be adjusted as needed, features can be added, deleted or converted, the algorithm or hyperparameters of the model can be changed, and if applicable, the diversity of the training set can be increased by data enhancement technology, the model can be retrained using an updated data set or parameters, and the test cases can be run again to confirm the improvement effect of the model. In addition, each test case can be integrated into a continuous integration (CI) system to implement automated testing, set up a monitoring mechanism to track the progress of the test, and generate regular reports.
[0107] In the embodiment of the present application, a test case generation method is also provided, referring to Figure 6 , the test case generation method includes but is not limited to:
[0108] Acquire existing original test data of the target system;
[0109] Inputting the original test data into the integrated test case model trained by the aforementioned integrated test case model training method, and generating first test data through the integrated test case model;
[0110] The similarity between the original test data and the first test data is calculated, and redundant test data is removed from the first test data according to the similarity to obtain target test data.
[0111] In the embodiment of the present application, after the trained integrated test case model is obtained, it can be put into use. Specifically, the original test data already in the target system can be obtained, and then the original test data can be input into the trained integrated test case model, and new test data can be generated by the integrated test case model, which is recorded as the first test data in the embodiment of the present application.
[0112] It should be noted that, in the embodiment of the present application, the newly generated first test data may be too close to the existing original test data. Therefore, in order to reduce the redundancy of the test data and improve the practicality of the test data, in the embodiment of the present application, the generated first test data can be screened. Specifically, the similarity between the original test data and the first test data can be calculated, and the redundant test data can be removed from the first test data according to the similarity, so as to obtain the target test data. Here, similarity matching is a technology for retrieving and matching a given item, and its purpose is to find items similar to the given item in the data set.
[0113] In the embodiments of the present application, there is no restriction on the numerical representation of similarity. For example, in some embodiments, a percentage can be used to characterize the size of the similarity, and 100% can be set as the maximum value of the similarity. When the similarity between the first test data and the original test data reaches 100%, it means that the two are completely consistent. When screening the first test data, a similarity threshold can be set, for example, it can be set to 80%. When the similarity between the first test data and the original test data is greater than or 80%, it can be determined that the two are relatively close, and the first test data can be removed. Of course, the embodiment of the present application also does not limit the size of the similarity threshold, and it can be flexibly set according to actual needs.
[0114] Specifically, in some embodiments, referring to Figure 7 The test case generation method in the embodiment of the present application may also include:
[0115] Using a mutation technique, generating second test data based on the original test data, and generating third test data based on the first test data;
[0116] The second test data and the third test data are used as new target test data.
[0117] In the embodiment of the present application, mutation technology can also be used to generate test data. Specifically, mutation technology is a software testing method, which is mainly used to evaluate the effectiveness and coverage of test cases. In the embodiment of the present application, when using mutation technology, the basic data can use the original test data to generate the corresponding second test data, or the first test data can be used to generate the corresponding third test data. Then, the second test data and the third test data can also be used as target test data. Of course, in some embodiments, the second test data and the third test data can also be screened, and the present application does not limit this.
[0118] Reference Figure 8 In an embodiment of the present application, a training system for an integrated test case model is also provided, comprising:
[0119] An acquisition unit 810 is used to acquire the associated information of the target system and the original test data already existing in the target system;
[0120] An establishing unit 820, configured to establish an integrated test case model corresponding to the target system according to the associated information;
[0121] A generating unit 830, configured to generate predicted test data through the integrated test case model according to the original test data;
[0122] An execution unit 840 is used to execute the predicted test data in the test environment corresponding to the target system to obtain a test result corresponding to the predicted test data;
[0123] The updating unit 850 is used to determine the training loss value according to the test result, and update the parameters of the integrated test case model based on the loss value to obtain a trained integrated test case model.
[0124] Reference Fig. 9 In an embodiment of the present application, a test case generation system is also provided, comprising:
[0125] A second acquisition unit 910 is used to acquire the original test data already in the target system;
[0126] An input unit 920, configured to input the original test data into the integrated test case model trained by the aforementioned integrated test case model training method, and generate first test data through the integrated test case model;
[0127] The screening unit 930 is configured to calculate the similarity between the original test data and the first test data, and remove redundant test data from the first test data according to the similarity to obtain target test data.
[0128] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0129] Reference Fig.10 , an embodiment of the present application provides an electronic device, including:
[0130] at least one processor 1010;
[0131] At least one memory 1020, used to store at least one program;
[0132] When at least one program is executed by at least one processor 1010, at least one processor 1010 implements the above-mentioned training method of the integrated test case model or the test case generation method.
[0133] Similarly, the contents of the above method embodiments are all applicable to the electronic device embodiments. The functions specifically implemented by the electronic device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0134] An embodiment of the present application also provides a computer-readable storage medium, which stores a program executable by the processor 1010. When the program executable by the processor 1010 is executed by the processor 1010, it is used to execute the above-mentioned training method or test case generation method of the integrated test case model.
[0135] Similarly, the contents of the above method embodiments are all applicable to the computer-readable storage medium embodiments. The functions specifically implemented by the computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0136] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the application is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part described as a larger operation is performed independently.
[0137] In addition, although the present application is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present application. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional techniques of the engineer. Therefore, those skilled in the art can implement the present application set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present application, which is determined by the full scope of the attached claims and their equivalents.
[0138] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program codes.
[0139] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0140] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0141] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0142] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0143] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.
[0144] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the embodiments. Technical personnel familiar with the field can make various equivalent modifications or substitutions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.
Claims
1. A training method for an integrated test case model, characterized in that: The method comprises: Acquire relevant information of the target system and existing original test data of the target system; According to the association information, establishing an integrated test case model corresponding to the target system; Generate predicted test data through the integrated test case model according to the original test data; Execute the predicted test data in the test environment corresponding to the target system to obtain a test result corresponding to the predicted test data; According to the test result, the training loss value is determined, and the parameters of the integrated test case model are updated based on the loss value to obtain a trained integrated test case model.
2. The training method of an integrated test case model according to claim 1, characterized in that: The obtaining of the associated information of the target system includes: Obtaining the requirement specification and system design documents of the target system; The requirement specification includes functional requirement information and non-functional requirement information of the target system, and the system design document includes at least one of system architecture information, module division information, data flow diagram and component interface information of the target system.
3. The training method of an integrated test case model according to claim 2, characterized in that: The step of establishing an integrated test case model corresponding to the target system according to the associated information includes: Determining a corresponding modeling algorithm according to the association information; Module definition, interaction modeling and scenario design are performed according to the associated information, and an integrated test case model corresponding to the target system is built based on the modeling algorithm; wherein the module definition is used to identify and determine the type and format of the input and output of each module in the target system, the interaction modeling is used to define the interface of each module and the interaction path between the modules, and the scenario design is used to determine the functional scenarios that need to be simulated.
4. The training method of an integrated test case model according to claim 1, characterized in that: Obtain the original test data of the target system, including: Acquire original test data from historical test records, user feedback, and error reports of the target system; The original test data is cleaned and formatted.
5. The training method of an integrated test case model according to claim 1, characterized in that: Executing the predicted test data in the test environment corresponding to the target system to obtain a test result corresponding to the predicted test data includes: Querying the production environment information corresponding to the target system; According to the production environment information, build a test environment corresponding to the target system; The predicted test data is executed in a test environment corresponding to the target system to obtain a test result corresponding to the predicted test data.
6. A test case generation method, characterized in that: The method comprises: Acquire existing original test data of the target system; Inputting the original test data into an integrated test case model trained by the training method of an integrated test case model according to any one of claims 1 to 5, and generating first test data through the integrated test case model; The similarity between the original test data and the first test data is calculated, and redundant test data is removed from the first test data according to the similarity to obtain target test data.
7. A test case generation method according to claim 6, characterized in that: The method further comprises: Using a mutation technique, generating second test data based on the original test data, and generating third test data based on the first test data; The second test data and the third test data are used as new target test data.
8. A training system for an integrated test case model, characterized in that: The system comprises: An acquisition unit, used to acquire the associated information of the target system and the original test data already existing in the target system; An establishing unit, used to establish an integrated test case model corresponding to the target system according to the associated information; A generating unit, configured to generate predicted test data through the integrated test case model according to the original test data; An execution unit, configured to execute the predicted test data in a test environment corresponding to the target system to obtain a test result corresponding to the predicted test data; An updating unit is used to determine a training loss value according to the test result, and to update the parameters of the integrated test case model based on the loss value to obtain a trained integrated test case model.
9. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements a method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to implement a method according to any one of claims 1 to 7 when executed by the processor.