Test case generation method and device, equipment and medium
By using the first and second language models, the mapping relationship between document data and functional structure information, functional structure information and test cases is established, and test cases are automatically generated, which solves the problem of time-consuming and error-prone test cases in the existing technology, and realizes efficient and accurate test case generation.
Patent Information
- Application Number
- CN202411905175.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-15
AI Technical Summary
In the prior art, the generation process of test cases is time-consuming and error-prone, affecting the accuracy and reliability of test cases.
The first and second language models are adopted to train the model through training data, establish the mapping relationship between document data and functional structure information, and the mapping relationship between functional structure information and test cases, thereby automatically generating test cases of the target software.
It improves the generation efficiency and coverage of test cases, improves the accuracy and reliability of test cases, and saves labor costs.
Smart Images

Figure CN119829442A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of software testing technology, and in particular to a method, apparatus, device and medium for generating a test case. Background Art
[0002] A test case is a set of test inputs, execution conditions, and expected effects compiled for a specific purpose to verify whether a specific software requirement is met.
[0003] Currently, test cases are mainly written manually, or selected manually based on a set template, and modified and confirmed manually.
[0004] However, the process of manually generating test cases is not only time-consuming but also error-prone, which directly affects the accuracy and reliability of the test cases. Summary of the invention
[0005] The embodiment of the present application provides a method for generating test cases, which can improve the efficiency of test case generation, the coverage of test cases for functional points, and the accuracy and reliability of test cases.
[0006] Correspondingly, an embodiment of the present application also provides a test case generation device, an electronic device and a machine-readable medium to ensure the implementation and application of the above method.
[0007] In order to solve the above problems, the present application discloses a method for generating a test case, the method comprising:
[0008] According to the first training data, the first large language model is trained so that the first large language model represents the mapping relationship between the document data and the functional structure information; the first training data includes: a document data sample of the preset software, and a functional structure information sample corresponding to the document data sample;
[0009] The second language model is trained according to the second training data so that the second language model represents the mapping relationship between the functional structure information and the test case; the second training data includes: a functional structure information sample of the preset software, and a test case sample corresponding to the functional structure information sample;
[0010] Inputting document data of the target software into the first language model, and outputting target functional structure information corresponding to the target software by the first language model;
[0011] The target functional structure information corresponding to the target software is input into the second largest language model, and the second largest language model outputs the first target test case corresponding to the target software.
[0012] The present application also discloses a test case generation device, the device comprising:
[0013] A first training module is used to train a first large language model according to first training data, so that the first large language model represents a mapping relationship between document data and functional structure information; the first training data includes: document data samples of preset software, and functional structure information samples corresponding to the document data samples;
[0014] A second training module is used to train a second language model according to second training data, so that the second language model represents the mapping relationship between the functional structure information and the test case; the second training data includes: a functional structure information sample of the preset software, and a test case sample corresponding to the functional structure information sample;
[0015] A function structure extraction module, used for inputting document data of the target software into the first language model, and outputting target function structure information corresponding to the target software by the first language model;
[0016] The use case generation module is used to input the target functional structure information corresponding to the target software into the second largest language model, and the second largest language model outputs the first target test case corresponding to the target software.
[0017] Optionally, the functional structure information includes: functional points, and association relationships between functional points.
[0018] Optionally, the association relationship between the function points includes: definition usage relationship, generation usage relationship, call relationship, conditional dependency relationship, data flow relationship and exception handling relationship.
[0019] Optionally, the use case generation module includes:
[0020] A format conversion module, used to convert the target functional structure information into a preset format; the preset format is a format that can be recognized by the second largest language model;
[0021] The first input module is used to input the target functional structure information in a preset format into the second language model.
[0022] Optionally, the device further comprises:
[0023] A diagram generation module, used for generating a functional structure diagram of the target software according to the target functional structure information;
[0024] A display module is used to display the functional structure diagram.
[0025] Optionally, the device further comprises:
[0026] An updating module, used for updating the functional structure diagram according to the adjustment instruction to obtain an updated functional structure diagram;
[0027] The second input module is used to input the updated functional structure diagram information into the second largest language model, and the second largest language model outputs a second target test case corresponding to the target software.
[0028] Optionally, the device further comprises:
[0029] A prompt input module, used to input the prompt text of the test case into the second language model;
[0030] The prompt text includes: element information of the test case, description information of the target software, and summary information of the target functional structure information.
[0031] The embodiment of the present application further discloses an electronic device, including: a processor; and a memory, on which executable code is stored. When the executable code is executed, the processor executes the method described in the embodiment of the present application.
[0032] The embodiment of the present application further discloses a machine-readable medium on which executable code is stored. When the executable code is executed, a processor executes the method described in the embodiment of the present application.
[0033] The embodiments of the present application include the following advantages:
[0034] In the technical solution of the embodiment of the present application, a first target test case corresponding to the target software is automatically generated using a first large language model and a second large language model.
[0035] Among them, the first large language model is obtained through training with the first training data. After training with the first training data, the first large language model has the ability to extract functional structure information of the software; therefore, it can extract document data of the target software to obtain the target functional structure information corresponding to the target software.
[0036] The second largest language model is obtained by training with the second training data. After training with the second training data, the second largest language model has the ability to generate accurate test cases based on the functional structure information of the software; therefore, it can generate test cases according to the target functional structure information corresponding to the target software to obtain the first target test cases corresponding to the target software.
[0037] On the one hand, since the embodiment of the present application utilizes the first language model and the second language model to automatically generate the first target test case corresponding to the target software, the embodiment of the present application can save the manpower cost consumed in the generation of test cases and can improve the efficiency of test case generation.
[0038] On the other hand, since the second largest language model can deeply understand the functional points in the functional structure information and the correlation between the functional points, the embodiment of the present application can improve the accuracy and reliability of the test case. Specifically, each software has a unique functional architecture. The second largest language model of the embodiment of the present application deeply analyzes the functional points in the functional structure information and their mutual correlation, and customizes the generation of the first test case that is highly adapted to the target software, which can improve the coverage of the test case for the functional points, and can improve the accuracy and reliability of the test case. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a flowchart of a method for generating a test case according to an embodiment of the present application;
[0040] Figure 2 It is a flowchart of a method for generating a test case according to an embodiment of the present application;
[0041] Figure 3 It is a flowchart of a method for generating a test case according to an embodiment of the present application;
[0042] Figure 4 It is a structural diagram of a functional structure diagram of FTP software in one embodiment of the present application;
[0043] Figure 5 It is a structural schematic diagram of a test case generation device of an embodiment of the present application;
[0044] Figure 6 It is a schematic diagram of the structure of a device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0046] The test case generation method of the embodiment of the present application can be used to automatically generate test cases for software to improve the test case generation efficiency, the accuracy and reliability of the test efficiency.
[0047] The embodiments of the present application can be applied to software testing scenarios in many industries such as industrial industry, office industry, and financial industry.
[0048] In industrial scenarios, the test cases for industrial software generated according to the embodiments of the present application can accurately simulate complex conditions such as equipment failures and process deviations, which is of great significance for early detection of software risks and ensuring stable and efficient operation of production lines. It can meet the stringent scenario requirements of industrial production and effectively protect the smooth development of industrial processes.
[0049] In view of the technical problem that manually generating test cases in related technologies is time-consuming, labor-intensive and error-prone, an embodiment of the present application provides a method for generating test cases, which specifically includes the following steps:
[0050] The first language model is trained according to the first training data, so that the first language model represents the mapping relationship between the document data and the functional structure information; the first training data specifically includes: a document data sample of the preset software, and a functional structure information sample corresponding to the document data sample;
[0051] The second language model is trained according to the second training data, so that the second language model represents the mapping relationship between the functional structure information and the test case; the second training data specifically includes: functional structure information samples of the preset software, and test case samples corresponding to the functional structure information samples;
[0052] Inputting document data of the target software into the first language model, and outputting target functional structure information corresponding to the target software by the first language model;
[0053] The target functional structure information corresponding to the target software is input into the second largest language model, and the second largest language model outputs the first target test case corresponding to the target software.
[0054] The embodiment of the present application utilizes the first largest language model and the second largest language model to automatically generate a first target test case corresponding to the target software.
[0055] Among them, the first large language model is obtained through training with the first training data. After training with the first training data, the first large language model has the ability to extract functional structure information of the software; therefore, it can extract document data of the target software to obtain the target functional structure information corresponding to the target software.
[0056] The second largest language model is obtained by training with the second training data. After training with the second training data, the second largest language model has the ability to generate accurate test cases based on the functional structure information of the software; therefore, it can generate test cases according to the target functional structure information corresponding to the target software to obtain the first target test cases corresponding to the target software.
[0057] On the one hand, since the embodiment of the present application utilizes the first language model and the second language model to automatically generate the first target test case corresponding to the target software, the embodiment of the present application can save the manpower cost consumed in the generation of test cases and can improve the efficiency of test case generation.
[0058] On the other hand, since the second largest language model can deeply understand the functional points in the functional structure information and the correlation between the functional points, the embodiment of the present application can improve the accuracy and reliability of the test case. Specifically, each software has a unique functional architecture. The second largest language model of the embodiment of the present application deeply analyzes the functional points in the functional structure information and their mutual correlation, and customizes the generation of the first test case that is highly adapted to the target software, which can improve the coverage of the test case for the functional points, and can improve the accuracy and reliability of the test case.
[0059] Taking industrial software as an example, there are complex and close associations and strict execution order between its function points. For example, the function points of a product processing software include: starting processing, geometric view, setting coordinate system, setting safety distance (safety plane), setting blank geometry, inserting process, adding tool, tool path setting, modifying cutting parameters (number of times of retraction), setting feed and speed, 3D animation demonstration, etc., and the execution order is: starting processing → geometric view → setting coordinate system. The second largest language model of the embodiment of the present application will be based on the in-depth understanding of the functional structure information, and will fully consider the characteristics of each function point and the execution order between them in the generation process of the test case. Specifically, the design of the test case will be closely around these function points and their execution order. For example, the use case of the initial state check will be designed for the "start processing" operation, and the connection with the start processing will be considered in the test case related to the "geometric view". In the test case of "setting the coordinate system", the association logic with the geometric view will be checked to be correct. In this way, not only can all the function points of the product processing software be covered, but also the execution order between the function points can be accurately captured.
[0060] Method Example 1
[0061] refer to Figure 1 , shows a schematic flow chart of the steps of a method for generating a test case according to an embodiment of the present application, the method specifically comprises the following steps:
[0062] Step 101: training a first language model according to first training data, so that the first language model represents a mapping relationship between document data and functional structure information; the first training data specifically includes: document data samples of preset software, and functional structure information samples corresponding to the document data samples;
[0063] Step 102: training the second largest language model according to the second training data, so that the second largest language model represents the mapping relationship between the functional structure information and the test case; the second training data specifically includes: functional structure information samples of the preset software, and test case samples corresponding to the functional structure information samples;
[0064] Step 103: input the document data of the target software into the first language model, and the first language model outputs the target functional structure information corresponding to the target software;
[0065] Step 104: input the target functional structure information corresponding to the target software into the second largest language model, and the second largest language model outputs the first target test case corresponding to the target software.
[0066] Figure 1 The steps included in the method embodiment shown can be executed by the client and / or the server. It can be understood that the embodiment of the present application is for Figure 1 The specific execution subject of the illustrated method embodiment is not limited.
[0067] In the embodiment of the present application, the large language model is an artificial intelligence model designed to understand and generate human language. The large language model can perform a wide range of tasks by training on a large amount of text data. Specifically in the embodiment of the present application, the first large language model is used to perform the task of generating functional structure information, and the second large language model is used to perform the task of generating test cases.
[0068] Large language models are usually based on deep learning architectures, such as transformer structures. The embodiments of the present application do not limit the specific types of large language models. For example, the types of large language models may include: GPT (Generative Pre-Trained Transformer) model and Llama model. Among them, the Llama model is a large language model released by Meta.
[0069] For example, the GPT model is a large-scale natural language generation model based on the Transformer structure, which uses massive text data for pre-training and can generate high-quality natural language text, including articles, conversations, summaries, etc. The core of the GPT model is the converter structure, which uses an attention mechanism to enable the GPT model to consider all positions in the input sequence at the same time, thereby better capturing long-distance dependencies. After the GPT model is pre-trained, it can be fine-tuned to adapt to various downstream text generation tasks. Specific to the embodiment of the present application, the downstream text generation tasks specifically include: the generation task of functional structure information performed by the first large language model, and the generation task of test cases performed by the second large language model.
[0070] In the pre-training stage, the GPT model uses the training method of the autoregressive language model to generate only one output at each time step, and the subsequent time steps generate the next output based on the previous input and output.
[0071] In step 101, the training of the first language model may be fine-tuning training. Since the first language model has been pre-trained on large-scale general text data in the early stage and has a strong natural language processing capability and basic characteristics of text semantic understanding and information induction and extraction, on this basis, with the help of fine-tuning training of the first training data, the model parameters can be adjusted in a targeted manner according to the document data samples of specific preset software and their corresponding functional structure information samples, so as to accurately construct the mapping relationship between the document data and the functional structure information, and lay a solid foundation for the subsequent efficient extraction of the target functional structure information from the target software document data.
[0072] Fine-tuning is the process of adjusting the parameters of a large language model to adapt it to a specific task by training the model on a dataset related to that specific task. The degree of fine-tuning required will be affected by the complexity of the task and the size of the dataset.
[0073] Fine-tuning methods may include: full fine-tuning or partial fine-tuning. Among them, full fine-tuning is used to adjust all model parameters, which can make all-round adjustments to the model so that the model can deeply adapt to the detailed requirements of a specific task, so that in scenarios where the task and the pre-trained model are very different or the task requires high flexibility of the model, it can achieve very good performance and accurately complete the task. Partial fine-tuning is used to adjust some model parameters. During the fine-tuning process, the general knowledge that the pre-trained model has learned can be well preserved, so that the task can be adapted to by adjusting a small amount of parameters based on the use of existing knowledge. The computing resources and time required for partial fine-tuning are relatively small, and the efficiency is high. It can be understood that the embodiments of the present application do not limit the specific fine-tuning method.
[0074] Preset software can refer to any type of software. The document data samples of preset software cover the textual description of software functional characteristics, business logic architecture, operation process steps and many other aspects, and its presentation form is relatively primitive and complicated and disordered. In contrast, the functional structure information sample is a structured presentation form of the various functional points of the software and the interrelationships between the functional points after the software is disassembled, analyzed, sorted and integrated from the functional dimension. By using a large number of these two types of sample data of preset software, namely document data samples and their corresponding functional structure information samples, the first language model is trained, with the aim of enabling the first language model to understand the internal rules of mining the corresponding functional structure information from document data of various expressions and different levels of complexity.
[0075] During the data preparation stage, the embodiments of the present application can collect a large number of document data samples of preset software and functional structure information samples that precisely correspond to them. These samples can cover software of different types, scales, and application scenarios, so as to improve the diversity and comprehensiveness of the first training data, so that the first language model can learn the association rules between documents and functional structure information in various situations.
[0076] In a specific implementation, the types of document data samples may specifically include: user manuals of preset software, API (Application Programming Interface) documents, design specifications, requirement documents, etc. It is understood that the embodiments of the present application do not limit the specific types of document data samples.
[0077] The embodiment of the present application may also pre-process these document data samples, including text cleaning, removal of irrelevant information, formatting, etc., to improve the quality and consistency of the first training data.
[0078] In the model training phase, the prepared document data samples can be used as input information, and the corresponding functional structure information samples can be used as the expected output results (i.e., label information) to be input into the first language model. The first language model starts learning based on its internal deep learning architecture. During the training process, the model parameters of the first language model will be continuously adjusted. For example, by calculating the difference between the output of the first language model and the label information (usually using a loss function to measure this difference), and then using an optimization algorithm (such as stochastic gradient descent, etc.) to update the model parameters based on the difference, the first language model gradually reduces this difference.
[0079] During the training process, a portion of the reserved verification data (also document data samples and corresponding functional structure information samples) can be used to evaluate the effectiveness of the first language model. Observe how the first language model processes these verification data to see whether the functional structure information it outputs is accurate and complete. If it is found that the first language model performs poorly on certain types of samples or certain functional structure features, more related types of first training data can be added to continue training, and the first language model can be continuously iterated and optimized until the first language model can generate the corresponding functional structure information based on the input document data in a relatively stable and accurate manner, which means that the mapping relationship between the document data and the functional structure information has been successfully established.
[0080] In step 102, the training of the second language model may be fine-tuning training. Since the large language model has been pre-trained with large-scale general text data in the early stage and has strong natural language processing capabilities and basic characteristics of text semantic understanding and information induction and extraction, on this basis, with the help of fine-tuning training of the second training data, the model parameters of the second language model are adjusted in a targeted manner according to the functional structure information samples of specific preset software and their corresponding test case samples, and then the mapping relationship between the functional structure information and the test case is accurately constructed, laying a solid foundation for the subsequent generation of corresponding test cases according to the functional structure information of the target software.
[0081] During the data preparation stage, the embodiments of the present application can collect a large number of functional structure information samples of preset software and test case samples that precisely correspond to them. These samples should cover software of different types, scales, and application scenarios, thereby improving the diversity and comprehensiveness of the second training data, so that the second largest language model can learn the association rules between functional structure information and test cases in various situations.
[0082] In the model training phase, the prepared functional structure information samples can be used as input information, and the corresponding test case samples can be used as the expected output results (i.e., label information) and input into the second largest language model. The second largest language model starts learning based on its internal deep learning architecture. During the training process, the model parameters of the second largest language model will be continuously adjusted. For example, by calculating the difference between the output of the second largest language model and the label information (usually using a loss function to measure this difference), and then using an optimization algorithm (such as stochastic gradient descent, etc.) to update the model parameters based on the difference, the second largest language model gradually reduces this difference.
[0083] During the training process, it is also necessary to use a portion of the reserved verification data (also functional structure information samples and corresponding test case samples) to evaluate the effectiveness of the second largest language model. Based on the processing of these verification data by the second largest language model, it is judged whether the test cases output by the second largest language model are accurate, complete and meet actual needs. If it is found that the second largest language model performs poorly on certain types of samples or certain functional structures and corresponding features of test cases, more related types of second training data can be added to continue training, and the second largest language model can be continuously iterated and optimized until the second largest language model can generate corresponding test cases based on the input functional structure information in a relatively stable and accurate manner, which means that the mapping relationship between functional structure information and test cases has been successfully established.
[0084] Through the above steps, the second largest language model completes training in step 102 and has the ability to generate corresponding test cases based on the functional structure information of the target software, providing a strong guarantee for the smooth progress of the entire test case generation process.
[0085] Due to the training process of the first language model, the first language model learns and masters the mapping rules from document data to functional structure information, and it can understand the meaning of the functional structure level corresponding to different text expression forms, logical relationships, etc. in the document data; therefore, in step 103, when the document data of the target software is input into the first language model, the first language model can analyze the various text expression forms and complex logical relationships in the document data of the target software, and then output the target functional structure information that matches the document data of the target software based on this mapping relationship, thereby providing a key functional structure level basis for subsequent generation of test cases and other links.
[0086] In actual applications, the document data of the target software can be obtained. These document data may come from various text materials related to the target software, such as the user manual, API document, design specification, requirement document, etc. of the target software.
[0087] The embodiment of the present application can input the document data of the target software into the first language model that has been trained. Each network layer in the first language model will perform operations such as feature extraction and semantic analysis on the document data in turn, and calculate the input document data through the model parameters learned in the training stage, and gradually extract the information related to the functional structure contained in the document data. This process is carried out according to the mapping relationship between the document data and the functional structure information that has been established.
[0088] After a series of calculations and processing within the model, the first language model finally outputs the target function structure information corresponding to the target software. The output target function structure information is usually presented in a structured form, clearly showing the various function points contained in the target software and the relationship between the function points, etc. For example, a tree structure, a chart, or a text list in a specific format can be used to represent the function point hierarchy, function call relationship and other information of the target software, providing a key input basis for the subsequent step 104 to generate test cases for the target software. Of course, the embodiment of the present application does not limit the specific form of the target function structure information.
[0089] The embodiment of the present application does not limit the specific functional structure information. For example, the functional structure information specifically includes: functional points and the association relationship between functional points.
[0090] Among them, function points are independent units in the software system that can complete specific tasks or operations. It is a decomposition description of software functions from the user's perspective or business logic perspective. Function points are the basic components of software functions. For users, function points directly correspond to the specific operations they use software to complete various tasks. From the perspective of software design and development, function points are the basis for clarifying software function requirements and dividing function points, which helps the development team decompose complex software functions into manageable and achievable units, facilitating development, testing and maintenance.
[0091] The association relationship between function points describes the way different function points interact, depend on each other, or call each other. This relationship can be sequential (one function point can be started only after another function point is completed), hierarchical (one function point is a sub-function of another function point), parallel (multiple function points can run at the same time), and other forms. The association relationship between function points reflects the business process and system architecture of the software. It can help users better understand the overall working method of the software and also provide important clues for the development and testing of the software. During the development process, understanding the association relationship helps to design a reasonable system architecture and interface to ensure effective collaboration between function points. In the testing phase, the association relationship can guide the design of test cases, such as checking whether the software meets business requirements and discovering possible functional defects by testing the interaction between function points.
[0092] In a specific implementation, the association relationship between the above-mentioned function points may further include: defining a usage relationship, generating a usage relationship, a calling relationship, a conditional dependency relationship, a data flow relationship and an exception handling relationship.
[0093] Define usage relationships: Indicate how a function point is defined and used by other function points. For example, in software, a function point may define a set of data structures that are then used by other function points. Defining usage relationships helps identify dependencies between function points so that basic functions can be fully tested during testing.
[0094] Generate-use relationship: When a function point creates certain objects or data, which are then used by other function points, a generate-use relationship is formed. For example, a user registration function point may generate user information, which is then used by a user login function point to verify the user's identity.
[0095] Call relationship: A function point directly calls another function point to form a call relationship. Call relationships are very common in software. For example, a user interface function point may call a backend service function point to process data requests. Call relationships help understand the interaction process between function points and simulate real user operation paths during testing.
[0096] Conditional dependencies: The first function point may depend on certain conditions or states, which are set by the second function point. For example, a function may only be executed after the user is logged in, which forms a conditional dependency.
[0097] Data flow relationship: Function points interact with each other through data exchange, forming a data flow relationship. The data flow relationship emphasizes the flow path of data between different function points, which is crucial for understanding the data integrity and consistency of the software.
[0098] Exception handling relationships: When a function point encounters an error or an exception during execution, it may need to call another function point to handle these exceptions. Exception handling relationships help improve the robustness of the software so that it can run normally even in the face of incorrect input or unexpected situations.
[0099] The above association relationships can more accurately reflect the functional structure of the software and provide a solid foundation for generating high-quality test cases.
[0100] After the training process in step 102, the second language model learns and masters the mapping relationship from functional structure information to test cases. The second language model can understand the test case generation logic corresponding to different functional structure characteristics, combinations of functional points, and associations between functional points, and knows what kind of functional structure should be verified with what specific test case.
[0101] In this way, after receiving the target functional structure information corresponding to the target software, the second language model can conduct an in-depth analysis of the input target functional structure information based on the learned mapping relationship, and mine the key elements involved therein, such as the functional details and interaction conditions, and then infer the test case content suitable for detecting whether the functional structure is operating normally, and finally generate the corresponding test case text description.
[0102] In practical applications, first, the target function structure information corresponding to the target software outputted in step 103 is obtained. The target function structure information is usually content that has been refined by the first language model and presents structured characteristics, clearly showing the various function points included in the target software and the relationship between them, etc., such as in the form of a chart, a tree structure or formatted text, etc., providing a clear input data basis for the second language model.
[0103] In practical applications, the target function structure information can be directly input into the second largest language model. Alternatively, the target function structure information can be first converted into a preset format, which is a format that can be recognized by the second largest language model; then, the target function structure information in the preset format is input into the second largest language model.
[0104] An example of the preset format may be JSONL (JSON Lines, JavaScript Object Notation Lines) format. JSONL format is a text format in which each line is a legal JSON (JavaScript Object Notation) value, which is easy to parse and process and suitable as a format for inputting structured data to the second largest language model, so the target functional structure information may be first converted into the JSONL format.
[0105] It should be noted that, in addition to inputting the target functional structure information into the second largest language model, the prompt text of the test case may also be input into the second largest language model.
[0106] The prompt text specifically includes: element information of the test case, description information of the target software such as the name of the target software, and summary information of the target functional structure information of the target software, etc. Among them, the element information of the test case can guide the second language model to systematically generate test cases; the description information of the target software can help the second language model locate software features and optimize test cases in a targeted manner; the summary information of the target functional structure can allow the second language model to grasp the test scope from a macro perspective and identify functional dependencies.
[0107] In one example, the element information of the test case specifically includes: case number, function point, case title, priority, precondition, test steps, etc. Of course, the embodiment of the present application does not limit the specific element information of the test case.
[0108] Here is an example of input information in a preset format provided to the second language model. The row of the input information may include: a role field and an information field, wherein the field content of the role field is an auxiliary role; the field content of the information field may include: a prompt text, a name of a function point, and an association relationship between function points. The input information in the preset format may be as follows:
[0109] {
[0110] {"Role field":"Assistant role",
[0111] "Information field": "General test case elements include case number, function point, case title, priority, precondition, test steps"}
[0112] {"Role field":"Assistant role",
[0113] "Information field": "Description of the target software"}
[0114] {"Role field":"Assistant role",
[0115] "Information field": "The associations between function points include definition use, generation use, call, conditional dependency, data flow and exception handling"}
[0116] {"Role field":"Assistant role",
[0117] "Information field": "Menu-Processing function-Start processing"}
[0118] {"Role field":"Assistant role",
[0119] "Information field": "Menu-Processing function-Geometry view"}
[0120] {"Role field":"Assistant role",
[0121] "Information field": "Menu-Processing function-Set coordinate system"}
[0122] {"Role field":"Assistant role",
[0123] "Information field": "Processing function - Set safety distance (safety plane)"}
[0124] {"Role field":"Assistant role",
[0125] "Information field": "Test application menu - processing function - set blank geometry"}
[0126] {"Role field":"Assistant role",
[0127] "Information field": "Test application menu-processing function-insert operation"}
[0128] {"Role field":"Assistant role",
[0129] "Information field": "Test application menu - processing function - add tool"}
[0130] {"Role field":"Assistant role",
[0131] "Information field": "Test application menu - processing function - tool path setting"}
[0132] {"Role field":"Assistant role",
[0133] "Information field": "Test application menu - processing function - modify cutting parameters (number of retractions)"}
[0134] {"Role field":"Assistant role",
[0135] "Information field": "Test application menu - processing function - set feed and speed"}
[0136] {"Role field":"Assistant role",
[0137] "Information field": "Test application menu - processing function - 3D animation demonstration"}
[0138] {"Role field":"Assistant role",
[0139] "Information field": "Relationship between processing function points: Start processing → Geometry view (data flow relationship); Geometry view → Set coordinate system (data flow relationship)"}
[0140] }
[0141] After the target functional structure information is input into the second largest language model that has completed training, the second largest language model will identify and analyze each functional point in the functional structure information and their mutual relationships. Based on the mapping relationship from functional structure information to test cases learned in the training phase and its own logical reasoning ability, the second largest language model will sort out the aspects that need to be verified for each functional point and the overall functional structure, such as whether the function can be started normally and whether there are any abnormalities when different functional points interact.
[0142] After complex calculations and reasoning processes within the model, the second language model will eventually output the first target test case corresponding to the target software. The output first target test case is usually presented in text form, which will describe in detail the test steps, expected results, and specific functional points or functional interactions targeted, so as to facilitate the subsequent use of these test cases to carry out actual testing of the target software to check whether the software meets the expected functional requirements and whether there are any functional defects.
[0143] The test cases generated by the embodiments of the present application need to be verified so that the test cases not only cover the key functions of the software, but also conform to the actual application scenarios and can simulate the operation paths of real users.
[0144] It should be noted that the second largest language model can take into account abnormal situations and edge cases during the generation of test cases, thereby improving the stability and reliability of the target software.
[0145] Among them, abnormal situations refer to situations where the software does not run in accordance with normal expected conditions, such as input data out of range, external device failure, etc.; edge cases are special situations at the functional boundary, such as an empty list, etc.
[0146] The embodiment of the present application can collect and organize descriptions of abnormal situations that have occurred in various preset software (such as input data exceeding the normal range, abnormal performance of software caused by external device failure, etc.) as part of the functional structure information sample, and at the same time compile corresponding test case samples for these abnormal situations, and expect the software to make reasonable responses, and include them in the second training data. In this way, the second language model can learn the mapping relationship between the functional structure information in abnormal scenarios and the corresponding test cases during training, and then when the test cases are output for the target software in the future, the relevant content of abnormal situation detection can also be included.
[0147] The embodiment of the present application can also convert the first target test case into a test script and execute the test script. Specifically, according to the characteristics of the test script language, each element in the test case is converted into executable code logic. The executable code logic can be used as a component of the test script.
[0148] In one example, it is assumed that the element information of the test case specifically includes: case number, function point, case title, priority, precondition, test steps, etc. Then the case number can be converted into the comment content at the beginning of the test script, and by adding a comment statement such as "#case number: [specific number]", the attribution of this script section can be clearly marked, which is convenient for subsequent management and tracing.
[0149] According to the detailed description of the function point, use the syntax characteristics and function functions of the scripting language to build the code module that implements the corresponding function point. For example, if the function point is login verification, the corresponding code block needs to accurately simulate the user login process, covering a series of operations such as obtaining user name and password input, initiating verification requests to the server, and rigorously judging the returned results, so as to fully and accurately reproduce the login and verification logic.
[0150] For priority, you can combine it with the rules of the selected automated testing framework. Most automated testing frameworks allow you to set specific attributes, mark or adjust the arrangement of code modules in the framework structure, so that high-priority test scripts are executed first, efficiently utilize test resources, and quickly locate key problems.
[0151] For preconditions, analyze the requirements of the preconditions and then write code in a scripting language to meet the preconditions.
[0152] For the test steps, you can follow the order of the test steps, call various functions and methods adapted by the script language, convert the operations of each test step into executable code statements, and connect them in sequence. Finally, you can build a smooth and complete test process code system, which fully covers the preset operation paths of the test cases and effectively drives the test execution.
[0153] The embodiment of the present application can automatically execute the test script under predetermined conditions, and can also monitor the execution process of the test script, collect and analyze the test results, and provide real-time feedback on abnormal conditions or failure information contained in the test results.
[0154] Predetermined conditions can be time-related, event-related, or data-related. For example, online gaming software executes test scripts at 3 a.m. after weekly maintenance and updates. Another example is that after each cross-border transaction, an e-commerce platform triggers a related test script to troubleshoot abnormalities in key transaction links. Another example is that when a financial data analysis platform reaches 100 million daily transaction flows, a performance test script is automatically started.
[0155] After the test script is executed, the embodiment of the present application collects the test results and generates a corresponding test report. These test reports can help the development team quickly identify the problem and provide a strong basis and reference for subsequent software repair and performance optimization.
[0156] In summary, the test case generation method of the embodiment of the present application uses the first largest language model and the second largest language model to automatically generate a first target test case corresponding to the target software.
[0157] Among them, the first large language model is obtained through training with the first training data. After training with the first training data, the first large language model has the ability to extract functional structure information of the software; therefore, it can extract document data of the target software to obtain the target functional structure information corresponding to the target software.
[0158] The second largest language model is obtained by training with the second training data. After training with the second training data, the second largest language model has the ability to generate accurate test cases based on the functional structure information of the software; therefore, it can generate test cases according to the target functional structure information corresponding to the target software to obtain the first target test cases corresponding to the target software.
[0159] On the one hand, since the embodiment of the present application utilizes the first language model and the second language model to automatically generate the first target test case corresponding to the target software, the embodiment of the present application can save the manpower cost consumed in the generation of test cases and can improve the efficiency of test case generation.
[0160] On the other hand, since the second largest language model can deeply understand the functional points in the functional structure information and the correlation between the functional points, the embodiment of the present application can improve the accuracy and reliability of the test case. Specifically, each software has a unique functional architecture. The second largest language model of the embodiment of the present application deeply analyzes the functional points in the functional structure information and their mutual correlation, and customizes the generation of the first test case that is highly adapted to the target software, which can improve the coverage of the test case for the functional points, and can improve the accuracy and reliability of the test case.
[0161] Therefore, the embodiment of the present application provides an automated and intelligent test case generation method, which can not only improve the efficiency and quality of testing, but also adapt to the development model of rapid software iteration and continuous integration, and ultimately enhance the market competitiveness and user satisfaction of software products.
[0162] Method Example 2
[0163] refer to Figure 2 , shows a schematic flow chart of the steps of a method for generating a test case according to an embodiment of the present application, the method specifically comprises the following steps:
[0164] Step 201: training a first language model according to first training data, so that the first language model represents the mapping relationship between document data and functional structure information; the first training data specifically includes: document data samples of preset software, and functional structure information samples corresponding to the document data samples;
[0165] Step 202: training the second largest language model according to the second training data, so that the second largest language model represents the mapping relationship between the functional structure information and the test case; the second training data specifically includes: functional structure information samples of the preset software, and test case samples corresponding to the functional structure information samples;
[0166] Step 203: input the document data of the target software into the first language model, and the first language model outputs the target functional structure information corresponding to the target software;
[0167] Step 204: input the target function structure information corresponding to the target software into the second largest language model, and the second largest language model outputs the first target test case corresponding to the target software;
[0168] Relative to Figure 1 The method embodiment shown, the method of this embodiment may also include:
[0169] Step 205: Generate a functional structure diagram of the target software according to the target functional structure information;
[0170] Step 206: display the above functional structure diagram.
[0171] For various users (including developers, testers, product managers, etc.) involved in different stages of software development, testing, and subsequent maintenance, it is difficult to grasp the software architecture only by relying on functional structure information in text form. Steps 205 and 206 convert the functional structure information into a visual functional structure diagram and display it, which can enable users to more quickly, comprehensively and deeply understand the various functional points of the target software and the relationship between the functional points, thereby enabling users to grasp the software architecture at a macro level.
[0172] The intuitive functional structure diagram makes it easy for relevant users to conduct a detailed analysis of the software architecture, from which they can find potential problems such as whether the functional point division is reasonable, whether the dependencies between modules are too complex or there are unreasonable circular dependencies. Based on these findings, optimization decisions can be made in a timely manner, and the functional architecture can be adjusted and improved during the software development phase, or test cases can be designed more specifically during the testing phase to ensure the quality, stability, future scalability and maintainability of the software.
[0173] In one example, the process of generating a functional structure diagram of target software according to target functional structure information specifically includes:
[0174] Step B1, converting the target function structure information into a data structure in a first format; the first format may be a JSON format;
[0175] Step B2, selecting a graphics drawing tool and a layout algorithm according to the data structure in the first format;
[0176] If the number of function points in the data structure of the first format is small and the association relationship is relatively simple and the hierarchy is clear, you can choose to use a convenient graphic drawing tool that can quickly build a basic graphic structure, and use a hierarchical layout algorithm to intuitively present the hierarchical relationship of the function points. If the number of function points in the data structure of the first format is large and the associations between the function points are crisscrossed, you tend to choose a powerful graphic drawing tool that can deeply customize the graphic details, and cooperate with the force-directed layout algorithm to simulate the effect of physical forces to make the nodes and lines achieve a relatively clear and beautiful layout effect under complex relationships.
[0177] Step B3: Construct the framework of the functional structure diagram.
[0178] Using the selected graphic drawing tool, a framework of the functional structure diagram is constructed according to the data structure in the first format.
[0179] First, create nodes representing each function point, and set the shape, size, color and other visual attributes of the node according to the importance and type of the function point, so as to distinguish and highlight the characteristics of different modules. Then, according to the relationship between the function points, draw lines between the corresponding nodes. The style of the line (such as solid line, dotted line) and the direction of the arrow are set according to the nature of the relationship (such as data flow, dependency), so as to preliminarily build the overall framework of the functional structure diagram and show the general form of the distribution and connection of the function points.
[0180] Step B4: Optimize the layout and style of the functional structure diagram.
[0181] For the framework of the functional structure diagram constructed in step B3, check the rationality and aesthetics of its layout. If there are problems that affect reading and understanding, such as overlapping nodes and confusing crossing of connections, the layout and style of the functional structure diagram are adjusted and optimized according to the selected layout algorithm.
[0182] Method Example 3
[0183] refer to Figure 3 , shows a schematic flow chart of the steps of a method for generating a test case according to an embodiment of the present application, the method specifically comprises the following steps:
[0184] Step 301: training a first language model according to first training data, so that the first language model represents a mapping relationship between document data and functional structure information; the first training data specifically includes: document data samples of preset software, and functional structure information samples corresponding to the document data samples;
[0185] Step 302: training the second largest language model according to the second training data, so that the second largest language model represents the mapping relationship between the functional structure information and the test case; the second training data specifically includes: functional structure information samples of the preset software, and test case samples corresponding to the functional structure information samples;
[0186] Step 303: input the document data of the target software into the first language model, and the first language model outputs the target functional structure information corresponding to the target software;
[0187] Step 304: Generate a functional structure diagram of the target software according to the target functional structure information;
[0188] Step 305: display the above functional structure diagram;
[0189] Step 306: update the functional structure diagram according to the adjustment instruction to obtain an updated functional structure diagram;
[0190] Step 307: input the updated functional structure diagram information into the second largest language model, and the second largest language model outputs a second target test case corresponding to the target software.
[0191] In the embodiment of the present application, step 304 converts the target functional structure information into a visual functional structure diagram, so that the user can intuitively grasp the various functional points and relationships of the software and understand the software architecture from a macro level.
[0192] Step 306 updates the functional structure diagram based on possible adjustment instructions, which means that the presentation of the software architecture can be continuously improved according to actual conditions, so that the updated functional structure diagram is more in line with the actual software situation and business needs.
[0193] Step 306 inputs the updated functional structure diagram information into the second language model to generate the second target test case. Since the functional structure diagram has been updated and optimized to reflect a more reasonable and accurate software architecture and functional relationship, the test cases generated based on it can better cover the various functional points of the software and their interactions, and more specifically detect possible problems in the software, effectively improve the comprehensiveness and accuracy of the test, and ensure the quality, stability, and future scalability and maintainability of the software.
[0194] In actual applications, adjustment instructions may come from many aspects. For example, the development team may find that the actual software architecture is different from the displayed functional structure diagram during code implementation, or the tester may need to re-sort the relationship between certain functional points based on the test results during the test process, or the product manager may propose adjustments to the displayed functional structure diagram based on changes in business requirements. There needs to be a corresponding communication channel or platform to collect these adjustment instructions to ensure that the source of the instructions is clear and the content is accurate.
[0195] The embodiment of the present application can perform a detailed analysis of the received adjustment instructions to determine whether they involve the increase or decrease of function points, changes in the relationship between function points (such as adjustment of the original dependency relationship, change in data flow direction, etc.) or other changes, and clarify which specific parts of the functional structure diagram need to be modified.
[0196] Furthermore, according to the analysis results, the corresponding function point nodes or lines can be found in the graphic drawing tool to perform corresponding modification operations. For example, if a new function point is added, a new node is added to the appropriate position in the diagram and lines with other related modules are drawn and the relationship is marked; if the relationship between function points is changed, the style of the line, the direction of the arrow, etc. are adjusted to accurately reflect the new relationship, and the functional structure diagram is updated to keep it consistent with the actual software architecture and the latest requirements.
[0197] In order to enable those skilled in the art to better understand the embodiments of the present application, the FTP (File Transfer Protocol) software is taken as an example to illustrate the method for generating a test case in the embodiments of the present application. The method specifically includes the following steps:
[0198] Step C1: Construction of functional structure diagram.
[0199] Step C11: Collection and preprocessing of document data samples.
[0200] Collect document data samples of various preset software, including user manuals, API documents, design specifications, and business requirements documents.
[0201] These document data samples are preprocessed and input into the first language model as the first training data.
[0202] Step C12: input the document data of the FTP software into the first large language model, and the first large language model outputs the target functional structure information corresponding to the FTP software.
[0203] Step C13, constructing a functional structure diagram of the FTP software according to the target functional structure information.
[0204] Reference Figure 4 , shows a schematic diagram of the functional structure diagram of the FTP software of an embodiment of the present application, wherein the functional points of the FTP software specifically include: user authentication, user login, file management, directory operation and error log, etc. Among them, file management specifically includes: file upload, file download and file record, etc. Directory operation specifically includes: browsing directory and creating directory, etc.
[0205] The functional structure diagram contains the association relationships between functional points, which include the following types:
[0206] 1) Data flow relationship: Functions interact through data exchange to form data flow relationships. For example, data flow relationships may include: user authentication → user login, user login → file management, user login → directory operation, file management → file upload, file management → file record, file management → file download, directory operation → browse directory, directory operation → create directory, file download → file upload, etc. Among them, the "file download" function point and the "file upload" function point transfer files through data flow, which is crucial to understanding the data integrity and consistency of FTP software.
[0207] 2) Define usage relationships: The "user authentication" function point of the FTP software defines user credentials, which are then used by the "file upload" function point to verify the user's identity.
[0208] 3) Generate usage relationship: A function creates certain objects or data, which are then used by other functions. For example, after the "File Upload" function point uploads a file, the "File Record" function point will generate corresponding file records, which can then be used by the "Browse Directory" function point to display the file list.
[0209] 4) Call relationship: One function directly calls another function. For example, the "browse directory" function point may need to call the "error log" function point.
[0210] 5) Conditional dependencies: Some functions depend on certain conditions or states, which are set by other functions. For example, the "directory operation" function point may only be executed after the "user login" is successful, which forms a conditional dependency.
[0211] 6) Exception handling relationship: When a function encounters an error or an exception during execution, it may need to call another function to handle these exceptions. For example, if a network interruption error occurs during the file upload process of the "File Upload" function point, the error log recording function of the "Error Log" function point may need to be called to record the error and notify the user.
[0212] Step C2: generating second training data.
[0213] Specifically, the function structure diagram can be converted into target function structure information in a preset format. The target function structure information of various preset software such as FTP software is used as a component of the second training data.
[0214] Convert the function points and association relationships in the function structure diagram into structured input data.
[0215] Step C3: training a second language model based on the second training data.
[0216] Step C31: Select a pre-trained second language model, such as GPT.
[0217] Step C32: Use the second training data to fine-tune the second language model and optimize the model parameters to meet the testing requirements of the FTP software.
[0218] Step C4: Test case generation
[0219] Step C41: Generate test cases corresponding to the target functional structure information by using the fine-tuned second language model.
[0220] Step C42: Test case verification.
[0221] Verify whether the generated test cases cover the key functions of the FTP software and conform to the actual application scenarios.
[0222] Step C 43: Consider exceptions and edge cases.
[0223] Ensure that test cases include exception handling and edge cases to test the stability and reliability of the software.
[0224] Step C44: Test case optimization
[0225] According to the verification results, the test cases are adjusted and optimized as necessary. For example, the process of adjusting and optimizing the test cases may include: in response to user feedback that the target software has problems under special circumstances (such as specific devices, special network environments), converting the above situations into test case content and adding them to the test cases to improve the coverage of the test cases.
[0226] The test case generation method of the embodiment of the present application brings a series of significant beneficial effects in the field of software testing, as follows:
[0227] 1. Automated test case generation:
[0228] Through the automated test case generation process, the embodiment of the present application significantly improves the efficiency of the testing work. The traditional manual test case writing process is time-consuming and error-prone, while the automated method of the embodiment of the present application reduces the manpower requirements in this process and speeds up the output of test cases.
[0229] 2. Improve test efficiency:
[0230] Automation not only speeds up test case generation, but also improves the efficiency of the testing process overall by reducing repetitive work, allowing the testing team to devote more time and energy to more valuable test design and analysis work.
[0231] 3. Improve the quality of test cases:
[0232] The second largest language model can provide a deeper understanding of the software's functions and business logic, and the generated test cases are more accurate and relevant, reducing invalid or redundant test cases and improving the quality of test cases.
[0233] 4. Comprehensively discover potential defects:
[0234] High coverage and high quality test cases make it more likely that potential defects will be discovered. The method of the embodiment of the present application helps to more comprehensively identify defects and problems in software through automated and intelligent test case generation.
[0235] 5. Reduce costs:
[0236] Since the reliance on manual test case writing is reduced, the method of the embodiment of the present application helps to reduce testing costs, especially in large and complex software projects, where this cost saving is particularly significant.
[0237] 6. Shorten the test cycle:
[0238] The ability to quickly generate automated test cases shortens the testing cycle, speeds up the entire process from software development to deployment, and enables products to respond more quickly to market changes and user needs.
[0239] 7. Improve the coverage of test cases:
[0240] The method of the embodiment of the present application comprehensively captures the functional structure of the software through a functional structure diagram, ensuring that the generated test cases can widely cover various functional points of the software, including normal functions and edge cases, thereby improving the test coverage.
[0241] 8. Strong adaptability:
[0242] The method of the embodiment of the present application can quickly adapt to changes and updates in software requirements, so that testing work can be synchronized with software development, maintaining the timeliness and relevance of testing.
[0243] In summary, the embodiments of the present application bring improvements to software testing, which not only improves the efficiency and quality of testing work, but also provides support for rapid iteration and continuous improvement of software.
[0244] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0245] Based on the above embodiment, this embodiment also provides a test case generation device, referring to Figure 5 As shown in the structural diagram, the device specifically includes: a first training module 501, a second training module 502, a functional structure extraction module 503 and a use case generation module 504.
[0246] The first training module 501 is used to train the first language model according to the first training data, so that the first language model represents the mapping relationship between the document data and the functional structure information; the first training data includes: the document data sample of the preset software, and the functional structure information sample corresponding to the document data sample;
[0247] A second training module 502 is used to train a second language model according to second training data, so that the second language model represents the mapping relationship between the functional structure information and the test case; the second training data includes: a functional structure information sample of the preset software, and a test case sample corresponding to the functional structure information sample;
[0248] The function structure extraction module 503 is used to input the document data of the target software into the first language model, and the first language model outputs the target function structure information corresponding to the target software;
[0249] The use case generation module 504 is used to input the target functional structure information corresponding to the target software into the second largest language model, and the second largest language model outputs the first target test case corresponding to the target software.
[0250] Optionally, the functional structure information includes: functional points, and association relationships between functional points.
[0251] Optionally, the association relationship between the function points includes: definition usage relationship, generation usage relationship, call relationship, conditional dependency relationship, data flow relationship and exception handling relationship.
[0252] Optionally, the use case generation module includes:
[0253] A format conversion module, used to convert the target functional structure information into a preset format; the preset format is a format that can be recognized by the second largest language model;
[0254] The first input module is used to input the target functional structure information in a preset format into the second language model.
[0255] Optionally, the device further comprises:
[0256] A diagram generation module, used for generating a functional structure diagram of the target software according to the target functional structure information;
[0257] A display module is used to display the functional structure diagram.
[0258] Optionally, the device further comprises:
[0259] An updating module, used for updating the functional structure diagram according to the adjustment instruction to obtain an updated functional structure diagram;
[0260] The second input module is used to input the updated functional structure diagram information into the second largest language model, and the second largest language model outputs a second target test case corresponding to the target software.
[0261] Optionally, the device further comprises:
[0262] A prompt input module, used to input the prompt text of the test case into the second language model;
[0263] The prompt text includes: element information of the test case, description information of the target software, and summary information of the target functional structure information.
[0264] The embodiment of the present application also provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiment of the present application.
[0265] The present application embodiment provides one or more machine-readable media on which instructions are stored, and when executed by one or more processors, an electronic device executes one or more of the methods described in the above embodiments. In the present application embodiment, the electronic device includes various types of devices such as terminal devices and servers (clusters).
[0266] The embodiments of the present disclosure may be implemented as a device that uses any appropriate hardware, firmware, software, or any combination thereof to perform a desired configuration, and the device may include: electronic devices such as terminal devices and servers (clusters). Figure 6 An exemplary apparatus 1100 that can be used to implement various embodiments described in this application is schematically shown.
[0267] For one embodiment, Figure 6 An exemplary apparatus 1100 is shown having one or more processors 1102, a control module (chip set) 1104 coupled to at least one of the (one or more) processors 1102, a memory 1106 coupled to the control module 1104, a non-volatile memory / storage device 1108 coupled to the control module 1104, one or more input / output devices 1110 coupled to the control module 1104, and a network interface 1112 coupled to the control module 1104.
[0268] The processor 1102 may include one or more single-core or multi-core processors, and the processor 1102 may include any combination of general-purpose processors or special-purpose processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, the device 1100 can be used as a terminal device, server (cluster), etc. described in the embodiments of the present application.
[0269] In some embodiments, the device 1100 may include one or more computer-readable media (e.g., memory 1106 or non-volatile memory / storage device 1108) having instructions 1114 and one or more processors 1102 configured to execute the instructions 1114 in combination with the one or more computer-readable media to implement a module to perform the actions described in the present disclosure.
[0270] For one embodiment, the control module 1104 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 1102 and / or any suitable device or component in communication with the control module 1104 .
[0271] The control module 1104 may include a memory controller module to provide an interface to the memory 1106. The memory controller module may be a hardware module, a software module, and / or a firmware module.
[0272] The memory 1106 may be used, for example, to load and store data and / or instructions 1114 for the device 1100. For one embodiment, the memory 1106 may include any suitable volatile memory, such as a suitable DRAM (Dynamic Random Access Memory). In some embodiments, the memory 1106 may include a double data rate type four synchronous dynamic random access memory.
[0273] For one embodiment, the control module 1104 may include one or more input / output controllers to provide an interface to the non-volatile memory / storage device 1108 and the input / output device(s) 1110 .
[0274] For example, non-volatile memory / storage 1108 may be used to store data and / or instructions 1114. Non-volatile memory / storage 1108 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives, one or more optical disk drives, and / or one or more digital versatile optical disk drives).
[0275] The non-volatile memory / storage device 1108 may include storage resources that are physically part of the device on which the apparatus 1100 is installed, or it may be accessible to the device without being part of the device. For example, the non-volatile memory / storage device 1108 may be accessed via (one or more) input / output devices 1110 over a network.
[0276] The input / output device(s) 1110 may provide an interface for the apparatus 1100 to communicate with any other appropriate device, and the input / output device 1110 may include a communication component, an audio component, a sensor component, etc. The network interface 1112 may provide an interface for the apparatus 1100 to communicate through one or more networks, and the apparatus 1100 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as WiFi (Wireless Fidelity), 2G (2nd Generation Wireless Telephone Technology), 3G (3rd Generation Wireless Telephone Technology), 4G (4th Generation Wireless Telephone Technology), 5G (5th Generation Wireless Telephone Technology), etc., or a combination thereof for wireless communication.
[0277] For one embodiment, at least one of the processor(s) 1102 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of the control module 1104. For one embodiment, at least one of the processor(s) 1102 may be packaged together with the logic of one or more controllers of the control module 1104 to form a system-in-package. For one embodiment, at least one of the processor(s) 1102 may be integrated on the same die with the logic of one or more controllers of the control module 1104. For one embodiment, at least one of the processor(s) 1102 may be integrated on the same die with the logic of one or more controllers of the control module 1104 to form a system-on-chip.
[0278] In various embodiments, the device 1100 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a touch screen device, a netbook, etc.). In various embodiments, the device 1100 may have more or fewer components and / or a different architecture. For example, in some embodiments, the device 1100 includes one or more cameras, a keyboard, a liquid crystal display screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, a dedicated integrated circuit, and a speaker.
[0279] Among them, the main control chip can be used as a processor or control module in the detection device, sensor data, location information, etc. are stored in a memory or non-volatile memory / storage device, the sensor group can be used as an input / output device, and the communication interface may include a network interface.
[0280] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0281] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0282] The present application embodiment is described with reference to the flowchart and / or block diagram of the method, terminal device (system) and computer program product according to the embodiment of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, and the combination of the process and / or box 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 terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device produce a device for implementing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0283] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0284] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0285] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0286] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0287] The above is a detailed introduction to a test case generation method and device, an electronic device and a machine-readable medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application sets. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for generating a test case, characterized in that: The method comprises: According to the first training data, the first large language model is trained so that the first large language model represents the mapping relationship between the document data and the functional structure information; the first training data includes: a document data sample of the preset software, and a functional structure information sample corresponding to the document data sample; The second language model is trained according to the second training data so that the second language model represents the mapping relationship between the functional structure information and the test case; the second training data includes: a functional structure information sample of the preset software, and a test case sample corresponding to the functional structure information sample; Inputting document data of the target software into the first language model, and outputting target functional structure information corresponding to the target software by the first language model; The target functional structure information corresponding to the target software is input into the second largest language model, and the second largest language model outputs the first target test case corresponding to the target software.
2. The method according to claim 1, characterized in that The functional structure information includes: functional points and association relationships between functional points.
3. The method according to claim 2, characterized in that The association relationship between the function points includes: definition usage relationship, generation usage relationship, call relationship, conditional dependency relationship, data flow relationship and exception handling relationship.
4. The method according to any one of claims 1 to 3, characterized in that: The step of inputting the target functional structure information corresponding to the target software into the second language model includes: Converting the target functional structure information into a preset format; the preset format is a format that can be recognized by the second largest language model; The target functional structure information in a preset format is input into the second language model.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Generate a functional structure diagram of the target software based on the target functional structure information; The functional structure diagram is displayed.
6. The method according to claim 5, characterized in that The method further comprises: According to the adjustment instruction, the functional structure diagram is updated to obtain an updated functional structure diagram; The updated functional structure diagram information is input into the second largest language model, and the second largest language model outputs a second target test case corresponding to the target software.
7. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Input the prompt text of the test case into the second largest language model; The prompt text includes: element information of the test case, description information of the target software, and summary information of the target functional structure information.
8. A test case generation device, characterized in that: The device comprises: A first training module is used to train a first large language model according to first training data, so that the first large language model represents a mapping relationship between document data and functional structure information; the first training data includes: document data samples of preset software, and functional structure information samples corresponding to the document data samples; A second training module is used to train a second language model according to second training data, so that the second language model represents the mapping relationship between the functional structure information and the test case; the second training data includes: a functional structure information sample of the preset software, and a test case sample corresponding to the functional structure information sample; A function structure extraction module, used for inputting document data of the target software into the first language model, and outputting target function structure information corresponding to the target software by the first language model; The use case generation module is used to input the target functional structure information corresponding to the target software into the second largest language model, and the second largest language model outputs the first target test case corresponding to the target software.
9. An electronic device, characterized in that: include: processor; and A memory having executable codes stored thereon, which, when executed, causes the processor to execute the method according to any one of claims 1 to 7.
10. A machine-readable medium having executable codes stored thereon, which, when executed, causes a processor to perform the method according to any one of claims 1 to 7.