Multi-agent-based software test case generation method and terminal

By employing a multi-agent architecture for semantic extraction, test case generation, and review mechanisms, the quality issues in LLM test case generation are resolved, enabling efficient and interpretable test case generation and optimization, and ensuring the quality and reliability of test case sets.

CN122064584APending Publication Date: 2026-05-19FUJIAN TQ DIGITAL
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FUJIAN TQ DIGITAL
Filing Date
2025-12-31
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

In existing technologies, when automatically generating test cases using large language models (LLMs), there are problems such as missing boundary conditions, inconsistencies between steps and expected results, and redundancy or conflicts between test cases, making it difficult to guarantee the quality of test cases.

Method used

A multi-agent architecture is adopted. A semantic extraction agent parses the requirement document to generate a set of business scenarios. An initial test case set is generated by a test case generation agent. The review agent performs structured review, calculates a comprehensive score, and determines the processing path based on the score and a preset threshold. The final test case set is generated through automated iterative optimization.

Benefits of technology

It enables the generation of high-quality, interpretable test cases, ensuring that the test case set conforms to preset standards, improving the reliability and efficiency of the generation process, and automatically preventing the propagation of erroneous test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122064584A_ABST
    Figure CN122064584A_ABST
Patent Text Reader

Abstract

The invention provides a software test case generation method based on multiple agents and a terminal. The method comprises the following steps: analyzing an input demand document through a semantic extraction agent to generate a business scene set; generating an initial test case set based on the service scene set through a case generation agent; auditing the initial test case set through an auditing agent, outputting an auditing report containing structured auditing suggestions, and calculating a comprehensive score of the initial test case set; and based on a comparison result of the comprehensive score and a preset threshold value, processing the initial test case set to obtain a final test case set, and storing the final test case set. According to the method, automatic quality control and iterative optimization in the test case generation process are realized by constructing a closed-loop workflow with semantic extraction, case generation, auditing and rewriting multi-agent collaboration and introducing a structured review report and a quantitative scoring mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of software engineering, artificial intelligence and automated testing technology, and in particular to a method and terminal for generating software test cases based on multi-agent systems. Background Technology

[0002] As software requirements become increasingly complex, traditional methods of manually writing test cases are inefficient and prone to errors. In recent years, the development of Large Language Model (LLM) technology has provided a new solution for automated test case generation. Among related technologies, methods have emerged that directly utilize LLM to automatically generate test cases from software requirements documents; however, these technologies generally suffer from drawbacks such as incomplete boundary condition coverage, inconsistencies between steps and expected results, and redundancy or conflicts between test cases. Summary of the Invention

[0003] The technical problem to be solved by this invention is to provide a software test case generation method and terminal based on multi-agent systems, so as to realize a solution with automatic error correction, interpretability and high fault tolerance, and dynamic closed-loop audit and self-correction capabilities.

[0004] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: A method for generating software test cases based on multi-agent systems, the method comprising: The input requirement document is parsed by a semantic extraction agent to generate a set of business scenarios; The test case generation agent generates an initial test case set based on the business scenario set. The initial test case set is reviewed by the review agent, and a review report containing structured review comments is output, and a comprehensive score of the initial test case set is calculated. Based on the comparison result between the comprehensive score and the preset threshold, the initial test case set is processed to obtain the final test case set and saved.

[0005] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows: A software test case generation terminal based on multi-agent systems includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the various steps of the aforementioned software test case generation method based on multi-agent systems.

[0006] The beneficial effects of this invention are as follows: By constructing a multi-agent dynamic closed-loop review chain consisting of semantic extraction, test case generation, review, and rewriting agents, and achieving iterative optimization based on structured review reports and a comprehensive scoring mechanism, the system compares the comprehensive score with a preset quality threshold and automatically determines the processing path of the test cases based on the comparison result: if the score reaches or exceeds the threshold, the test case set is directly saved as the final version for output. This process ensures that only test cases that pass quality verification can enter subsequent stages, effectively preventing the downward transmission of erroneous test cases and guaranteeing that the quality of the final output test case set meets preset standards. The entire process is driven by structured review, which improves the reliability, interpretability, and overall efficiency of the generation process while ensuring that the quality of the output test cases meets preset standards. Attached Figure Description

[0007] Figure 1 A flowchart illustrating the steps of a multi-agent-based software test case method provided in this embodiment of the invention; Figure 2 The core process for generating audit reports provided in this embodiment of the invention; Figure 3 The differential rewrite logic chain provided in the embodiments of the present invention; Figure 4 This is a schematic diagram of the system structure provided in an embodiment of the present invention; Figure 5 A flowchart illustrating the steps of applying a multi-agent-based software test case method to a real-world scenario, as provided in this embodiment of the invention. Figure 6 This is a schematic diagram of the structure of a software test case generation terminal based on multi-agent technology, provided in an embodiment of the present invention. Label Explanation: 300. A software test case generation terminal based on multi-agent systems; 301. Memory; 302. Processor. Detailed Implementation

[0008] The following provides a detailed explanation of the definitions of terms used in this application.

[0009] Table 1. Glossary

[0010] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.

[0011] Please refer to Figure 1 A method for generating software test cases based on multi-agent systems, the method comprising: The input requirement document is parsed by a semantic extraction agent to generate a set of business scenarios; The test case generation agent generates an initial set of test cases based on a set of business scenarios. The initial test case set is reviewed by the review agent, and a review report containing structured review comments is output. The overall score of the initial test case set is also calculated. Based on the comparison results of the comprehensive score and the preset threshold, the initial test case set is processed to obtain the final test case set and maintained.

[0012] As described above, the beneficial effects of this invention are as follows: By constructing a multi-agent dynamic closed-loop review chain consisting of semantic extraction, test case generation, review, and rewriting agents, and by achieving iterative optimization based on a structured review report and a comprehensive scoring mechanism, the system compares the comprehensive score with a preset quality threshold and automatically determines the processing path of the test cases based on the comparison result. If the score reaches or exceeds the threshold, the test case set is directly saved and output as the final version. This process ensures that only test cases that pass quality verification can enter subsequent stages, effectively preventing the downward transmission of erroneous test cases and guaranteeing that the quality of the final output test case set meets the preset standards. The entire process is driven by structured review, which improves the reliability, interpretability, and overall efficiency of the generation process while ensuring that the quality of the output test cases meets the preset standards.

[0013] Furthermore, based on the comparison result between the comprehensive score and the preset threshold, a dynamic closed-loop review process is triggered, including: When the overall score is lower than the preset threshold, the initial test case set is differentially rewritten by the rewrite agent based on the structured review comments to generate a revised test case set; The revised test case set will be fed back to the audit agent for review and scoring; When the overall score reaches or exceeds the preset threshold, the current test case set is output as the final test case set.

[0014] As described above, by introducing a closed-loop review process that includes rewriting, auditing, feedback, and re-evaluation, automated iterative optimization of substandard test case sets is achieved. When the initial test case set fails to meet quality standards (overall score below the threshold), the system does not directly output or discard it. Instead, it rewrites the defective parts based on the audit comments and sends the revised version back to the audit stage for quality verification. Only versions that meet the quality standards are ultimately output and saved. This process ensures that each output is a test case set that meets the preset quality requirements, and by using differentiated rewriting rather than a complete rebuild, a balance is achieved between optimization efficiency and resource consumption.

[0015] Furthermore, the auditing of the initial test case set through the auditing agent includes: The steps for parsing the test cases in the initial test case set; The steps described after parsing are then checked for correctness defects, consistency defects, and integrity defects. The detected defects are encapsulated into the structured audit comments.

[0016] As described above, correctness defects are identified by checking whether the test steps match the requirements description; consistency defects are identified by analyzing the data dependencies and logical relationships between test cases; and integrity defects are identified by evaluating the coverage of functional points. This structured defect detection and classification method not only comprehensively evaluates the quality of test cases but also provides clear and actionable revision guidance for subsequent differential rewriting, making the entire review process highly interpretable and executable.

[0017] Further, calculating the comprehensive score of the initial test case set includes: ; in, Score The overall score is as follows. Acc The accuracy of matching the steps of the test cases in the initial test case set with the requirements description in the requirements document. Cons The percentage of logical consistency of data across multiple test cases in the initial test case set. Cov The initial test case set represents the coverage of all functionalities in the requirements document. w_a、w_c、w_cov These are the weight coefficients for each dimension.

[0018] As described above, the quality of the test case set is comprehensively evaluated through multi-dimensional quantitative indicators. This comprehensive scoring system integrates the matching accuracy between test case steps and original requirements. Acc Consistency of data logic between use cases () Cons ) and the completeness of the coverage of required functions ( Cov , and through preset weighting coefficients ( w_a , w_c , w_cov This reflects the priority of different quality dimensions. This quantitative method not only provides an objective and unified basis for judging whether a set of use cases meets the standards, but also accurately identifies quality shortcomings, providing a clear direction for subsequent targeted rewriting, thereby achieving standardization and refinement of quality assessment.

[0019] Further, calculating the comprehensive score of the initial test case set includes: Map the steps of the test cases in the initial test case set to the functional points in the requirements document one by one; The Acc is calculated based on the proportion of the number of steps that successfully establish a mapping to the total number of function points in the requirements description.

[0020] As described above, this method achieves a quantitative assessment of the consistency between test cases and original requirements by systematically mapping test steps to functional points in the requirements document. By comparing each test step to ensure it accurately covers the functional points defined in the requirements document and counting the number of successful mappings, the accuracy of test cases in fulfilling the requirements can be objectively measured. This mapping mechanism not only ensures the traceability of test cases but also provides a direct basis for identifying insufficiently covered or deviated functional points, thereby supporting subsequent targeted optimization and quality closed-loop control.

[0021] Further, the differential rewriting of the initial test case set includes: Based on the initial test case set and the requirements document, locate the test steps with defects; Construct an abstract syntax tree corresponding to the defective test steps, and perform a difference analysis between the abstract syntax tree and the corresponding requirement semantics in the requirement document; Based on the results of the difference analysis, revised test steps are generated using a large language model. The revised test steps are merged with the initial test case set to generate the revised test case set.

[0022] As described above, by transforming defective steps into an abstract syntax tree and performing structured difference analysis with the semantics of the requirements, the system can clearly identify specific deviations, rather than relying solely on fuzzy textual comparisons. Based on this, a large-scale language model is used to generate semantically corrected steps according to the difference analysis results. This preserves the correct parts of the original use cases while achieving targeted correction of defective content. Finally, through a version merging mechanism, the revised steps are seamlessly integrated into the original use case set, forming a revised test case set. This achieves a highly efficient improvement in the quality of the use case set without requiring a complete rewrite.

[0023] Furthermore, the step of merging the revised test steps with the initial test case set further includes: If a logical conflict is detected between the revised test steps, the influence domain of the logical conflict is analyzed based on a cause-effect graph. Based on the analysis results, steps on high-weight influence domains are retained first, and steps that conflict with the retained steps are deleted to obtain the revised test case set.

[0024] As described above, a logical conflict detection and intelligent resolution mechanism was introduced during the version merging process, further improving the overall consistency of the revision results. When a logical conflict is detected between revision steps, the system does not simply discard or randomly select steps. Instead, it uses a cause-effect graph method to systematically analyze the scope of the conflict's impact, identifying high-weight steps that affect key functions or have a wider coverage. Based on this, steps that contribute more to the overall use case quality and requirement coverage are prioritized for retention, while low-weight revisions that conflict with them are removed. This resolves local conflicts while maximizing the functional integrity and logical consistency of the revised use case set. This mechanism ensures that the revision process not only focuses on the accuracy of individual steps but also emphasizes the coordination and effectiveness of the use case set as a whole.

[0025] Furthermore, the step of parsing the input requirement document through a semantic extraction agent to generate a set of business scenarios also includes: The requirements document is parsed, and the business scenarios and functional steps contained therein are extracted to form the business scenario set.

[0026] As described above, this method achieves a systematic transformation from natural language requirements to executable test scenarios through structured semantic parsing of requirement documents. The semantic extraction agent can identify the implicit business processes, functional modules, and operational steps in the requirement documents and transform them into standardized business scenario descriptions. This process not only extracts explicit functional points but also captures the relationships and constraints between scenarios through semantic understanding, providing a complete and structured input foundation for the generation of subsequent test cases, thereby ensuring that the generated test cases can comprehensively and accurately reflect the original business requirements.

[0027] Furthermore, the step of generating an initial test case set based on the business scenario set through the test case generation agent also includes: For each business scenario in the aforementioned business scenario set, generate structured initial test cases.

[0028] As described above, the test case generation agent can map structured business scenarios into directly executable or verifiable test cases. For each business scenario, the agent generates structured test cases containing test steps, expected results, input data, and verification points according to a preset test case template, ensuring the standardization and reusability of the test cases. This process, by combining scenario semantics and test design knowledge, automatically generates diverse test cases covering normal processes, abnormal situations, and boundary conditions, significantly improving the completeness and engineering usability of test cases, and laying a solid foundation for subsequent automated review and execution.

[0029] The software test case generation method and terminal based on multi-agent technology described above are applicable to functional testing, integration testing, and requirement verification scenarios of various software systems. Especially in agile development, continuous delivery, and large-scale distributed system testing processes with high requirement complexity, frequent changes, or limited testing resources, it can significantly improve the automation level and reliability of test case generation. The following detailed implementation methods illustrate this.

[0030] Please refer to Figure 1 Embodiment 1 of the present invention is as follows: A method for generating software test cases based on multi-agent systems includes the following steps: Step 110: Parse the output requirement document using a semantic extraction agent to generate a set of business scenarios. Specifically, the semantic extraction agent performs natural language parsing on the requirement document, identifying and extracting functional modules, business processes, and operational steps. This agent uses semantic understanding technology to transform unstructured text requirements into structured business scenario descriptions. Each business scenario includes a clear scenario objective, execution steps, preconditions, and expected results, forming a set of machine-readable business scenarios that provides standardized input for subsequent test case generation.

[0031] In one optional implementation, the semantic extraction agent uses a sequence labeling method based on a pre-trained language model to identify entities and relationships in the requirements document, and aggregates relevant steps into a complete scene according to business rules, ensuring the accuracy and semantic integrity of scene extraction.

[0032] Step 120: Generate an initial test case set based on the business scenario set using the test case generation agent. The test case generation agent automatically generates corresponding test cases for each business scenario according to a predefined test case template. Each test case includes structured fields such as test case number, test title, execution steps, input data, expected output, and priority, forming an initial test case set covering the normal flow, abnormal flow, and boundary conditions of the function.

[0033] In one optional implementation, the use case generation agent adopts a combination of template-based generation and example-based reasoning. While ensuring the standardization of the use case structure, it supports adaptive adjustment based on the historical use case library, thereby improving the diversity and effectiveness of the use cases.

[0034] Step 130: The audit agent reviews the initial test case set, outputs an audit report containing structured audit comments, and calculates the overall score of the initial test case set. The audit agent performs automated quality review of the initial test case set, evaluating it from three core dimensions: correctness, consistency, and completeness. Specifically, it reviews correctness by comparing test steps with the original requirements to identify semantic discrepancies, reviews consistency by analyzing data dependencies and logical relationships between different test cases to detect conflicts, and reviews completeness by assessing the coverage of all functional points in the requirements document. The audit agent categorizes and encapsulates all identified defects into machine-readable structured audit comments, generating a detailed audit report. Simultaneously, it calculates the overall score of the initial test case set based on a preset multi-dimensional quantitative formula. This formula integrates the accuracy of matching test case steps with requirements (Acc), the data logic consistency rate between multiple test cases (Cons), and the functional coverage rate of requirements (Cov), and uses weighting coefficients (w_a, w_c, w_cov) to reflect the relative importance of each dimension.

[0035] Step 140: Based on the comparison between the comprehensive score and the preset threshold, process the initial test case set to obtain the final test case set and save it. The system compares the calculated comprehensive score with the preset quality threshold and decides the processing path accordingly. If the comprehensive score reaches or exceeds the threshold, the current test case set is deemed to be of acceptable quality and is directly saved as the final version to the test case library. If the comprehensive score is below the threshold, a dynamic closed-loop revision process is triggered: The system first locates the specific test steps with defects based on the structured opinions in the audit report; then, it identifies the root cause of the problem by constructing an abstract syntax tree of the defective steps and performing a difference analysis with the corresponding requirement semantics; then, based on the analysis results, it drives a large language model to generate revised test steps; finally, it intelligently merges the revised steps with the original test case set. If logical conflicts are detected during this process, the cause-effect graph analysis method is used to evaluate the conflict impact domain, prioritizing the retention of steps with higher weights in requirement coverage and overall quality, thereby generating a revised test case set. This revised set will be fed back to the audit agent for a new round of audit and scoring, iterating until its comprehensive score meets the preset quality requirements, and is then output and saved as the final test case set.

[0036] Please refer to Figure 2 Embodiment two of the present invention is as follows: The core process for generating the audit report (Rep) in the application embodiments of this application is described in detail below.

[0037] like Figure 2As shown, the core process of the audit agent generating audit reports begins with receiving the initial test case set and related requirements documents. The agent first performs step parsing, extracting the execution steps of each test case from the structured data and transforming them into standardized units that can be used for semantic analysis and logical review. This step corresponds to "parsing the steps of the test cases in the initial test case set" and is the foundation for defect detection.

[0038] After parsing is complete, the process enters the core defect detection phase. This phase involves automated review in three parallel dimensions: 1. Accuracy Detection: Semantically align and match the parsed test steps with the descriptions in the requirements document, calculate and evaluate the degree of conformity between the steps and the original requirements, and identify deviations in step description, logical omissions, or behavioral errors.

[0039] 2. Consistency Detection (Cons Detection): Analyzes the data flow and state dependencies across test cases to detect whether there are problems such as input-output contradictions, expected result conflicts, or inconsistent shared data states between different test cases.

[0040] 3. Integrity Detection (Cov Detection): This involves mapping and comparing the test case set with all functional points defined in the requirements document to identify functional point vulnerabilities not covered by any test cases, or insufficient coverage of boundary conditions and abnormal scenarios. This corresponds to "detecting correctness defects, consistency defects, and integrity defects in the parsed steps."

[0041] Based on the multi-dimensional defect detection results, the process enters the structured encapsulation stage. The system standardizes, classifies, and describes all identified defects, generating a structured array of defect records (review_notes). Each record includes the defect type, location information (such as use case ID and step number), a detailed description, and possible revision suggestions.

[0042] Subsequently, the system calculates specific quantitative scores for each dimension (Acc, Cons, Cov) based on the detection results, serving as scoring factors. These factors are then used as input, and through predefined weights and an algorithm model, a comprehensive score representing the overall quality of the test case set is calculated. This step corresponds to "encapsulating the detected defects into the structured review comments," and specifically implements the comprehensive score calculation.

[0043] Finally, the system encapsulates the structured defect record array (review_notes) and key information such as the overall score (Score) into a complete, machine-readable structured data object (e.g., JSON format), performs JSON serialization, and outputs it as the formal review report (Rep). This step fully achieves the technical effect of "outputting a review report containing structured review comments and calculating the overall score".

[0044] This process automates, makes the review process more objective and interpretable through standardized parsing, multi-dimensional parallel detection, structured encapsulation, and quantitative scoring, providing accurate input for subsequent decision-making and optimization.

[0045] Please refer to Figure 3 Embodiment 3 of the present invention is as follows: The differential rewrite logic chain in the application embodiments of this application is described in detail below.

[0046] like Figure 3 As shown, the differential rewrite logic chain is the core algorithm process of the system for intelligently revising non-compliant test case sets based on the audit report. This process takes the structured audit report (Rep) output by the audit agent as input to initiate the revision phase.

[0047] First, the system performs structural localization. Based on the defect type and specific location information recorded in the review_notes array, the system accurately locates the specific test step ID where the defect exists in the initial test case set.

[0048] This step achieves the aforementioned "locating the defective test steps based on the initial test case set and the requirements document", wherein the audit report already includes the comparison results between the requirements document and the test case set.

[0049] After localization, the system proceeds to the context-aware patch generation phase. The system extracts the code or script snippets corresponding to the defective steps and constructs an Abstract Syntax Tree (AST) to represent its logic in a structured form. Combining the AST analysis results with the defect description, the system utilizes a Large Language Model (LLM) for suggestion engineering, generating precise instructions in the paradigm of "fix <defect type> in <code snippet>", driving the LLM to generate revised patches or new step code that conform to the requirement semantics. This step corresponds to "constructing the Abstract Syntax Tree corresponding to the defective test step and performing a difference analysis between the Abstract Syntax Tree and the corresponding requirement semantics in the requirement document" and "generating revised test steps using a Large Language Model based on the results of the difference analysis."

[0050] Finally, the system performs a version merge. The generated revision patch is integrated with the original test case set using a Git-style three-in-one merge strategy for intelligent fusion, ensuring seamless integration of the revised content with the original correct parts, while automatically handling any potential version conflicts. This output is the result of "generating the revised test case set," which will be fed back to the audit broker for further review.

[0051] After the process is completed, the system outputs a final test case set (TC) that has been revised and improved in quality. This logical chain realizes a closed-loop revision from defect location, intelligent patch generation to automated version merging, ensuring the accuracy of test case optimization and overall consistency.

[0052] Please refer to Figure 4 Embodiment four of the present invention is as follows: The following is a detailed description of the system structure diagram in the application embodiment of this application.

[0053] like Figure 4 As shown, the system architecture of the present invention is based on a collaborative multi-agent architecture, consisting of a monitoring unit (V), an orchestrator, a logic processing unit (B), a loop component (C), and multiple agents (such as A1, A2, etc.) forming a dynamic closed-loop processing system.

[0054] The system's workflow begins with the monitoring unit (V), which continuously receives and monitors external inputs (such as requirements documents or test tasks) and passes their status information to the orchestrator. The orchestrator, as the system's central scheduling module, dynamically coordinates the calling order and data flow of multiple agents (such as A1 and A2) based on task status and business rules, thereby achieving task decomposition and allocation.

[0055] Each agent (A1, A2) executes its specialized subtask under the orchestrator's scheduling. For example, A1 might correspond to the semantic extraction agent, responsible for requirement parsing; it executes the step of "parsing the input requirement document through the semantic extraction agent to generate a set of business scenarios." A2 might correspond to the use case generation agent, responsible for generating initial use cases. It executes the step of "generating an initial set of test cases based on the business scenario set through the use case generation agent." Their outputs are then passed to the logic processing unit (B) for aggregation, integration, and preliminary structured processing.

[0056] The result processed by the logic processing unit (B) is not directly output, but enters a closed-loop process containing a feedback mechanism. The system evaluates and judges the processing result in real time through the loop component (C): if the result meets the preset quality or integrity standards, it is delivered as the final output result (R); this is equivalent to the processing logic of "outputting the current test case set as the final test case set when the comprehensive score reaches or exceeds the preset threshold". If the standard is not met, a backflow mechanism is triggered, and the current result along with the evaluation opinion is sent back to the orchestrator, which organizes relevant intelligent agents (such as review agents and rewrite agents) to perform a new round of iterative processing until the output meets the requirements. This corresponds to the dynamic closed-loop review process: "When the comprehensive score is lower than the preset threshold, the rewrite agent performs differential rewriting on the initial test case set according to the structured review opinion to generate a revised test case set; the revised test case set is fed back to the review agent for review and scoring." At the same time, the "evaluation opinion" here specifically corresponds to the structured review opinion, and the rewriting process corresponds to the specific technical solution.

[0057] This architecture achieves an adaptive intelligent processing system with self-monitoring, dynamic scheduling, and iterative optimization capabilities through the organic combination of monitoring, orchestration, processing, evaluation, and feedback. It is particularly suitable for software engineering automation scenarios that require multi-step collaboration and quality closed-loop assurance.

[0058] Please refer to Figure 5 Embodiment five of the present invention is as follows: This embodiment applies the aforementioned multi-agent-based software test case generation method to a real-world scenario, using the testing of a new game feature as an example. Specifically, it describes the test case generation process for a new feature, "Team Competitive Mode," in a multiplayer online game. The game designers created a detailed requirements document, Req_v0, which defines the core rules of this mode, such as team size, win / loss conditions, special item mechanics, and map interaction logic.

[0059] Please refer to Figure 5 The flowchart below illustrates a software test case generation method based on multi-agent technology in this embodiment. The process begins with step S100: reading the requirements document Req_v0, where the system loads the requirements specification for the game function.

[0060] Subsequently, the Orchestrator schedules and invokes the semantic extraction agent A1 based on the task type. A1 performs deep parsing on Req_v0, identifying multiple key business scenarios such as "room creation," "character selection," "battle flow," "item usage," and "victory determination," and outputs a structured set of scenarios. This step corresponds to "parsing the requirement document through the semantic extraction agent to generate a set of business scenarios."

[0061] Next, the orchestrator invokes the test case generation agent A2. Based on the aforementioned scenario set, A2 generates corresponding test cases for each scenario, such as "testing the maximum number of people when creating a room" and "testing conflict resolution for role selection," thus forming the initial test case set. This step corresponds to "Generate an initial test case set based on the business scenario set using the test case generation agent".

[0062] The process has entered the core review stage. The review agent... A comprehensive review was conducted to assess whether the steps accurately reflected the requirements, whether the data logic between use cases was consistent, and whether all declared functionalities were covered. After the review, the system calculated... Overall rating This step corresponds to "reviewing the initial test case set through the review agent, outputting a review report containing structured review comments, and calculating the overall score."

[0063] Decision nodes based on Compare with a preset quality threshold (0.8 in this example): (This decision logic corresponds to the step of "processing based on the comparison result between the comprehensive score and the preset threshold".)

[0064] like If the value is greater than or equal to 0.8, it indicates that the initial test case set is of acceptable quality, and the process directly proceeds to step S150. The final test case set TC_final is written into the test case library for the testing team to execute directly. (This corresponds to "when the overall score reaches or exceeds the preset threshold, output the current test case set as the final test case set".)

[0065] like A value less than 0.8 indicates that the quality has not met the standards, and the system will automatically generate a detailed audit report (AReport) clearly pointing out the defects. Subsequently, the orchestrator will trigger the loop component C, which will then process the audit report. Differential rewriting is performed, for example, to correct the missing cooldown time verification in the "item usage" scenario, or to add the tie boundary conditions in the "win / loss determination" scenario, thereby generating a revised test case set. . The test cases will be resubmitted for review and evaluation, forming a closed loop of "generation-review-revision" until the score meets the threshold requirements. This corresponds to the "dynamic closed-loop review process: when the overall score is lower than the preset threshold, the rewriting agent performs differential rewriting based on the structured review comments, and the revised test case set is fed back to the review agent for re-review and scoring."

[0066] Through the process described in this embodiment, the game testing team can automatically obtain a set of high-quality, executable test cases based on a natural language requirements document, which significantly improves the startup speed and test case coverage quality of new feature testing and effectively ensures the verification completeness of complex game logic.

[0067] Please refer to Figure 6 Embodiment six of the present invention is as follows: A software test case generation terminal 300 based on multi-agent technology includes a memory 301, a processor 302, and a computer program stored in the memory 301 and running on the processor 302. When the processor 302 executes the computer program, it implements the steps in Embodiments 1 to 5.

[0068] In summary, this invention provides a software test case generation method and terminal based on multi-agent systems. By constructing a dynamic closed-loop review chain involving semantic extraction, test case generation, review, and rewriting, it transforms the traditional open-loop generation model into a self-monitoring and self-correcting intelligent system. Specifically, the review agent performs automated quality review of the initial test case set, outputs structured review opinions, and calculates a comprehensive score. The system automatically decides the processing path by comparing this score with a preset quality threshold: if the score meets the standard, the test case set is directly output and saved; if the score does not meet the standard, a differential rewriting process is triggered based on the review opinions for iterative optimization until a final test case set meeting the quality requirements is generated. Therefore, this invention not only automates the generation of structured test cases but also systematically eliminates defects in the generation process through a closed-loop review and rewriting mechanism, preventing the transmission of low-quality test cases. While ensuring the reliability of the output test case set, it improves the efficiency, automation, and interpretability of test case generation. The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention's specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for generating software test cases based on multi-agent systems, characterized in that, The method includes: The input requirement document is parsed by a semantic extraction agent to generate a set of business scenarios; The test case generation agent generates an initial test case set based on the business scenario set. The initial test case set is reviewed by the review agent, and a review report containing structured review comments is output, and a comprehensive score of the initial test case set is calculated. Based on the comparison result between the comprehensive score and the preset threshold, the initial test case set is processed to obtain the final test case set and saved.

2. The method for generating software test cases based on multi-agent technology according to claim 1, characterized in that, The dynamic closed-loop review process, triggered by comparing the comprehensive score with a preset threshold, includes: When the overall score is lower than the preset threshold, the initial test case set is differentially rewritten by the rewrite agent based on the structured review comments to generate a revised test case set; The revised test case set will be fed back to the audit agent for review and scoring; When the overall score reaches or exceeds the preset threshold, the current test case set is output as the final test case set.

3. The method for generating software test cases based on multi-agent technology according to claim 1, characterized in that, The auditing of the initial test case set through the auditing agent includes: The steps for parsing the test cases in the initial test case set; The steps described after parsing are then checked for correctness defects, consistency defects, and integrity defects. The detected defects are encapsulated into the structured audit comments.

4. The method for generating software test cases based on multi-agent technology according to claim 1, characterized in that, The calculation of the overall score for the initial test case set includes: ; in, Score The overall score is as follows. Acc The accuracy of matching the steps of the test cases in the initial test case set with the requirements description in the requirements document. Cons The percentage of logical consistency of data across multiple test cases in the initial test case set. Cov The initial test case set represents the coverage of all functionalities in the requirements document. w_a、w_c、w_cov These are the weight coefficients for each dimension.

5. The method for generating software test cases based on multi-agent technology according to claim 4, characterized in that, Also includes: Map the steps of the test cases in the initial test case set to the functional points in the requirements document one by one; The Acc is calculated based on the proportion of the number of steps that successfully establish a mapping to the total number of function points in the requirements description.

6. The software test case generation method based on multi-agent dynamic closed-loop auditing according to claim 2, characterized in that, The differential rewriting of the initial test case set includes: Based on the initial test case set and the requirements document, locate the test steps with defects; Construct an abstract syntax tree corresponding to the defective test steps, and perform a difference analysis between the abstract syntax tree and the corresponding requirement semantics in the requirement document; Based on the results of the difference analysis, revised test steps are generated using a large language model. The revised test steps are merged with the initial test case set to generate the revised test case set.

7. The method for generating software test cases based on multi-agent technology according to claim 6, characterized in that, The step of merging the revised test steps with the initial test case set further includes: If a logical conflict is detected between the revised test steps, the influence domain of the logical conflict is analyzed based on a cause-effect graph. Based on the analysis results, steps on high-weight influence domains are retained first, and steps that conflict with the retained steps are deleted to obtain the revised test case set.

8. The method for generating software test cases based on multi-agent technology according to claim 1, characterized in that, The step of parsing the input requirement document through a semantic extraction agent to generate a set of business scenarios also includes: The requirements document is parsed, and the business scenarios and functional steps contained therein are extracted to form the business scenario set.

9. The method for generating software test cases based on multi-agent technology according to claim 1, characterized in that, The step of generating an initial test case set based on the business scenario set via the test case generation agent also includes: For each business scenario in the aforementioned business scenario set, generate structured initial test cases.

10. A software test case generation terminal based on multi-agent systems, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the various steps of the multi-agent-based software test case generation method according to any one of claims 1 to 9.