White box unit test generation method and device based on code large model Agent
Through the white box unit test generation method based on the code big model Agent, combined with the compilation validator and code repair model, the problems of insufficient semantic consistency and low coverage of unit test case generation in the existing technology are solved, and an efficient and automated test case generation and repair process is realized.
Patent Information
- Application Number
- CN202510186910.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art has insufficient semantic consistency, low code coverage and lack of automatic repair and feedback mechanisms when generating unit test cases, resulting in inefficiency.
A white box unit test generation method based on the code big model Agent is used to generate candidate test cases through the code big model, and a compilation validator and code repair model is combined for verification and repair, forming a closed-loop process to improve the quality and efficiency of test cases.
It significantly improves the semantic correlation and coverage of test cases, reduces manual intervention, improves the execution success rate of test cases, and realizes closed-loop automation of test case generation.
Smart Images

Figure CN119883868A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of code testing, and in particular to a method and device for generating white box unit tests based on a large code model Agent. Background Art
[0002] With the continuous expansion of software development scale and the continuous increase in complexity, code testing has become an important part of ensuring software quality, especially unit testing. High-quality unit testing can detect potential defects as early as possible and reduce the risk of problems in code operation by designing test cases with high coverage. Traditional unit test case generation methods often rely on manual writing or automatic generation by tools, which have many limitations. Traditional tools (such as Evosuite, Randoop, and Agitar) rely on program analysis to generate test cases, which improves code coverage to a certain extent, but the generation effect of these tools is often not ideal. The generated test cases may lack semantic consistency, and variable names and method calls often do not match the actual business logic, which increases the understanding and maintenance costs of developers. In addition, these methods do not cover the boundary conditions and logical branches of the code sufficiently, resulting in the inability to effectively capture potential defects.
[0003] In recent years, code generation technology based on large language models (such as AthenaTest, A3Test, CAL-LM, etc.) has brought new breakthroughs in software testing. Large language models can understand the structure and function of the code and automatically generate test cases, thereby reducing the manual writing work of developers. However, the current generation methods still have problems with execution correctness and insufficient code coverage. In particular, when the test case encounters a compilation error or fails to run during execution, the existing methods lack automatic repair and feedback mechanisms and still rely on manual intervention, resulting in reduced efficiency. Summary of the invention
[0004] The present invention overcomes the shortcomings of the prior art and provides a white box unit test generation method and device based on a large code model Agent.
[0005] To achieve the above object, the technical solution adopted by the present invention is:
[0006] The first aspect of the present invention provides a white box unit test generation method based on a code big model Agent, comprising the following steps:
[0007] Obtaining a code file to be tested, and introducing a code model agent, processing the code file to be tested by the code model agent, and generating candidate test cases;
[0008] Introducing a compilation verifier, inputting the candidate test cases into the compilation verifier for verification, obtaining test cases and error logs that failed the verification and test cases that passed the verification;
[0009] Constructing a code repair model, inputting the test cases and error logs that have not passed the verification into the code repair model for repair, obtaining the repaired test cases that have not passed the verification and the repaired test cases that have passed the verification;
[0010] The repaired test cases and the verified test cases are tested, all test results are summarized, a test report is generated, and the test report is output.
[0011] Furthermore, in the white-box unit test generation method based on the code big model Agent, the code file to be tested is obtained, and the code big model Agent is introduced, and the code big model Agent is used to process the code file to be tested to generate candidate test cases, specifically:
[0012] Obtaining a code file to be tested; the code file includes function or method definition, variable declaration, and context logic;
[0013] Analyze the structure of the code file to be tested by a code parsing tool to extract key information; the key information includes method signature, parameter type, variable name and return value type;
[0014] Based on the extracted key information, the prompt generator constructs context prompt information according to a predefined template, introduces the code model Agent, and takes the code file to be tested and the context prompt information as input into the code model Agent;
[0015] The code model agent generates candidate test cases in combination with the context prompt information, and outputs the candidate test cases.
[0016] Furthermore, in the white-box unit test generation method based on the code big model Agent, a compile verifier is introduced, the candidate test cases are input into the compile verifier for verification, and the test cases and error logs that fail the verification and the test cases that pass the verification are obtained, specifically including:
[0017] Introducing a compilation verifier, inputting the candidate test case into the compilation verifier for syntax and semantic checking, obtaining a compiled test case, and performing static analysis on the compiled test case to determine whether the test case passes verification;
[0018] When the test case passes the verification, the passed test case is marked as executable, the verified test case is obtained, and the verified test case is output;
[0019] When the test case fails to pass the verification, the error information of the test case that failed the verification is obtained, and the test case and error log that failed the verification are generated, and the test case and error log that failed the verification are output;
[0020] Furthermore, in the white-box unit test generation method based on the code big model Agent, a code repair model is constructed, the test cases and error logs that have not passed the verification are input into the code repair model for repair, and the test cases that have not passed the verification are repaired and the test cases that have passed the verification are repaired, which specifically includes:
[0021] Construct a code repair model, input the test cases and error logs that have not passed the verification into the code repair model, perform error analysis, and the code repair model parses the error information returned by the compiler and identifies the specific problem in combination with the original test cases;
[0022] By automatically repairing specific problems and using the generation capability of the code model, revised test cases are regenerated based on error information. Successfully repaired test cases are marked as executable, and the repaired test cases that have passed verification are obtained and output;
[0023] The test cases that cannot be repaired are recorded in the error log, and the test cases whose repairs fail to pass the verification are obtained and output.
[0024] Furthermore, in the white-box unit test generation method based on the code big model Agent, the test cases that have passed the verification of the repair and the test cases that have passed the verification are tested, all test results are summarized, a test report is generated, and the test report is output, which specifically includes:
[0025] Testing the test cases that have passed the verification of the repair and the test cases that have passed the verification, summarizing all test results, and inputting the executable test cases that have passed the verification into the test executor;
[0026] Load the test framework. The test executor loads the test cases into the corresponding test framework, runs the tests, and records the test results. During the test execution, the indicator data of each test case is recorded.
[0027] The coverage tool is used to calculate the verified test cases and the coverage of the code by the verified test cases. The test executor summarizes all test results, generates a test report, and outputs the test report.
[0028] The second aspect of the present invention provides a white box unit test generation device based on a code big model Agent, comprising:
[0029] A test generation module is used to obtain a code file to be tested, introduce a code model Agent, process the code file to be tested through the code model Agent, and generate candidate test cases;
[0030] A test verification module is used to introduce a compilation verifier, input the candidate test cases into the compilation verifier for verification, and obtain test cases and error logs that have not passed the verification and test cases that have passed the verification;
[0031] A test repair module is used to build a code repair model, input the test cases and error logs that have not passed the verification into the code repair model for repair, obtain and repair the test cases that have not passed the verification and repair the test cases that have passed the verification;
[0032] The test execution module is used to test the test cases that have passed the repair verification and the test cases that have passed the verification, summarize all test results, generate a test report, and output the test report.
[0033] The third aspect of the present invention provides a computer-readable storage medium, including a white-box unit test generation method program based on a large code model Agent. When the white-box unit test generation method program based on a large code model Agent is executed by a processor, any step of the white-box unit test generation method based on a large code model Agent is implemented.
[0034] The present invention solves the defects existing in the background technology and has the following beneficial effects:
[0035] The present invention adopts the technical means of collaborative work between the prompt generator and the code big model, and dynamically generates adaptive high-quality prompt text by parsing the context information of the code to be tested (such as method signatures, variable types, etc.), guiding the code big model to generate test cases that are closer to the actual business logic. Compared with the method of relying on static templates or manual prompts in the prior art, the dynamic prompt mechanism of the present invention significantly improves the semantic relevance and accuracy of the generation, avoids the problem of disconnection between test cases and code logic, and generates higher quality and stronger semantic relevance.
[0036] The present invention constructs a closed-loop process from test case generation to verification and repair by integrating a compilation verifier and a code repair model. Test cases that fail verification can be automatically repaired and re-verified until the execution requirements are met. This automatic repair mechanism effectively reduces manual intervention, while most existing technologies rely on manual repair by developers, which is inefficient. The closed-loop design of the present invention significantly improves the execution success rate of test cases by combining error log analysis and the repair capabilities of a large language model, and realizes closed-loop automation of test case generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, drawings of other embodiments can be obtained based on these drawings without paying creative work.
[0038] Figure 1 It is the overall framework diagram of the white box unit test generation method and device based on the code big model Agent;
[0039] Figure 2 Compile and verify the module graph for testing;
[0040] Figure 3 Verify the module diagram for testing;
[0041] Figure 4 Repair module graph for testing based on code repair model;
[0042] Figure 5 This is the module diagram for test execution and result feedback. DETAILED DESCRIPTION
[0043] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0044] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0045] like Figure 1 As shown, the second aspect of the present invention provides a white box unit test generation device based on a code big model Agent, comprising:
[0046] A test generation module is used to obtain a code file to be tested, introduce a code model Agent, process the code file to be tested through the code model Agent, and generate candidate test cases;
[0047] A test verification module is used to introduce a compilation verifier, input the candidate test cases into the compilation verifier for verification, and obtain test cases and error logs that have not passed the verification and test cases that have passed the verification;
[0048] A test repair module is used to build a code repair model, input the test cases and error logs that have not passed the verification into the code repair model for repair, obtain and repair the test cases that have not passed the verification and repair the test cases that have passed the verification;
[0049] The test execution module is used to test the test cases that have passed the repair verification and the test cases that have passed the verification, summarize all test results, generate a test report, and output the test report.
[0050] The purpose of the present invention is to provide an efficient, intelligent and more automated test case generation method to make up for the shortcomings of traditional methods and methods based on large language models. The present invention aims to build a complete automated closed-loop system from test case generation to verification and repair by combining a prompt generator, a large code model and a code repair model, thereby improving generation efficiency, coverage and execution correctness.
[0051] Specifically, the present invention improves prompt generation and sample design, so that the large language model can generate test cases that are closer to business logic, solving the problem of insufficient semantics in existing methods. At the same time, the present invention integrates a compilation verifier and a code repair model to automatically handle syntax errors, semantic logic errors, or operational failures that may exist in test cases after generation, thereby significantly reducing the need for manual intervention and enhancing the degree of automation of the test process. In addition, by optimizing prompt templates and sample guidance, the coverage of generated test cases is improved, especially in the exploration of complex logic and boundary conditions, to achieve comprehensive coverage of key code paths.
[0052] In summary, the goal of the present invention is to overcome the limitations of the prior art in terms of generation quality, coverage and degree of automation, and to provide an efficient and reliable solution for the generation and execution of unit test cases through integrated design and closed-loop optimization process.
[0053] The present invention provides a complete technical solution for test case generation, verification, repair and execution based on a prompt generator, a large code model, a compilation verifier and a code repair model. Figure 1The core steps and functional modules of the present invention are described in detail to ensure that the design and implementation of each link can be fully understood. The system of the present invention consists of four core modules: test generation, test verification, test repair and test execution. The system framework is shown in the attached figure. Figure 1 As shown, its workflow includes:
[0054] Step 1: Obtain the code file to be tested, and introduce the code model agent, and process the code file to be tested through the code model agent to generate candidate test cases;
[0055] In this step, if Figure 2 As shown, the developer or test engineer uploads the code file to be tested to the system. The code file usually includes function or method definition, variable declaration and context logic. The prompt generator analyzes the structure of the code to be tested through a code parsing tool (such as JavaParser) to extract key information, including method signature, parameter type, variable name and return value type. Based on the extracted information, the prompt generator constructs prompt words according to predefined templates. These prompt words not only describe the function of the code, but also guide the code big model to generate test cases. The generated context prompts are taken as input together with the code file to be tested and enter the code big model Agent. The code big model will combine the prompt information in the prompt words to generate a variety of test cases to ensure that the test coverage can cover common scenarios and extreme conditions. The candidate test cases generated are then stored and passed to the test verification module.
[0056] Step 2: Introduce a compilation verifier, input the candidate test cases into the compilation verifier for verification, and obtain test cases and error logs that have not passed the verification and test cases that have passed the verification;
[0057] In this step, if Figure 3 As shown, the candidate test cases generated by the code model are input into the compilation verifier. The first step is to perform compilation checking. The compilation verifier inputs the test cases into the compiler of the target language (such as javac, gcc or pylint) to check whether the syntax and semantics are correct. The second step is to perform static analysis on the compiled test cases to ensure the correctness of the method call logic and parameter passing. For example, check whether the parameter type of the method matches the actual input and whether the return value meets expectations. The third step is classification. The test cases that pass the verification are marked as executable; the test cases that fail the verification record error information and send it to the code repair model together with the test case itself.
[0058] Step 3: Construct a code repair model, input the test cases and error logs that have not passed the verification into the code repair model for repair, obtain the test cases that have not passed the verification and the test cases that have passed the verification;
[0059] In this step, if Figure 4 As shown in the figure, the test cases and error logs that failed the verification are input into the code repair model. The first step is error analysis. The code repair model parses the error information returned by the compiler and identifies specific problems in combination with the original test cases, such as syntax errors, improper method calls, or incorrect parameter settings. The second step is automatic repair. The generation capability of the code large model is used to regenerate revised test cases based on the error information. For example, for a function call with missing parameters, the repair model adds the missing parameters and adjusts the context. Test cases that are successfully repaired are marked as executable; test cases that cannot be repaired are recorded in the error log for manual analysis.
[0060] Step 4: Test the test cases that have passed the repair verification and the test cases that have passed the verification, summarize all test results, generate a test report, and output the test report.
[0061] In this step, if Figure 5 As shown in the figure, the verified executable test cases are input into the test executor. The first step is to load the test framework. The test executor loads the test cases into the corresponding test framework (such as JUnit, Pytest, TestNG) and runs the test. The second step is to record the test results. During the test execution, the execution status (pass or fail), running time, memory usage and other indicators of each test case are recorded. The third step is coverage analysis. Coverage tools (such as Jacoco) are used to calculate the coverage of the test cases on the code, including bytecode instruction coverage and branch coverage. The third step is report generation. The test executor summarizes all test results and generates a complete test report. The report includes a list of test cases, running results, coverage analysis and error information. Finally, the generated test report is sent to the test engineer as a basis for code quality assessment and troubleshooting.
[0062] Through the above technical solution, the present invention realizes the automation of the entire process from test case generation, verification, repair to execution, greatly improves the test efficiency and coverage, reduces manual intervention, and provides reliable support for software quality assurance.
[0063] It should be noted that the present invention adopts the technical means of prompt generator and code big model to work together, and dynamically generates high-quality prompt text adapted by parsing the context information of the code to be tested (such as method signature, variable type, etc.), and guides the code big model to generate test cases that are closer to the actual business logic. Compared with the method of relying on static templates or manual prompts in the prior art, the dynamic prompt mechanism of the present invention significantly improves the semantic relevance and accuracy of the generation, and avoids the problem of disconnection between the test case and the code logic. The present invention constructs a closed-loop process from test case generation to verification and repair by integrating the compilation verifier and the code repair model. Test cases that fail to pass the verification can be automatically repaired and re-verified until the execution requirements are met. This automatic repair mechanism effectively reduces manual intervention, while the prior art mostly relies on manual repair by developers, which is inefficient. The closed-loop design of the present invention significantly improves the execution success rate of test cases by combining error log analysis and the repair capability of the large language model.
[0064] The present invention is based on the collaborative generation mechanism of the prompt generator and the code big model: the present invention generates targeted contextual prompts through the prompt generator, and generates high-quality candidate test cases in combination with the code big model. The prompt generator optimizes the generation capability of the code big model, especially in improving the semantic relevance and logical accuracy of the test case, which is significantly better than the prior art. The prompt generator of the present invention dynamically adapts the code to be tested, improves the semantic relevance and generation accuracy of the test case, while the prior art has limited ability in prompt optimization and is prone to generate test cases that are out of touch with the actual business. Secondly, compilation verification and automatic repair closed loop: the present invention integrates the compilation verifier and the code repair model, which can automatically capture grammatical or semantic errors in the test case and perform adaptive repair through the repair model. This closed-loop design significantly reduces the reliance on manual intervention, improves the pass rate and executability of the test case, and is a function that is less implemented in the prior art. The present invention realizes an automatic repair closed loop after verification failure through the repair model, while the prior art relies on manual error handling after the test case is generated, which is inefficient.
[0065] On the other hand, the present invention provides a computer-readable storage medium, including a white-box unit test generation method program based on a large code model Agent. When the white-box unit test generation method program based on a large code model Agent is executed by a processor, any step of the white-box unit test generation method based on a large code model Agent is implemented.
[0066] In addition, the method further comprises:
[0067] Obtain historical abnormal vulnerability feature data of each test code through big data, and build a vulnerability feature database based on the historical abnormal vulnerability feature data of each test code, and obtain the test cases that have been verified and repaired;
[0068] Input the test cases whose repairs have been verified and the test cases that have passed verification into the vulnerability feature database for data judgment, and judge whether there are vulnerabilities in the test cases whose repairs have been verified and the test cases that have passed verification;
[0069] Introducing a genetic algorithm, setting a genetic generation based on the genetic algorithm, and obtaining a location of the vulnerability when there is a vulnerability in the verified test case and the verified test case of the repair;
[0070] Obtain the historical repair code of each vulnerability feature data, randomly select a historical repair code to reset the code at the location where the vulnerability exists, and obtain the test cases that have passed the verification of the reset repair and the test cases that have passed the verification;
[0071] When the reset repair passes the verified test cases and the verified test cases have vulnerabilities, inheritance is performed based on the genetic generation number, and the historical repair code is reconfigured until the repair passes the verified test cases and the verified test cases have no vulnerabilities.
[0072] It should be noted that since correct code may also have certain vulnerabilities, this method can further discover the abnormal vulnerability characteristics of each test code, and can further optimize the code data to be tested, improve the rationality of the repair, and reduce the occurrence of vulnerabilities.
[0073] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0074] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0075] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0076] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiments; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks or optical disks, and other media that can store program codes.
[0077] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0078] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A white box unit test generation method based on a large code model Agent, characterized in that: The following steps are involved: Obtaining a code file to be tested, and introducing a code model agent, processing the code file to be tested by the code model agent, and generating candidate test cases; Introducing a compilation verifier, inputting the candidate test cases into the compilation verifier for verification, obtaining test cases and error logs that failed the verification and test cases that passed the verification; Constructing a code repair model, inputting the test cases and error logs that have not passed the verification into the code repair model for repair, obtaining the repaired test cases that have not passed the verification and the repaired test cases that have passed the verification; The repaired test cases and the verified test cases are tested, all test results are summarized, a test report is generated, and the test report is output.
2. The method for generating white-box unit tests based on a large code model Agent according to claim 1, characterized in that: Obtain the code file to be tested, and introduce the code model agent, process the code file to be tested through the code model agent, and generate candidate test cases, specifically: Obtaining a code file to be tested; the code file includes function or method definition, variable declaration, and context logic; Analyze the structure of the code file to be tested by a code parsing tool to extract key information; the key information includes method signature, parameter type, variable name and return value type; Based on the extracted key information, the prompt generator constructs context prompt information according to a predefined template, introduces the code model Agent, and takes the code file to be tested and the context prompt information as input into the code model Agent; The code model agent generates candidate test cases in combination with the context prompt information, and outputs the candidate test cases.
3. The method for generating white-box unit tests based on a large code model Agent according to claim 1, characterized in that: Introducing a compilation verifier, inputting the candidate test cases into the compilation verifier for verification, obtaining test cases and error logs that failed verification and test cases that passed verification, specifically including: Introducing a compilation verifier, inputting the candidate test case into the compilation verifier for syntax and semantic checking, obtaining a compiled test case, and performing static analysis on the compiled test case to determine whether the test case passes verification; When the test case passes the verification, the passed test case is marked as executable, the verified test case is obtained, and the verified test case is output; When the test case fails to pass the verification, the error information of the test case that failed the verification is obtained, and the test case that failed the verification and the error log are generated, and the test case that failed the verification and the error log are output.
4. The method for generating white-box unit tests based on a large code model Agent according to claim 1, characterized in that: Constructing a code repair model, inputting the test cases and error logs that failed verification into the code repair model for repair, obtaining and repairing the test cases that failed verification and repairing the test cases that passed verification, specifically including: Construct a code repair model, input the test cases and error logs that have not passed the verification into the code repair model, perform error analysis, and the code repair model parses the error information returned by the compiler and identifies the specific problem in combination with the original test cases; By automatically repairing specific problems and using the generation capability of the code model, revised test cases are regenerated based on error information. Successfully repaired test cases are marked as executable, and the repaired test cases that have passed verification are obtained and output; The test cases that cannot be repaired are recorded in the error log, and the test cases whose repairs fail to pass the verification are obtained and output.
5. The method for generating white-box unit tests based on a large code model Agent according to claim 1, characterized in that: Testing the test cases that have passed the verification and the test cases that have passed the verification, summarizing all test results, generating a test report, and outputting the test report, specifically including: Testing the test cases that have passed the verification of the repair and the test cases that have passed the verification, summarizing all test results, and inputting the executable test cases that have passed the verification into the test executor; Load the test framework. The test executor loads the test cases into the corresponding test framework, runs the tests, and records the test results. During the test execution, the indicator data of each test case is recorded. The coverage tool is used to calculate the verified test cases and the coverage of the code by the verified test cases. The test executor summarizes all test results, generates a test report, and outputs the test report.
6. A white box unit test generation device based on a large code model Agent, characterized in that: include: A test generation module is used to obtain a code file to be tested, introduce a code model Agent, process the code file to be tested through the code model Agent, and generate candidate test cases; A test verification module is used to introduce a compilation verifier, input the candidate test cases into the compilation verifier for verification, and obtain test cases and error logs that have not passed the verification and test cases that have passed the verification; A test repair module is used to build a code repair model, input the test cases and error logs that have not passed the verification into the code repair model for repair, obtain and repair the test cases that have not passed the verification and repair the test cases that have passed the verification; The test execution module is used to test the test cases that have passed the repair verification and the test cases that have passed the verification, summarize all test results, generate a test report, and output the test report.
7. A computer-readable storage medium, characterized in that: It includes a white-box unit test generation method program based on a large code model Agent. When the white-box unit test generation method program based on a large code model Agent is executed by a processor, the steps of the white-box unit test generation method based on a large code model Agent as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Test case verification method and device, computer equipment and storage medium
CN110471838A
High-reliability unit test automatic generation method and device based on dialogue type large language model
CN117009231A
Agent-based white box test method
CN117873869A
Method and device for automatically generating unit test based on thinking chain prompt
CN118503125A
Unit test case generation system based on large language model
CN119105965A
Cited By
Code error repairing method and system based on large model
CN120492319A
Code error repair method and system based on large model
CN120492319B
Platform and method for automatically testing and generating kernel export function of operating system
CN120803962A
Operating system kernel export function automated test generation platform and method
CN120803962B