Test file generation method and computing device

By splitting and processing the initial code information in batches, generating independent class methods and merging test files, the problems of memory overflow and incompleteness in AI model test file generation are solved, achieving efficient and accurate test file generation.

CN121902127APending Publication Date: 2026-04-21HENAN QINWEI DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-28
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

When generating test files, AI models may produce incomplete test files for long or complex code, or even cause processor memory overflow issues.

Method used

By splitting the initial code information, a list of test requirement fields and methods is generated. Long or complex code is broken down into independent class methods, and various methods are processed in batches through the first model. Finally, the test files are generated by merging them.

Benefits of technology

This avoids processor memory overflow issues, ensures the integrity and accuracy of generated test files, reduces model processing load, and decreases resource consumption and configuration costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121902127A_ABST
    Figure CN121902127A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a test file generation method and computing equipment, and the method comprises the steps: obtaining a code generation request which is used for requesting to generate a test file corresponding to initial code information; splitting the initial code information to obtain a test requirement field and a method list, the test requirement field being used for indicating a code generation requirement corresponding to the initial code information, and the method list comprising at least one class method; according to the test requirement field, various methods in the method list are processed through a first model, and at least one result file is obtained; and extracting multiple pieces of test information from the at least one result file, and merging the multiple pieces of test information to obtain a test file. According to the method, the memory overflow phenomenon of the processor during code generation processing of the AI model is avoided, and the integrity and accuracy of the test code generated by the AI model can be guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computing technology, and in particular to a test file generation method and computing device. Background Technology

[0002] Models are increasingly being used in the field of code generation, such as artificial intelligence (AI) models. These AI models can understand natural language requirements and generate high-quality code snippets to enable unit testing, code completion, and simple functions.

[0003] Currently, computing devices run AI models. Users can input raw code into the AI ​​model through a terminal so that the AI ​​model can parse and process the raw code and generate test files (such as test cases) based on the parsing results.

[0004] However, if the original code includes long or complex code, the AI ​​model may generate incomplete test files (such as missing test code for some methods) or even cause processor memory overflow. Summary of the Invention

[0005] This application provides a test file generation method and computing device, which can avoid processor memory overflow during AI model code generation and help ensure the integrity and accuracy of the test file corresponding to the generated initial code information.

[0006] In a first aspect, embodiments of this application provide a method for generating a test file, the method comprising:

[0007] Get the code generation request, which is used to request the generation of the test file corresponding to the initial code information;

[0008] The initial code information is split to obtain test requirement fields and a method list. The test requirement fields are used to indicate the code generation requirements corresponding to the initial code information, and the method list includes at least one class method.

[0009] Based on the test requirement fields, the methods in the method list are processed using the first model to obtain at least one result file;

[0010] Extract multiple test information from at least one result file, and merge the multiple test information to obtain a test file.

[0011] In the above technical solution, after obtaining the code generation request, long or complex code in the initial code information can be split into independent class methods. This avoids incomplete code generation or processor memory overflow issues when the computing device subsequently calls the first model to process the long or complex code. The computing device can process at least one class method from the task list in batches according to the test requirement fields, thereby reducing the load pressure (such as GPU memory usage) on the first model during each processing step, avoiding processor memory overflow issues, and ensuring the integrity of the code generation process for the long or complex code. The computing device can also extract multiple test information from at least one result file and classify and merge the at least one result file according to the multiple test information to obtain a neat, complete, and accurate test file corresponding to the initial code information, which helps ensure the integrity and accuracy of the test file.

[0012] In one possible implementation, the initial code information is split to obtain a list of test requirement fields and methods, including:

[0013] Based on the field parsing rules, test requirement fields are extracted from the initial code information. The field parsing rules include access modifiers and format constraints.

[0014] The initial code information is split to obtain at least one sub-code information. Based on the syntax structure rules, at least one class method is extracted from the at least one sub-code information. A method list is generated based on the at least one class method. The syntax structure rules are used to indicate the extraction of class methods according to the structural features of modifiers, return values, method names, method parameters, and method bodies.

[0015] In the above technical solution, the initial code information can be broken down into detailed steps based on field parsing rules and syntax structure rules. This helps avoid misunderstandings when the first model generates code based on the method list, ensuring the quality of the generated test methods (or "test code") corresponding to various methods generated by the first model. Furthermore, by splitting the code, long or complex code in the initial code information can be divided into independent class methods, preventing incomplete code generation or processor memory overflow issues when the computing device subsequently calls the first model to process the long or complex code.

[0016] In one possible implementation, the initial code information is split to obtain at least one sub-code information, including one of the following:

[0017] If the initial code information includes code snippets, the code snippets are split into sub-code information by class methods; or...

[0018] If the initial code information includes a file, extract at least one code fragment from the file, and split the at least one code fragment into at least one sub-code information by using class methods as the splitting unit; or...

[0019] If the initial code information includes a directory, the files in the directory are traversed to extract code fragments from each file. The code fragments in each file are then split using class methods as the splitting unit to obtain at least one sub-code information.

[0020] The above technical solution provides a complete method splitting mechanism that includes directory selection and file selection. This method can flexibly select multiple methods to split the initial code information based on its type, dividing it into at least one sub-code information with independent class methods as the splitting unit. This allows the subsequent first model to allocate and process the code according to class methods, avoiding problems such as incomplete code generation or processor memory overflow caused by long or complex code in the initial code information.

[0021] In one possible implementation, the multiple test information includes class name, annotation fields, and at least one test method corresponding to a class method;

[0022] Extract multiple test information entries from at least one result file, and merge the multiple test information entries to obtain a test file, including:

[0023] If there is only one class method, extract the class name from the result file corresponding to the class method, and extract the annotation field corresponding to at least one field annotation and the test method corresponding to the method annotation from the result file. Then, merge the class name, the annotation field corresponding to at least one field annotation, and the test method to obtain the test file.

[0024] If there are multiple class methods, for multiple result files corresponding to multiple class methods, extract the class name from each result file, and extract at least one annotation field corresponding to at least one field annotation and at least one test method corresponding to at least one method annotation from each result file. Then, perform deduplication and merging on the class name, at least one field annotation corresponding to at least one field annotation, and at least one test method extracted from multiple result files to obtain the test file.

[0025] Among them, the class name is used to indicate the test type corresponding to the result file; the field annotation identifier is used to locate the annotation field in the result file; and the method annotation identifier is used to locate the test method in the result file.

[0026] In the above technical solution, the merging requirement of multiple test information in each result file can be determined based on the number of result files corresponding to class methods and the number of class methods extracted from each result file. Based on the structural characteristics of the test files, class names, annotation fields and test methods in at least one result file can be accurately extracted and merged in a classified manner to ensure that the generated test files are complete, accurate and concise and meet the standardization requirements.

[0027] In one possible implementation, at least one annotation field corresponding to a field annotation identifier and a test method corresponding to a method annotation identifier are extracted from the result file, including:

[0028] Based on the field extraction rules, extract at least one annotation field corresponding to a field annotation identifier from the result file; the field extraction rules are used to indicate the following extraction parameters: at least one field annotation identifier, the field matching rule type used, and the field extraction boundary, where the field matching rule type includes regular expression type;

[0029] According to the method extraction rules, the test methods corresponding to the method annotation identifiers are extracted from the result file. The method extraction rules are used to indicate the following extraction parameters: method annotation identifier, method extraction boundary, and method extraction structure. The method extraction structure includes modifiers, return values, method names, method parameters, and method bodies.

[0030] In the above technical solution, annotation fields and test methods in each result file can be extracted accurately and categorized according to field extraction rules and method extraction rules, so as to ensure the accuracy and completeness of the generated test files.

[0031] In one possible implementation, the test method includes an identifier for a class method; deduplication and merging are performed on the class names extracted from multiple result files, the annotation fields corresponding to at least one field annotation identifier, and at least one test method, including:

[0032] The class names extracted from multiple result files are deduplicated and merged to obtain the class names corresponding to the initial code information;

[0033] For at least one field annotation identifier extracted from multiple result files, the corresponding annotation field is deduplicated and merged according to the field annotation identifier to obtain the annotation field corresponding to the initial code information;

[0034] Based on the order of multiple class methods in the initial code information, at least one test method extracted from multiple result files is deduplicated and merged according to the identifier of the class method to obtain the test method corresponding to the initial code information;

[0035] The class names, annotation fields, and test methods corresponding to the initial code information are merged to obtain the test file.

[0036] In the above technical solution, by classifying and accurately extracting class names, annotation fields, and test methods from multiple result files and performing deduplication and merging processing, complete and accurate test information corresponding to the initial code information can be obtained. This helps to ensure that the generated test files are complete, accurate, and concise, and meet standardization requirements.

[0037] In one possible implementation, based on the test requirement field, the methods in the method list are processed using a first model to obtain at least one result file, including:

[0038] Based on the model identifier in the test requirements field, determine the first model from multiple candidate models and obtain the call interface information of the first model;

[0039] Based on the test requirement fields and various methods, generate the corresponding model input parameters for each method in the first model;

[0040] Based on the API call information, send code generation requests for each type of method in the method list to the first model. The code generation requests include the model input parameters for the corresponding class methods.

[0041] Receive the result files corresponding to various methods output by the first model, and obtain at least one result file.

[0042] In the above technical solution, the calling interface information for the first model generated by executing the test file can be determined based on the model identifier in the test requirement field. Furthermore, based on the test requirement field and various methods, the corresponding model input parameters for each method in the first model are generated. Thus, the computing device can call the first model in batches based on the calling interface information and the model input parameters of each method. This improves the interface response speed of the first model, reduces the request pressure on the interface, and increases the code generation efficiency of the first model. In this method, by splitting the initial code information, long or complex code can be broken down into smaller units of class method sub-code information. Moreover, by calling the first model in batches, the processor's memory requirements for a single call to the first model can be reduced, avoiding processor memory overflow. Furthermore, it eliminates the need for a high-configuration server, thus reducing processing costs.

[0043] In one possible implementation, after sending the code generation request corresponding to the class method to the first model, the test file generation method further includes:

[0044] Send a query request to the first model. The query request is used to query the processing result of the first model in response to the code generation request and / or the running status of the first model.

[0045] Receive the query results sent by the first model, and determine whether to adjust the call operation on the first model based on the query results.

[0046] In the above technical solution, by requesting the first model to query the processing result of the code generation request and / or the running status of the first model, and by adjusting the call operation of the first model in a timely manner according to the query result returned by the first model, it is possible to ensure that the code generation request corresponding to the class method and the code generation request corresponding to the class method to be sent later can be processed normally by the first model, thereby helping to ensure the integrity and accuracy of the test file generated from the initial code information.

[0047] In one possible implementation, after obtaining the test file, the test file generation method further includes:

[0048] Determine whether the test files meet the user's testing requirements;

[0049] If the test file does not meet the test requirements, obtain the user's input switching instruction, update the first model to the second model among multiple candidate models based on the switching instruction, process various methods in the method list through the second model according to the test requirements field, obtain at least one updated result file, and determine the updated test file corresponding to the initial code information based on at least one updated result file.

[0050] In the above technical solution, after obtaining the test file, the method can also determine whether the test file meets the user's testing requirements. If it does not meet the user's testing requirements, the method can also switch models to regenerate the updated test file corresponding to the initial code information, making the method more flexible in generating test files.

[0051] Secondly, embodiments of this application provide a test document generation apparatus, comprising:

[0052] The acquisition module is used to acquire code generation requests, which are used to request the generation of test files corresponding to the initial code information.

[0053] The processing module is used to split the initial code information to obtain test requirement fields and a method list. The test requirement fields are used to indicate the code generation requirements corresponding to the initial code information, and the method list includes at least one class method.

[0054] The processing module is also used to process various methods in the method list according to the test requirement fields through the first model to obtain at least one result file;

[0055] The processing module is also used to extract multiple test information from at least one result file and merge the multiple test information to obtain a test file.

[0056] The test document generation apparatus provided in this application embodiment can execute the technical solutions shown in any of the first aspects, and its beneficial effects are similar, so they will not be described again here.

[0057] In one possible implementation, the processing module is specifically used for:

[0058] Based on the field parsing rules, test requirement fields are extracted from the initial code information. The field parsing rules include access modifiers and format constraints.

[0059] The initial code information is split to obtain at least one sub-code information. Based on the syntax structure rules, at least one class method is extracted from the at least one sub-code information. A method list is generated based on the at least one class method. The syntax structure rules are used to indicate the extraction of class methods according to the structural features of modifiers, return values, method names, method parameters, and method bodies.

[0060] In one possible implementation, the processing module is further configured to be used in one of the following ways:

[0061] If the initial code information includes code snippets, the code snippets are split into sub-code information by class methods; or...

[0062] If the initial code information includes a file, extract at least one code fragment from the file, and split the at least one code fragment into at least one sub-code information by using class methods as the splitting unit; or...

[0063] If the initial code information includes a directory, the files in the directory are traversed to extract code fragments from each file. The code fragments in each file are then split using class methods as the splitting unit to obtain at least one sub-code information.

[0064] In one possible implementation, the multiple test information includes a class name, annotation fields, and a test method corresponding to at least one class method; the processing module is specifically used for:

[0065] Extract multiple test information entries from at least one result file, and merge the multiple test information entries to obtain a test file, including:

[0066] If there is only one class method, extract the class name from the result file corresponding to the class method, and extract the annotation field corresponding to at least one field annotation and the test method corresponding to the method annotation from the result file. Then, merge the class name, the annotation field corresponding to at least one field annotation, and the test method to obtain the test file.

[0067] If there are multiple class methods, for multiple result files corresponding to multiple class methods, extract the class name from each result file, and extract at least one annotation field corresponding to at least one field annotation and at least one test method corresponding to at least one method annotation from each result file. Then, perform deduplication and merging on the class name, at least one field annotation corresponding to at least one field annotation, and at least one test method extracted from multiple result files to obtain the test file.

[0068] Among them, the class name is used to indicate the test type corresponding to the result file; the field annotation identifier is used to locate the annotation field in the result file; and the method annotation identifier is used to locate the test method in the result file.

[0069] In one possible implementation, the processing module is further configured to:

[0070] Based on the field extraction rules, extract at least one annotation field corresponding to a field annotation identifier from the result file; the field extraction rules are used to indicate the following extraction parameters: at least one field annotation identifier, the field matching rule type used, and the field extraction boundary, where the field matching rule type includes regular expression type;

[0071] According to the method extraction rules, the test methods corresponding to the method annotation identifiers are extracted from the result file. The method extraction rules are used to indicate the following extraction parameters: method annotation identifier, method extraction boundary, and method extraction structure. The method extraction structure includes modifiers, return values, method names, method parameters, and method bodies.

[0072] In one possible implementation, the test method includes an identifier for the class method; the processing module is further specifically used for:

[0073] The class names extracted from multiple result files are deduplicated and merged to obtain the class names corresponding to the initial code information;

[0074] For at least one field annotation identifier extracted from multiple result files, the corresponding annotation field is deduplicated and merged according to the field annotation identifier to obtain the annotation field corresponding to the initial code information;

[0075] Based on the order of multiple class methods in the initial code information, at least one test method extracted from multiple result files is deduplicated and merged according to the identifier of the class method to obtain the test method corresponding to the initial code information;

[0076] The class names, annotation fields, and test methods corresponding to the initial code information are merged to obtain the test file.

[0077] In one possible implementation, the processing module is further configured to:

[0078] Based on the model identifier in the test requirements field, determine the first model from multiple candidate models and obtain the call interface information of the first model;

[0079] Based on the test requirement fields and various methods, generate the corresponding model input parameters for each method in the first model;

[0080] Based on the API call information, send code generation requests for each type of method in the method list to the first model. The code generation requests include the model input parameters for the corresponding class methods.

[0081] Receive the result files corresponding to various methods output by the first model, and obtain at least one result file.

[0082] In one possible implementation, after sending the code generation request corresponding to the class method to the first model, the processing module is further configured to:

[0083] Send a query request to the first model. The query request is used to query the processing result of the first model in response to the code generation request and / or the running status of the first model.

[0084] Receive the query results sent by the first model, and determine whether to adjust the call operation on the first model based on the query results.

[0085] In one possible implementation, after obtaining the test file, the processing module is further configured to:

[0086] Determine whether the test files meet the user's testing requirements;

[0087] If the test file does not meet the test requirements, obtain the user's input switching instruction, update the first model to the second model among multiple candidate models based on the switching instruction, process various methods in the method list through the second model according to the test requirements field, obtain at least one updated result file, and determine the updated test file corresponding to the initial code information based on at least one updated result file.

[0088] Thirdly, embodiments of this application provide a computing device, including: a processor and a memory; the processor and the memory are coupled;

[0089] Memory is used to store program instructions;

[0090] The processor is used to execute program instructions to perform the methods shown in any of the first aspects.

[0091] The computing device provided in the embodiments of this application can execute the technical solutions shown in any of the first aspects, and its beneficial effects are similar, so they will not be described again here.

[0092] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions that, when executed by a computer, implement the method as shown in any of the first aspects.

[0093] The computer-readable storage medium provided in the embodiments of this application can perform the technical solutions shown in any of the first aspects, and its beneficial effects are similar, so they will not be described again here.

[0094] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method as described in any of the first aspects.

[0095] The computer program product provided in the embodiments of this application can execute the technical solutions shown in any of the first aspects, and its beneficial effects are similar, so they will not be described again here.

[0096] The test file generation method and computing device provided in this application embodiment, after obtaining the code generation request, split the initial code information in the code generation request to obtain test requirement fields and a method list, so as to split the long or complex code in the initial code information into mutually independent class methods, so as to avoid the problem of incomplete code generation or processor memory overflow when the computing device subsequently calls the first model to process the long or complex code. By having the first model process various methods in the method list, it is beneficial to reduce the load pressure (such as video memory usage) of the first model in each processing process and avoid processor memory overflow problems. Furthermore, by obtaining at least one result file output by the first model and classifying and merging the at least one result file according to multiple test information, the integrity and accuracy of the test information in the test file corresponding to the initial code information are ensured. Attached Figure Description

[0097] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0098] Figure 1 A schematic diagram illustrating an application scenario provided in an embodiment of this application;

[0099] Figure 2 This is a schematic diagram illustrating the process of uploading initial code information as provided in an embodiment of this application;

[0100] Figure 3 One of the flowcharts illustrating the test file generation method provided in this application embodiment;

[0101] Figure 4This is a schematic diagram of the result file merging process provided in the embodiments of this application;

[0102] Figure 5 A second schematic flowchart illustrating the test file generation method provided in this application embodiment;

[0103] Figure 6 The third flowchart illustrating the test file generation method provided in this application embodiment;

[0104] Figure 7 The fourth flowchart illustrating the test file generation method provided in this application embodiment;

[0105] Figure 8 Fifth flowchart illustrating the test file generation method provided in this application embodiment;

[0106] Figure 9 A flowchart illustrating the test file generation method provided in this application embodiment is shown in Figure 6.

[0107] Figure 10 This is a schematic diagram of the structure of a test document generation device provided in an embodiment of this application;

[0108] Figure 11 This is a schematic diagram of the hardware structure of a computing device provided in an embodiment of this application.

[0109] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation

[0110] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.

[0111] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of the technical solutions in the embodiments of this application. However, it does not mean that the applicant has used or necessarily used such solutions.

[0112] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in the embodiments of this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of related data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0113] It should be noted that in the embodiments of this application, the term "at least one" refers to one or more, and "more than one" refers to two or more.

[0114] First, the terminology used in the embodiments of this application will be explained.

[0115] AI-assisted code generation refers to the use of artificial intelligence technologies (such as pre-trained language models) to automatically generate or complete code in order to improve development efficiency.

[0116] Program Structure Interface (PSI): A layer in the IntelliJ platform responsible for parsing files and creating a syntactic and semantic code model that supports many of the platform's features.

[0117] This application provides a method for generating test files. In this method, a computing device can obtain a code generation request, which requests the generation of test files corresponding to initial code information. The method can also decompose the initial code information to obtain test requirement fields and a method list. The test requirement fields indicate the code generation requirements corresponding to the initial code information, and the method list includes at least one class method. Through this decomposition process, long or complex code in the initial code information can be split into independent class methods, avoiding incomplete code generation or processor memory overflow when the computing device subsequently calls the first model to process the long or complex code. For example, it can avoid neural network processor (NPU) overflow problems. Furthermore, compared to methods that extract and generate a summary from key information (such as functional descriptions, input / output requirements, constraints, etc.) in long code requirements and then generate test code from that summary, this method, based on the more detailed test requirement fields extracted from the initial code information and the method list generated based on the extracted at least one class method, helps avoid misunderstandings when the first model performs code generation based on the method list, ensuring the generation quality of test methods corresponding to various methods generated by the first model.

[0118] In this method, the computing device can process various methods in the method list according to the test requirement fields through a first model, obtaining at least one result file. The computing device can process at least one class method in the task list in batches through the first model, thereby reducing the load pressure (such as GPU memory usage) during each processing step, avoiding processor memory overflow issues, and ensuring the integrity of the first model when generating long or complex code. This process eliminates the need for fine-tuning the first model to adapt it to the processing of long or complex code, thus reducing resource consumption and model update and maintenance costs, and avoiding the time-consuming complexity of fine-tuning, thereby improving development efficiency. This method does not require configuring high-configuration computing devices (such as servers) for the first model, reducing configuration costs and improving resource utilization. Furthermore, the first model does not need to reject long code processing requests in scenarios with hard GPU memory limitations, allowing it to adapt to various processing scenarios.

[0119] In this method, the computing device can also extract multiple test information from at least one result file and merge the multiple test information to obtain a test file. By merging the multiple test information extracted from at least one result file, a neat, complete, and accurate test file corresponding to the initial code information can be obtained, which helps to ensure the integrity and accuracy of the test file.

[0120] In summary, the test file generation method provided in this application can avoid processor memory overflow when the first model (such as an AI model) performs code generation processing, and helps to ensure the integrity and accuracy of the test file corresponding to the generated initial code information.

[0121] It should be noted that in the embodiments of this application, "test file" and the term "test case" can be used interchangeably, and "test method" and "test code" can be used interchangeably.

[0122] To facilitate understanding of the test file generation method provided in the embodiments of this application, the following will be discussed in conjunction with... Figure 1 The application scenarios involved in the embodiments of this application will be introduced.

[0123] Figure 1 This is a schematic diagram illustrating an application scenario provided by an embodiment of this application. Please refer to [link / reference]. Figure 1 The computing device runs an AI-assisted plugin, and N AI models run on servers 1 through N, where N is an integer greater than 1. This AI-assisted plugin can be used to provide a service interface, which users can view and upload initial code information to.

[0124] Optionally, multiple AI models can run on a single server; for example, two AI models can run on a single server.

[0125] For example, the N AI models may include, but are not limited to, at least one of the following:

[0126] (1) A general large-scale language model that can be used for understanding and generating natural language and supports general tasks such as multilingual interaction, text creation, logical inference, and code generation.

[0127] (2) Optimized large-scale language model, which is an advanced form of language model, can support longer context, multimodal input (text + image) and tool calling capabilities, and can be used for natural language understanding, generation and complex task processing.

[0128] (3) Text embedding model can be used for tasks such as semantic similarity calculation, search matching, and clustering. It can provide underlying semantic support for text understanding.

[0129] Figure 2 This is a schematic diagram illustrating the process of uploading initial code information as provided in an embodiment of this application. Please refer to... Figure 2 The service interface can include two selection controls: a file selection control and a method selection control.

[0130] Users can trigger a file selection control via the terminal to upload a directory or file to the AI-assisted plugin. This directory can include multiple files, and each file can include at least one code snippet. In this case, the initial code information uploaded is this directory or file.

[0131] Users can also trigger this method via the terminal to select a control and upload code snippets to the AI-assisted plugin. These snippets can include initial code corresponding to one or more class methods. In this case, the uploaded initial code information is the code snippet itself.

[0132] Users trigger a file selection control via the terminal to upload an initial Java class file to the AI-assisted plugin. This initial Java class file includes fields (such as log and tag) and method bodies. The fields are the target test fields, and the method bodies are the original methods used to generate the test files.

[0133] like Figure 2As shown, the user triggers the file selection control through the terminal, which jumps to the file selection interface (such as the file selection interface for Java files). This file selection interface includes multiple files, and the user can select file 2 from among them through the terminal. The user can also trigger the file 2 selection control through the terminal, which jumps to the file 2 content interface. The file 2 content interface can display file 2 (such as the initial Java class file). File 2 can include the class's package path information and imported dependency information, class annotations, fields, and two interface methods, namely method 1 (such as the sayHello method) and method 2 (such as the printTest method).

[0134] The service interface may also include a generation control. After uploading the initial code information, the user can trigger the generation control through a computing device to send a code generation request to the AI-assisted plugin. This code generation request can be used to request the generation of a test file corresponding to the initial code information.

[0135] The computing device can break down the initial code information to obtain a list of test requirement fields and methods. This method list can include at least one class method. If the method list includes multiple class methods, any two class methods are independent of each other, and each class method is the smallest unit of execution (i.e., each class method cannot be further subdivided).

[0136] The test requirement field may include a model identifier. Based on this model identifier, the computing device can select the first model (e.g., AI model 1) corresponding to the model identifier from among N AI models. Then, according to the test requirement field, the device processes each method in the method list using the first model to obtain at least one result file corresponding to at least one class method. The computing device can also classify and merge the at least one result file according to multiple test information to obtain the test file corresponding to the initial code information.

[0137] This application embodiment can provide an AI-assisted plugin capable of splitting and merging Java code. This AI-assisted plugin may include a request preprocessing module, an AI service module, and an AI result merging module. Wherein:

[0138] (1) Request preprocessing module

[0139] The request preprocessing module can be used to break down the initial code information to obtain a list of test requirement fields and methods.

[0140] This request preprocessing module can split long or complex code in the initial code information into independent class methods to avoid problems such as incomplete code generation or processor memory overflow when the computing device subsequently calls the first model to process the long or complex code.

[0141] (2) AI Service Module

[0142] The AI ​​service module can be used to poll the first model to process various methods in the method list based on the test requirement fields, and obtain at least one result file corresponding to at least one class method.

[0143] For example, request preprocessing can store the split methods in a method list. The AI ​​service module then puts the split method list into a queue and repeatedly requests the AI ​​interface corresponding to the first model to process the various methods in the method list through the first model. The AI ​​interface can support individual calls to single class methods, and the AI ​​service module can monitor the running status of the AI ​​interface in real time.

[0144] The AI ​​service module calls the first model through a batch processing strategy, which helps reduce the load pressure (such as video memory usage) of the first model during each processing and avoids processor memory overflow issues.

[0145] (3) AI Result Merging Module

[0146] The AI ​​result merging module can be used to extract multiple test information from at least one result file and merge the multiple test information to obtain a test file.

[0147] This AI results merging module helps ensure that the generated test files are complete, accurate, and concise, and meet standardization requirements by performing categorized extraction and merging of test information from at least one result file.

[0148] In some embodiments, the test file generation method provided in this application can be applied to enterprise resource planning (ERP) system switching scenarios, for example, it can be applied to data verification processing during ERP system switching.

[0149] The technical solutions of the embodiments of this application will be described in detail below with specific examples. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.

[0150] Figure 3 This is one of the flowcharts illustrating the test file generation method provided in the embodiments of this application. This method can be applied to, for example... Figure 1 In the computing device shown. Please see Figure 3 The method may include the following steps:

[0151] S301, Obtain code generation request.

[0152] Code generation requests can be used to request the generation of test files corresponding to the initial code information.

[0153] Initial code information can be one of the following: a code snippet, including initial code corresponding to at least one class method; a file, including at least one code snippet; or a directory, including multiple files.

[0154] like Figure 1 As shown, users can use their terminals to trigger selection controls (file selection controls or method selection controls) in the AI-assisted plugin's service interface to upload the initial code information to the AI-assisted plugin. Users can also use their terminals to trigger generation controls in the AI-assisted plugin's service interface to send a code generation request to the AI-assisted plugin.

[0155] For example, the initial code information can be a Java unit test file, which may include at least one code snippet.

[0156] For example, the Java unit test file may contain one or more methods and several fields. For instance, the master data of the Java unit test file may be represented in the form shown in Table 1.

[0157] Table 1

[0158]

[0159] S302. The initial code information is split and processed to obtain a list of test requirement fields and methods.

[0160] The test requirements field can be used to indicate the code generation requirements corresponding to the initial code information, and the method list can include at least one class method.

[0161] Optionally, the test requirement field may include at least one of the following:

[0162] Model identifier, used to indicate the AI ​​model that generated the test file corresponding to this initial code information;

[0163] Test scenario information is used to indicate the test scenario corresponding to the initial code information. The test scenario may include, but is not limited to, at least one of the following: unit test scenario, integration test scenario, boundary value test scenario, and performance test scenario.

[0164] Test standards are used to indicate the standards that the generated test files must meet.

[0165] Test data, used to indicate the initial data used when generating the test file;

[0166] Format constraint information, used to indicate at least one of the following information for the generated test file: format, version information, and naming conventions;

[0167] Environment configuration information, which indicates the environment configuration that the test file must meet.

[0168] Each class method is an independent, smallest unit of execution (i.e., each class method cannot be further divided).

[0169] A class method can include a modifier, a return value, a method name, method parameters, and a method body.

[0170] Modifiers can be used to indicate the scope by which a method of a class can be accessed by other classes or other code. For example, a modifier can be one of the following: public, which can be called by any class; private, which can only be called within a specific class; and protected, which can be called by the current class and its subclasses.

[0171] The return value can be used to indicate the result data returned after the method of this type has been executed.

[0172] The method name is the identifier for this class of methods, distinguishing it from methods of other classes.

[0173] Method parameters are used to indicate the parameters that need to be passed when the method of this class is called.

[0174] The method body may include code statements that instruct the execution logic of the method of that class.

[0175] In some embodiments, the computing device (or AI-assisted plugin) can decompose the initial code information through the following steps one and two to obtain a list of test requirement fields and methods:

[0176] Step 1: Extract the test requirement fields from the initial code information according to the field parsing rules.

[0177] Field parsing rules can include access modifiers and format constraints.

[0178] Access modifiers can include at least one of the following: public, private, or protected.

[0179] Format constraints can be used to indicate the format requirements that test requirement fields must meet, such as occupying a single line.

[0180] For example, the field parsing rule could be: parse text modified by private, public, or protected, and that text occupies a single line.

[0181] Step 2: Split the initial code information to obtain at least one sub-code information, and extract at least one class method from the at least one sub-code information according to the syntax structure rules, and generate a method list based on the at least one class method.

[0182] Syntax structure rules are used to indicate how to extract class methods based on structural features such as modifiers, return values, method names, method parameters, and method bodies.

[0183] Syntax structure rules can be the syntax structure rules for Java methods.

[0184] For example, the syntax structure rules can be as follows: based on the syntax structure rules of Java methods, the sub-code information corresponding to the class method is split into the following structural features to obtain the class method: modifier, return value, method name, method parameters, and method body, and the split class method is stored in a method list.

[0185] Optionally, the syntax rules can be configured by the user in the computing device or AI-assisted plugin.

[0186] It should be noted that the process of splitting the initial code information according to the grammatical structure rules to obtain at least one sub-code information will be... Figure 5 The examples are described in detail and will not be repeated here.

[0187] In some embodiments, at least one sub-code information can be parsed and processed by a code parsing tool, which can parse and process the at least one code information based on syntax structure rules to obtain a list of methods.

[0188] This method allows for detailed breakdown of the initial code information based on field parsing and syntax structure rules. This helps avoid misunderstandings when the first model generates code based on the method list, ensuring the quality of the generated test methods (or test code) for each method. Furthermore, this breakdown process can separate long or complex code from the initial code information into independent class methods, preventing incomplete code generation or processor memory overflow issues when the computing device subsequently calls the first model to process such long or complex code.

[0189] S303. Based on the test requirement fields, process the various methods in the method list using the first model to obtain at least one result file.

[0190] The result file includes the class name, annotation fields, and at least one test method corresponding to the class method. The test method may include the identifier of the corresponding class method.

[0191] For example, the identifier of a class method can be the method name of the class method. For instance, the identifier of a class method can be "sayHello" or "printTest".

[0192] The class name can be used to indicate the test type corresponding to the result file. For example, the class name can be "public class HealthControllerTest", indicating that the result file is a test class used to test the HealthController.

[0193] Annotation fields may include field annotation identifiers, which can be used to locate annotation fields in the result file.

[0194] For example, the field annotation identifier can be a first field annotation identifier or a second field annotation identifier.

[0195] The annotation fields extracted based on the first field annotation identifier can be used to create test objects. For example, the first field annotation identifier can be "@Mock". For instance, the annotation field is a field with the "@Mock" annotation.

[0196] The annotation fields extracted based on the second field annotation identifier can be used to implement object injection. For example, the second field annotation identifier can be "@InjectMocks". For instance, the annotation field is a field with the @InjectMocks annotation.

[0197] Test methods can be located in the results file using method annotations. For example, the method annotation can be "@Test".

[0198] A test method can include modifiers, return value, method name, method parameters, and method body.

[0199] Test methods can include the identifier of the class method. For example, if the identifier of the class method is "sayHello", the name of the test method can be "sayHello_SUCCESS", and the name of the test method includes the identifier of the class method.

[0200] A single results file can contain multiple test methods corresponding to a single class method. Alternatively, a single results file can also contain test methods corresponding to multiple class methods.

[0201] Figure 4 For a schematic diagram of the result file merging process provided in the embodiments of this application, please refer to [link / reference]. Figure 4 It includes two result files, of which:

[0202] The result file 1 includes the class name, annotation fields, and two test methods corresponding to class method 1 (sayHello method) (such as sayHello_SUCCESS method and sayHello_ERROR method).

[0203] The result file 2 includes the class name, annotation fields, one test method corresponding to class method 1 (sayHello method) (such as sayHello_ERROR method), and two test methods corresponding to class method 2 (such as printTest method) (such as printTest_SUCCESS method and printTest_ERROR method).

[0204] For example, if the initial code information is a Java unit test file, the corresponding result file can be a Java class file.

[0205] Optionally, the AI-assisted plugin may include an AI service invocation module. This AI service invocation module can be used to generate model input parameters corresponding to various methods in the first model based on test requirement fields and various methods, and to repeatedly call the first model to process various methods in the method list according to the calling interface information, and to receive at least one result file output by the first model.

[0206] In this method, the initial information is split and processed to obtain the test requirement fields and method list. Based on the method list, the code generation tasks corresponding to various methods of the first model can be called in batches. This helps to improve the interface response speed of the first model, reduce the request pressure of the interface of the first model, and improve the code generation efficiency of the first model.

[0207] S304. Extract multiple test information from at least one result file, and merge the multiple test information to obtain a test file.

[0208] Multiple test information may include class name, annotation fields, and at least one test method corresponding to a class method.

[0209] For example, the test method can be a Java test method.

[0210] It is understandable that if the method list includes one class method, the number of result files is one; if the method list includes multiple class methods, the number of result files is multiple.

[0211] Case 1: If the number of methods in the class is one.

[0212] The computing device (or AI-assisted plugin) can extract the class name from the result file corresponding to the method, as well as the annotation field corresponding to at least one field annotation and the test method corresponding to the method annotation from the result file. The class name, the annotation field corresponding to at least one field annotation, and the test method are then merged to obtain the test file.

[0213] Optionally, the computing device (or AI-assisted plugin) can determine the statement containing the class name based on the class definition identifier "public class", and extract that statement or the class name.

[0214] It should be noted that the process of extracting at least one field annotation identifier corresponding to the annotation field and the method annotation identifier corresponding to the test method from the result file will be... Figure 6 The examples are illustrated below.

[0215] Optionally, the computing device (or AI-assisted plugin) can determine the test file generation template corresponding to the test file type required by the user, and fill the extracted class name, at least one field annotation identifier corresponding to the annotation field and test method into the corresponding fill area of ​​the test file generation template to obtain a test file that meets the user's requirements.

[0216] The result file for this type of method may contain multiple test information and other useless information. By extracting and processing the multiple test information in the result file, the useless information in the result file can be removed, making the format of the test file more standard.

[0217] Case 2: If there are multiple methods in the class.

[0218] For multiple result files corresponding to multiple class methods, the computing device (or AI-assisted plugin) can extract the class name from each result file, as well as the annotation field corresponding to at least one field annotation identifier and the at least one test method corresponding to the method annotation identifier from each result file. The device then performs deduplication and merging on the extracted class names, the annotation field corresponding to at least one field annotation identifier, and the at least one test method from the multiple result files to obtain the test file. Here, the class name is used to indicate the test type corresponding to the result file; the field annotation identifier is used to locate the annotation field in the result file; and the method annotation identifier is used to locate the test method in the result file.

[0219] It should be noted that the process of deduplicating and merging the class names, at least one annotation field corresponding to the field identified by the annotation, and at least one test method extracted from multiple result files to obtain the test file will be discussed later. Figure 7 The examples are illustrated below.

[0220] For example, the first model can be an AI model that provides an AI interface, through which the AI ​​model can return a result file. The computing device (or AI-assisted plugin) can flexibly parse the result file returned by the AI ​​interface.

[0221] For example, the resulting file can be presented as Java test case code, which is a complete Java class file, including the class name, annotation fields, and test methods corresponding to at least one class method. The computing device (or AI-assisted plugin) can extract the generated Java test methods using Java unit test code rules (including the use of @Mock, @InjectMocks, and @Test). For example, @Mock and @InjectMocks are used to extract the necessary annotation fields, with the extraction rule being: extract the line following the @Mock or @InjectMocks annotation; @Test is used to extract the test methods corresponding to various methods, with the extraction rule being: extract methods annotated with @Test, and the method rules are in the following order: modifier, return value, method name, method parameters, and method body.

[0222] For test methods that have already been generated, the computing device (or AI-assisted plugin) integrates newly extracted test methods into the same file, while skipping content that is duplicated with existing methods. This approach ensures centralized management of test methods (facilitating user viewing and use), avoids redundant code caused by repeated generation, and protects existing valid test methods from being mistakenly overwritten, thus improving the efficiency and security of test case management.

[0223] This method can provide code extraction logic rules, which can be used to extract multiple test information from the result file returned by the AI ​​interface of the first model, so as to ensure the completeness and accuracy of the test method generation corresponding to various methods in the test file.

[0224] The AI-assisted plugin may include a test file module, which provides test files generated by the plugin. Each test file includes a class name, annotation fields, and test methods. Users can view the generated test files (such as Java unit test cases) provided in this module using a computing device. For example, annotation fields may include mock data and test methods presented in the form of Java Test Code (JTC).

[0225] This method can determine the merging requirements of multiple test information in each result file based on the number of result files corresponding to class methods and the number of class methods extracted from each result file. Based on the structural characteristics of the test files, it can perform classified and accurate extraction and merging of class names, annotation fields and test methods in at least one result file to ensure that the generated test files are complete, accurate and concise and meet the standardization requirements.

[0226] The test file generation method provided in this application embodiment, after obtaining the code generation request, splits the initial code information in the code generation request to obtain test requirement fields and a method list; and processes various methods in the method list in batches through a first model to reduce the load pressure (such as video memory usage) of the first model in each processing process and avoid processor memory overflow problems; and also obtains at least one result file output by the first model and classifies and merges the at least one result file according to multiple test information to ensure the integrity and accuracy of the test information in the test file corresponding to the initial code information.

[0227] Below, in conjunction with Figure 5 The process by which the computing device splits the initial code information to obtain at least one sub-code information is described in detail.

[0228] Figure 5 This is a second flowchart illustrating the test file generation method provided in the embodiments of this application. This method can be applied to, for example... Figure 1 In the computing device shown. Please see Figure 5 The method may include the following steps:

[0229] S501. Obtain the code generation request, which includes initial code information.

[0230] It should be noted that the specific execution process of this step can be referred to the specific execution process of step S301, and will not be repeated here.

[0231] S502. Determine whether the initial code information includes a directory.

[0232] If so, then execute S503;

[0233] If not, then execute S504.

[0234] S503. Traverse the files in the directory to extract code fragments from each file, and split the code fragments in each file using class methods as the splitting unit to obtain at least one sub-code information.

[0235] It is understandable that in the process of splitting code segments in each file by class method, what is obtained is the sub-code information corresponding to each class method.

[0236] Assume the directory contains S files, where S is an integer greater than or equal to 1. A computing device (or AI-assisted plugin) can perform the following steps:

[0237] Step 1: Initialize t to 1.

[0238] Step 2: Determine the t-th file in the directory, extract the code snippet from the t-th file, and split the code snippet in the t-th file by class method as the splitting unit to obtain the sub-code information in the t-th file.

[0239] Where t takes the values ​​1, 2, ..., S in sequence.

[0240] Step 3: Determine whether t is greater than or equal to S.

[0241] If not, proceed to step four; if yes, proceed to step five.

[0242] Step 4: Update t to t+1.

[0243] After completing step four, return to step two.

[0244] Step 5: Obtain at least one sub-code information.

[0245] S504. Determine whether the initial code information includes a file.

[0246] If so, then execute S505;

[0247] If not, then execute S506.

[0248] S505. Extract at least one code fragment from the file, and split the at least one code fragment into at least one sub-code information by using class methods as the splitting unit.

[0249] Suppose the file contains P code snippets, where P is an integer greater than or equal to 1. A computing device (or AI-assisted plugin) can perform the following steps:

[0250] Step 1: Initialize q to 1.

[0251] Step 2: Extract the q-th code fragment from the file, and split the q-th code fragment into sub-code information corresponding to the q-th code fragment, using class methods as the splitting unit.

[0252] Where q takes the values ​​1, 2, ..., P in sequence.

[0253] Step 3: Determine whether q is greater than or equal to P.

[0254] If yes, proceed to step four; otherwise, proceed to step five.

[0255] Step 4: Update q to q+1.

[0256] After completing step four, return to step two.

[0257] Step 5: Obtain at least one sub-code information.

[0258] S506. Determine whether the initial code information includes code snippets.

[0259] If so, then execute S508;

[0260] If not, proceed to step S507.

[0261] S507. End the code generation process.

[0262] S508. The code segment is split into sub-code information by class method as the splitting unit.

[0263] Understandably, if a code snippet includes a single class method, it will not be split further. If a code snippet includes multiple class methods, it will be split into multiple sub-code pieces, each corresponding to a different class method.

[0264] The test file generation method provided in this application provides a complete method splitting mechanism including directory selection and file selection. This method can flexibly select multiple methods to split the initial code information according to its type, dividing it into at least one sub-code information with independent class methods as the splitting unit. This allows the first model to allocate and process the code according to class methods, avoiding problems such as incomplete code generation or processor memory overflow caused by long or complex code in the initial code information. Furthermore, based on field parsing rules and syntax structure splitting rules, this method performs detailed splitting processing (or "preprocessing") on the at least one sub-code information and the initial code information, which helps avoid misunderstandings when the first model generates code based on the task list, ensuring the generation quality of test methods corresponding to various methods generated by the first model.

[0265] In some embodiments, for any result file, at least one field annotation identifier corresponding to an annotation field and at least one method annotation identifier corresponding to a method annotation identifier can be extracted from the result file. Below, in conjunction with... Figure 6The process will be explained in detail.

[0266] Figure 6 This is the third flowchart illustrating the test file generation method provided in this application embodiment. This method can be applied to, for example... Figure 1 In the computing device shown. Please see Figure 6 The method may include the following steps:

[0267] S601. Based on the field extraction rules, extract at least one annotation field corresponding to the field annotation identifier from the result file.

[0268] Field extraction rules can be used to indicate the following extraction parameters: at least one field annotation identifier, the type of field matching rule used, and the field extraction boundaries.

[0269] At least one field annotation identifier may include a first field annotation identifier (such as "@Mock") and / or a second field annotation identifier (such as "@InjectMocks").

[0270] Field matching rule types can include regular expression types.

[0271] Optionally, the field matching rule type may also include other field matching rule types for performing field matching processing (such as keyword matching type based on field features, etc.). This application embodiment does not limit the field matching rule type.

[0272] Field extraction boundaries can be used to indicate the extraction range of the annotation fields corresponding to the annotation identifiers of each field in the result file.

[0273] For example, the field extraction rule can be: a regular expression that matches fields annotated with @Mock and @InjectMocks that end with a semicolon.

[0274] It is understandable that for any result file, if the result file contains M field annotation identifiers, M annotation fields can be extracted from the result file, where M is an integer greater than or equal to 1.

[0275] S602. According to the method extraction rules, extract the test methods corresponding to the method annotations in the result file.

[0276] Method extraction rules can be used to indicate the following extraction parameters: method annotation identifier, method extraction boundary, and method extraction structure.

[0277] For example, the method annotation identifier can be "@Test".

[0278] Method extraction boundaries can be used to indicate the extraction range of the code snippet corresponding to each method annotation in the result file, including the test method.

[0279] The method extraction structure can include modifiers, return values, method names, method parameters, and method bodies. It should be noted that the contents of modifiers, return values, method names, method parameters, and method bodies in this step can be referenced from the contents of modifiers, return values, method names, method parameters, and method bodies in step S302, and will not be repeated here.

[0280] For example, the method extraction rules can be as follows: methods that match the @Test annotation: the line immediately adjacent to @Test and matching the pair {}, and the test methods are extracted according to the structural features of modifiers, return values, method names, method parameters, and method bodies.

[0281] Each result file may include multiple method annotation identifiers, and each method annotation identifier corresponds to a test method.

[0282] Computing devices (or AI-assisted plugins) can extract multiple test methods from each result file based on method annotations. For example... Figure 4 As shown, these multiple test methods can be test methods corresponding to the same class method (as shown in result file 1); or, these multiple test methods can be test methods corresponding to different class methods (as shown in result file 2).

[0283] The test file generation method provided in this application can accurately extract annotation fields and test methods from each result file according to field extraction rules and method extraction rules, so as to ensure the accuracy and completeness of the generated test files.

[0284] In some embodiments, if there are multiple class methods in the method list, the corresponding number of result files output by the first model will also be multiple. For the multiple result files corresponding to multiple class methods, the computing device (or AI-assisted plugin) can refer to... Figure 7 The method shown extracts multiple test information from multiple result files and merges the multiple test information to obtain a test file.

[0285] Figure 7 This is the fourth flowchart illustrating the test file generation method provided in the embodiments of this application. This method can be applied to, for example... Figure 1 In the computing device shown. Please see Figure 7 The method may include the following steps:

[0286] S701. Extract class names from each result file, and extract at least one field annotation identifier corresponding to an annotation field and at least one method annotation identifier corresponding to a method annotation identifier from each result file.

[0287] Optionally, the computing device (or AI-assisted plugin) can determine the statement containing the class name in each result file based on the class definition identifier "public class", and extract the statement or the class name in each result file.

[0288] It should be noted that the process of extracting at least one annotation field corresponding to the field annotation identifier and at least one test method corresponding to the method annotation identifier from each result file can be referred to the execution process of steps S601 and S602, and will not be repeated here.

[0289] S702. Perform deduplication and merging on the class names extracted from multiple result files to obtain the class names corresponding to the initial code information.

[0290] like Figure 4 As shown, both result file 1 and result file 2 contain class names, and the class names in the two result files are the same. The class names in these two result files can be deduplicated and merged, and only one class name is retained in the test file.

[0291] S703. For at least one field annotation identifier extracted from multiple result files, perform deduplication and merging processing according to the field annotation identifier to obtain the annotation field corresponding to the initial code information.

[0292] For any field annotation identifier, the annotation fields corresponding to that field annotation identifier extracted from multiple result files can be deduplicated and merged to obtain the merged annotation field corresponding to that field annotation identifier; at least one field annotation identifier corresponding to the merged annotation field can be merged to obtain the annotation field corresponding to the initial code information.

[0293] For example, if all M result files include the annotation field "@InjectMocks+field1", where M is an integer greater than 1, the annotation field in M-1 result files can be deleted, and the annotation field in the remaining 1 result file can be identified as the annotation field corresponding to the initial code information.

[0294] S704. Based on the order of multiple class methods in the initial code information, perform deduplication and merging on at least one test method extracted from multiple result files according to the identifier of the class method to obtain the test method corresponding to the initial code information.

[0295] For any given class method, based on the identifier of that class method, determine multiple test methods corresponding to that class method from at least one test method extracted from multiple result files, and perform deduplication and merging processing on the multiple test methods corresponding to that class method to obtain the merged test method corresponding to that class method; based on the order of the multiple class methods in the initial code information, merge the merged test methods corresponding to the multiple class methods to obtain the test method corresponding to the initial code information.

[0296] For example, in Figure 4 There are two class methods. Two test methods corresponding to class method 1 are extracted from result file 1, and one test method corresponding to class method 1 is extracted from result file 2, resulting in a total of three test methods corresponding to class method 1. These three test methods are then merged to obtain two merged test methods corresponding to class method 1.

[0297] Similarly, 0 test methods corresponding to class method 2 were extracted from result file 1, and 2 test methods corresponding to class method 2 were extracted from result file 2, for a total of 2 test methods corresponding to class method 2. After merging these 2 test methods, the 2 merged test methods corresponding to class method 2 were obtained.

[0298] Based on the order of multiple class methods in the initial code information (e.g., class method 1 before class method 2), the two merged test methods corresponding to class method 1 and the two merged test methods corresponding to class method 2 are merged to obtain four test methods corresponding to the initial code information. Among them, the two test methods corresponding to class method 1 are arranged before the two test methods corresponding to class method 2.

[0299] S705. Merge the class names, annotation fields, and test methods corresponding to the initial code information to obtain the test file.

[0300] Optionally, the computing device (or AI-assisted plugin) can determine the test file generation template corresponding to the test file type required by the user, and fill the class name, annotation fields and test methods corresponding to the initial code information into the corresponding fill area of ​​the test file generation template to obtain a test file that meets the user's requirements.

[0301] The test file generation method provided in this application provides a way to obtain complete and accurate test information corresponding to the initial code information by accurately extracting and deduplicating class names, annotation fields, and test methods from multiple result files. This helps ensure that the generated test files are complete, accurate, and concise, and meet standardization requirements.

[0302] In this method, a computing device (or AI-assisted plugin) can process various methods in the method list based on the test requirement fields using a first model to obtain at least one result file. Below, we will combine... Figure 8 This process will be explained.

[0303] Figure 8 This is the fifth flowchart illustrating the test file generation method provided in the embodiments of this application. This method can be applied to, for example... Figure 1 In the computing device shown. Please see Figure 5 The method may include the following steps:

[0304] S801. Based on the model identifier in the test requirements field, determine the first model from multiple candidate models and obtain the call interface information of the first model.

[0305] The model identifier can be the model's name or index.

[0306] For example, the API call information may include, but is not limited to, the following: API address, used to indicate the network address on which the first model provides access; authentication information, used to determine whether the caller (such as a computing device) has access rights to the first model; request method, used to indicate the method of sending the request to the first model; request format, used to indicate the structure, type, and parameter range of the request data, and to determine that the request data can be input into the first model normally; and response format, used to indicate the structure and field description of the data returned by the first model, and to parse the result file returned by the first model.

[0307] S802. Based on the test requirement fields and various methods, generate the corresponding model input parameters for each method in the first model.

[0308] Optionally, the model input parameters corresponding to various methods can be assembled according to the request format of the first model, based on the test requirement fields and various methods.

[0309] S803. Based on the API call information, send code generation requests for each type of method in the method list to the first model.

[0310] Correspondingly, the first model can receive code generation requests for various methods in the method list sent by the computing device (or AI-assisted plugin).

[0311] The code generation request includes the model input parameters for the corresponding class method.

[0312] In some embodiments, the interface address, request method, and request format of the first model can be determined based on the interface call information, and code generation requests corresponding to various methods can be generated based on these indications and the model input parameters corresponding to various methods.

[0313] In some embodiments, if the method list includes N class methods, where N is an integer greater than 1, the computing device (or AI-assisted plugin) can send a code generation request to the first model by performing the following steps:

[0314] (1) Initialize j to 1.

[0315] (2) Based on the API call information, send the j-th code generation request corresponding to the j-th class method to the first model.

[0316] Where j takes the values ​​1, 2, 3, ..., N in sequence.

[0317] The j-th code generation request includes the model input parameters for the j-th class method.

[0318] (3) Receive the j-th result file corresponding to the j-th class method output by the first model.

[0319] For example, the j-th result file can be a Java class file (or a string containing the Java class file name).

[0320] After receiving the j-th result file, the computing device (or AI-assisted plugin) can parse and process it. The j-th result file may include a class name, at least one field annotation identifying the corresponding annotation field, and a method annotation identifying the corresponding test method.

[0321] (4) Determine whether j is greater than or equal to N.

[0322] If not, update j to j+1.

[0323] If so, then N result files corresponding to N class methods will be obtained.

[0324] Optionally, the computing device (or AI-assisted plugin) can also send multiple code generation requests corresponding to class methods to the first model in batches to improve the code generation efficiency of the first model.

[0325] Optionally, after performing step S803, the computing device (or AI-assisted plugin) may also perform the following steps: send a query request to the first model, the query request being used to query the processing result of the first model in response to the code generation request and / or the running status of the first model; receive the query result sent by the first model, and determine whether to adjust the calling operation on the first model based on the query result.

[0326] The processing result can be either "Processing in progress" or "Processing complete". "Processing in progress" indicates that the first model has not yet generated the result file corresponding to the code generation request; "Processing complete" indicates that the first model has successfully generated the result file.

[0327] If the processing result of the code generation request is "processed," and there are still unprocessed class methods in the method list, the computing device can continue to send code generation requests for the unprocessed class methods to the first model. If the processing result of the code generation request is "processing," the computing device can wait for the code generation request to complete before continuing to send code generation requests for the unprocessed class methods to the first model.

[0328] The first model can operate in the following states: high load, stable operation, or low load.

[0329] If the first model is running under high load, the computing device can pause calls to the first model to prevent it from failing to process code generation requests. If the first model is running under stable load or low load, the computing device can continue to send code generation requests for unprocessed class methods to the first model after the code generation request has been processed, to ensure that the code generation requests for unprocessed class methods can be processed normally by the first model.

[0330] If the processing result of the generation request is that the processing is complete and the running state of the first model is in a high-load state, and there are still unprocessed class methods in the method list, the computing device can wait for a while until the running state of the first model is in a stable running state or a low-load state, and then send the code generation request corresponding to the unprocessed class method to the first model. This ensures that the first model can process the code generation request corresponding to the unprocessed class method normally, which helps to ensure the integrity and accuracy of the test file generated from the initial code information.

[0331] In this method, after sending a code generation request to the first model, the processing result of the code generation request and / or the running status of the first model are queried from the first model. Based on the query result returned by the first model, the call operation to the first model is adjusted in a timely manner to ensure that the code generation request corresponding to the class method and the code generation request corresponding to the class method to be sent later can be processed normally by the first model. This helps to ensure the integrity and accuracy of the test file generated from the initial code information.

[0332] S804. Receive the result files corresponding to various methods output by the first model and obtain at least one result file.

[0333] For example, the resulting file can be a Java class file (or a string containing a Java class file).

[0334] After receiving at least one result file, the computing device (or AI-assisted plugin) can parse and process at least one result file.

[0335] For example, the parsing process of a computing device (or AI-assisted plugin) may include: extracting class names from each result file; extracting at least one field annotation identifier corresponding to an annotation field in the result file according to field extraction rules; and extracting the method annotation identifier corresponding to a test method in the result file according to method extraction rules.

[0336] The test file generation method provided in this application can determine the calling interface information of the first model used to execute the test file generation based on the model identifier in the test requirement field, and generate the model input parameters corresponding to various methods in the first model based on the test requirement field and various methods. Thus, the computing device (or AI-assisted plugin) can call the first model in batches based on the calling interface information and the model input parameters of various methods, which helps improve the interface response speed of the first model, reduce the request pressure on the interface of the first model, and improve the code generation efficiency of the first model. In this method, by splitting the initial code information, long or complex code can be broken down into smaller units of class method sub-code information. Furthermore, by calling the first model in batches, the processor's memory requirements for a single call to the first model can be reduced, avoiding processor memory overflow, and eliminating the need for a high-configuration server, which helps reduce processing costs.

[0337] Figure 9 This is a flowchart illustrating the test file generation method provided in this application embodiment, which can be applied to, for example... Figure 1 In the computing device shown. Please see Figure 9 The method may include the following steps:

[0338] S901. Determine whether the test file meets the user's testing requirements.

[0339] The computing device (or AI-assisted plugin) can display the test file in the service interface. Users can view the service interface through the computing device or terminal and determine whether the test file meets their testing needs.

[0340] S902. If the test file does not meet the test requirements, obtain the user's input switching instruction, update the first model to the second model among multiple candidate models based on the switching instruction, process various methods in the method list through the second model according to the test requirements field, obtain at least one updated result file, and determine the updated test file corresponding to the initial code information based on at least one updated result file.

[0341] If the test file does not meet the test requirements, the user can trigger a switching command in the service interface through a computing device or terminal. The computing device (or AI-assisted plugin) can respond to the switching command and update the first model to the second model.

[0342] It should be noted that the process of "processing various methods in the method list according to the test requirement field through the second model to obtain at least one updated result file, and determining the updated test file corresponding to the initial code information according to at least one updated result file" can refer to the process of "processing various methods in the method list according to the test requirement field through the first model to obtain at least one result file, and determining the test file corresponding to the initial code information according to at least one result file" in the above embodiment, and will not be repeated here.

[0343] For example, suppose that the multiple candidate models include: a general large language model 1, a general large language model 2, an optimized large language model, and a text embedding model. The first model can be the general large language model 1, and the second model can be the general large language model 2 or the optimized large language model, which have better prediction performance.

[0344] The test file generation method provided in this application can obtain complete and accurate test code corresponding to the initial code information, which helps to ensure the integrity and accuracy of the test code in the test file. Furthermore, after obtaining the test file, the method can also determine whether the test file meets the user's testing requirements. If it does not meet the user's testing requirements, the method can switch models to regenerate an updated test file corresponding to the initial code information, making the method more flexible in generating test files.

[0345] Figure 10 This is a schematic diagram of a test document generation device provided in an embodiment of this application. Please refer to [link / reference]. Figure 10 Test document generation device 10, including:

[0346] Module 11 is used to obtain code generation requests, which are used to request the generation of test files corresponding to the initial code information.

[0347] Processing module 12 is used to split the initial code information to obtain test requirement fields and a method list. The test requirement fields are used to indicate the code generation requirements corresponding to the initial code information, and the method list includes at least one class method.

[0348] Processing module 12 is also used to process various methods in the method list according to the test requirement field through the first model to obtain at least one result file;

[0349] The processing module 12 is also used to extract multiple test information from at least one result file and merge the multiple test information to obtain a test file.

[0350] The test file generation apparatus provided in this application embodiment can execute the technical solution shown in the above method embodiment, and its beneficial effects are similar, so they will not be described again here. The processing module 12 can be used to execute the content executed by the request preprocessing module, AI service module, and AI result module in the above embodiments.

[0351] In one possible implementation, the processing module 12 is specifically used for:

[0352] Based on the field parsing rules, test requirement fields are extracted from the initial code information. The field parsing rules include access modifiers and format constraints.

[0353] The initial code information is split to obtain at least one sub-code information. Based on the syntax structure rules, at least one class method is extracted from the at least one sub-code information. A method list is generated based on the at least one class method. The syntax structure rules are used to indicate the extraction of class methods according to the structural features of modifiers, return values, method names, method parameters, and method bodies.

[0354] In one possible implementation, the processing module 12 is further configured to be used in one of the following ways:

[0355] If the initial code information includes code snippets, the code snippets are split into sub-code information by class methods; or...

[0356] If the initial code information includes a file, extract at least one code fragment from the file, and split the at least one code fragment into at least one sub-code information by using class methods as the splitting unit; or...

[0357] If the initial code information includes a directory, the files in the directory are traversed to extract code fragments from each file. The code fragments in each file are then split using class methods as the splitting unit to obtain at least one sub-code information.

[0358] In one possible implementation, the multiple test information includes a class name, annotation fields, and a test method corresponding to at least one class method; the processing module 12 is specifically used for:

[0359] Extract multiple test information entries from at least one result file, and merge the multiple test information entries to obtain a test file, including:

[0360] If there is only one class method, extract the class name from the result file corresponding to the class method, and extract the annotation field corresponding to at least one field annotation and the test method corresponding to the method annotation from the result file. Then, merge the class name, the annotation field corresponding to at least one field annotation, and the test method to obtain the test file.

[0361] If there are multiple class methods, for multiple result files corresponding to multiple class methods, extract the class name from each result file, and extract at least one annotation field corresponding to at least one field annotation and at least one test method corresponding to at least one method annotation from each result file. Then, perform deduplication and merging on the class name, at least one field annotation corresponding to at least one field annotation, and at least one test method extracted from multiple result files to obtain the test file.

[0362] Among them, the class name is used to indicate the test type corresponding to the result file; the field annotation identifier is used to locate the annotation field in the result file; and the method annotation identifier is used to locate the test method in the result file.

[0363] In one possible implementation, the processing module 12 is further configured to:

[0364] Based on the field extraction rules, extract at least one annotation field corresponding to a field annotation identifier from the result file; the field extraction rules are used to indicate the following extraction parameters: at least one field annotation identifier, the field matching rule type used, and the field extraction boundary, where the field matching rule type includes regular expression type;

[0365] According to the method extraction rules, the test methods corresponding to the method annotation identifiers are extracted from the result file. The method extraction rules are used to indicate the following extraction parameters: method annotation identifier, method extraction boundary, and method extraction structure. The method extraction structure includes modifiers, return values, method names, method parameters, and method bodies.

[0366] In one possible implementation, the test method includes an identifier for the class method; the processing module 12 is further configured to:

[0367] The class names extracted from multiple result files are deduplicated and merged to obtain the class names corresponding to the initial code information;

[0368] For at least one field annotation identifier extracted from multiple result files, the corresponding annotation field is deduplicated and merged according to the field annotation identifier to obtain the annotation field corresponding to the initial code information;

[0369] Based on the order of multiple class methods in the initial code information, at least one test method extracted from multiple result files is deduplicated and merged according to the identifier of the class method to obtain the test method corresponding to the initial code information;

[0370] The class names, annotation fields, and test methods corresponding to the initial code information are merged to obtain the test file.

[0371] In one possible implementation, the processing module 12 is further configured to:

[0372] Based on the model identifier in the test requirements field, determine the first model from multiple candidate models and obtain the call interface information of the first model;

[0373] Based on the test requirement fields and various methods, generate the corresponding model input parameters for each method in the first model;

[0374] Based on the API call information, send code generation requests for each type of method in the method list to the first model. The code generation requests include the model input parameters for the corresponding class methods.

[0375] Receive the result files corresponding to various methods output by the first model, and obtain at least one result file.

[0376] In one possible implementation, after sending the code generation request corresponding to the class method to the first model, the processing module 12 is further configured to:

[0377] Send a query request to the first model. The query request is used to query the processing result of the first model in response to the code generation request and / or the running status of the first model.

[0378] Receive the query results sent by the first model, and determine whether to adjust the call operation on the first model based on the query results.

[0379] In one possible implementation, after obtaining the test file, the processing module 12 is further configured to:

[0380] Determine whether the test files meet the user's testing requirements;

[0381] If the test file does not meet the test requirements, obtain the user's input switching instruction, update the first model to the second model among multiple candidate models based on the switching instruction, process various methods in the method list through the second model according to the test requirements field, obtain at least one updated result file, and determine the updated test file corresponding to the initial code information based on at least one updated result file.

[0382] Figure 11 This is a schematic diagram of the hardware structure of a computing device provided in an embodiment of this application. Please refer to [link / reference]. Figure 11 The computing device 20 can be the computing device in the above method embodiments. The computing device 20 may include a processor 21 and a memory 22, which are coupled together. The processor 21 and the memory 22 can communicate; for example, the processor 21 and the memory 22 communicate via a communication bus 23.

[0383] Memory 22 is used to store program instructions;

[0384] The processor 21 is used to execute program instructions to perform the technical solution as shown in the above method embodiments.

[0385] Optionally, the computing device 20 may also include a communication interface, which may include a transmitter and / or a receiver.

[0386] Optionally, the processor mentioned above can be a CPU, or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.

[0387] This application provides a computer-readable storage medium storing computer-executable instructions; when executed by a processor, the computer-executable instructions are used to implement the test file generation method shown in the above embodiments.

[0388] This application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it causes the computer to perform the test file generation method shown in the above embodiment.

[0389] All or part of the steps in the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above-described method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof.

[0390] This application describes embodiments of methods, apparatus (systems), and computer program products according to embodiments of this application with reference to flowchart illustrations and / or block diagrams. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable device, generate instructions for implementing the flowchart illustrations. Figure 1One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0391] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0392] These computer program instructions may also be loaded onto a computer or other programmable device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0393] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of this application, and are not intended to limit them. Although the embodiments of this application have been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A method for generating test files, characterized in that, include: Obtain a code generation request, which is used to request the generation of a test file corresponding to the initial code information; The initial code information is split to obtain test requirement fields and a method list. The test requirement fields are used to indicate the code generation requirements corresponding to the initial code information, and the method list includes at least one class method. Based on the test requirement fields, the methods in the method list are processed using the first model to obtain at least one result file; Multiple test information items are extracted from the at least one result file, and the multiple test information items are merged to obtain the test file.

2. The test file generation method according to claim 1, characterized in that, The initial code information is split to obtain a list of test requirement fields and methods, including: According to the field parsing rules, the test requirement fields are extracted from the initial code information. The field parsing rules include access modifiers and format constraints. The initial code information is split to obtain at least one sub-code information, and at least one class method is extracted from the at least one sub-code information according to the syntax structure rules, and the method list is generated based on the at least one class method. The syntax structure rules are used to indicate the extraction of class methods according to the structural features of modifiers, return values, method names, method parameters and method bodies.

3. The test file generation method according to claim 2, characterized in that, The initial code information is split to obtain at least one sub-code information, including one of the following: If the initial code information includes code fragments, the code fragments are split into class methods as the splitting unit to obtain at least one sub-code information; or, If the initial code information includes a file, at least one code fragment is extracted from the file, and the at least one code fragment is split into at least one sub-code information by using class methods as the splitting unit; or, If the initial code information includes a directory, the files in the directory are traversed to extract code fragments from each file, and the code fragments in each file are split using class methods as the splitting unit to obtain at least one sub-code information.

4. The test file generation method according to any one of claims 1-3, characterized in that, The multiple test information includes class name, annotation fields, and test methods corresponding to at least one class method; Extracting multiple test information items from the at least one result file and merging the multiple test information items to obtain the test file includes: If the number of class methods is one, extract the class name from the result file corresponding to the class method, and extract at least one field annotation identifier corresponding to the annotation field and the method annotation identifier corresponding to the test method from the result file. Then, merge the class name, the annotation field corresponding to the at least one field annotation identifier and the test method to obtain the test file. If there are multiple class methods, for multiple result files corresponding to multiple class methods, extract the class name from each result file, and extract the annotation field corresponding to the at least one field annotation identifier and the at least one test method corresponding to the method annotation identifier from each result file. Then, perform deduplication and merging processing on the class name, the annotation field corresponding to the at least one field annotation identifier, and the at least one test method extracted from the multiple result files to obtain the test file. The class name is used to indicate the test type corresponding to the result file; the field annotation identifier is used to locate the annotation field in the result file; and the method annotation identifier is used to locate the test method in the result file.

5. The test file generation method according to claim 4, characterized in that, Extract at least one annotation field corresponding to a field annotation identifier and a test method corresponding to a method annotation identifier from the result file, including: According to the field extraction rules, the annotation fields corresponding to the at least one field annotation identifier are extracted from the result file; the field extraction rules are used to indicate the following extraction parameters: the at least one field annotation identifier, the field matching rule type used, and the field extraction boundary, wherein the field matching rule type includes regular expression type; According to the method extraction rules, the test methods corresponding to the method annotation identifiers are extracted from the result file; the method extraction rules are used to indicate the following extraction parameters: the method annotation identifier, the method extraction boundary, and the method extraction structure; the method extraction structure includes modifiers, return values, method names, method parameters, and method bodies.

6. The test file generation method according to claim 4 or 5, characterized in that, The test method includes class method identifiers; the class names extracted from the multiple result files, the annotation fields corresponding to the at least one field annotation identifier, and the at least one test method are subjected to deduplication and merging processing, including: The class names extracted from the multiple result files are deduplicated and merged to obtain the class names corresponding to the initial code information; The annotation fields corresponding to the at least one field annotation identifier extracted from the multiple result files are deduplicated and merged according to the field annotation identifier to obtain the annotation fields corresponding to the initial code information; Based on the order of multiple class methods in the initial code information, at least one test method extracted from the multiple result files is deduplicated and merged according to the identifier of the class method to obtain the test method corresponding to the initial code information; The class name, annotation fields, and test methods corresponding to the initial code information are merged to obtain the test file.

7. The test file generation method according to any one of claims 1-6, characterized in that, Based on the test requirement fields, the methods in the method list are processed using the first model to obtain at least one result file, including: Based on the model identifier in the test requirement field, the first model is determined from multiple candidate models, and the call interface information of the first model is obtained; Based on the test requirement fields and various methods, generate the corresponding model input parameters for each method in the first model; Based on the API call information, send code generation requests corresponding to various methods in the method list to the first model. The code generation requests include model input parameters for the corresponding class methods. Receive the result files corresponding to various methods output by the first model to obtain at least one result file.

8. The test file generation method according to claim 7, characterized in that, After sending the code generation request corresponding to the class method to the first model, the test file generation method further includes: Send a query request to the first model, the query request being used to query the processing result of the first model in response to the code generation request and / or the running status of the first model; Receive the query result sent by the first model, and determine whether to adjust the calling operation of the first model based on the query result.

9. The test file generation method according to any one of claims 1-8, characterized in that, After obtaining the test file, the test file generation method further includes: Determine whether the test file meets the user's testing requirements; If the test file does not meet the test requirements, the user input switching instruction is obtained, and the first model is updated to the second model among multiple candidate models based on the switching instruction. According to the test requirements field, the second model is used to process various methods in the method list to obtain at least one updated result file. Based on the at least one updated result file, the updated test file corresponding to the initial code information is determined.

10. A computing device, characterized in that, include: Processor and memory; The processor and the memory are coupled; The memory is used to store program instructions; The processor is used to execute the program instructions to implement the test file generation method as described in any one of claims 1 to 9.