A property testing generation method and system based on cross-function semantic graph and adversarial iteration
By using a cross-function semantic graph and adversarial iteration approach, this method solves the problems of weak assertion logic, insufficient cross-function coverage, and invalid input in existing attribute test generation technologies, achieving efficient and reliable attribute test generation and improving software quality assurance capabilities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIHANG UNIV
- Filing Date
- 2026-02-28
- Publication Date
- 2026-06-05
AI Technical Summary
Existing attribute test generation technologies suffer from problems such as weak assertion logic constraints, lack of implicit contract coverage across functions, unreasonable input generation strategies, lack of verifiable evidence for generated results, and insufficient attribute strength, leading to insufficient defect detection capabilities and wasted resources.
We employ a method based on cross-function semantic graphs and adversarial iteration. By constructing semantic relationship graphs between functions, planning traceable sources of evidence, generating cross-function combined attribute tests, and optimizing tests through adversarial verification, we enhance input constraints and assertion logic.
It significantly improves the semantic constraint strength and defect detection capability of attribute testing, optimizes the effectiveness and resource utilization of test input, enhances the credibility and interpretability of generated results, and constructs a self-reinforcing closed-loop system of attribute strength to meet the continuous testing needs of complex software libraries.
Smart Images

Figure CN122152664A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of software engineering and automated testing technology, and in particular to an attribute test generation method and system based on cross-function semantic graphs and adversarial iteration. Background Technology
[0002] With the increasing reuse of open-source software and third-party libraries in industrial software development, the reliance on automated testing technologies for software quality and reliability is growing. Attribute testing, as an advanced testing paradigm, effectively detects the semantic correctness of programs under boundary conditions, combined inputs, and complex logic by randomly generating large amounts of input data and verifying predefined attributes or invariants. It is particularly suitable for in-depth verification of function-intensive libraries such as those involved in mathematical calculations, data parsing, and serialization. Compared to the limited coverage of traditional unit testing and the focus of fuzz testing on crash triggering, attribute testing demonstrates unique advantages in discovering deep-seated logical defects.
[0003] Currently, automated attribute test generation technology mainly presents three technical paths: the first is the fixed template-based method, which generates tests by pre-setting general attribute patterns (such as round-trip performance, idempotency, etc.) and manually filling in function information; the second is the large language model-based method, which directly generates test code using the target function signature and document description; and the third is the agent-based method, which allows the entire codebase to be tested to be autonomously analyzed and its attributes to be mined. These technologies have made initial progress in improving test generation efficiency.
[0004] However, existing technologies face multiple challenges in real-world software library scenarios:
[0005] First, the generated attribute tests often suffer from a "superficial" problem—the assertion logic constraints are weak (such as tautology conditions and shallow behavioral verification), making it difficult to distinguish between correct implementations and semantically incorrect implementations, resulting in insufficient defect detection capabilities. At the same time, existing methods are mostly limited to a single-function perspective, ignoring the implicit cross-function contracts that are common in software (such as semantic relationships between encoding / decoding, construction / parsing, and state operation pairs), and are unable to generate cross-function composite attributes that cover real business logic.
[0006] Secondly, the input generation strategy lacks effective constraints on the preconditions of the function. The test samples often contain a large number of invalid inputs that do not meet the requirements of the parameter domain, which leads to frequent anomalies and false alarms, seriously wasting test resources and masking the real defects.
[0007] Furthermore, the attribute generation process lacks verifiable evidence, making it susceptible to model "illusion" and resulting in unsupported or logically contradictory assertions. Moreover, the source of evidence for the generated results is difficult to trace, leading to difficulties in attributing causes when tests fail and low reliability of results. Finally, existing technologies lack dynamic evaluation and enhancement mechanisms for attribute strength, cannot identify weak attributes that can be bypassed by flawed implementations, and lack systematic strategies to drive the evolution of attributes from weak to strong constraints, making it difficult to adapt to the continuously increasing testing depth requirements of complex software libraries.
[0008] In summary, there is an urgent need for an attribute test generation technology that can deeply integrate cross-functional semantic association, input constraint-driven approach, evidence traceability verification, and adversarial iterative optimization. This technology would overcome the bottlenecks of existing methods in terms of constraint effectiveness, semantic coverage depth, input rationality, result interpretability, and sustainable improvement of test intensity, thereby effectively enhancing the practical value of attribute testing in industrial-grade software quality assurance. Summary of the Invention
[0009] To address the shortcomings of existing technologies, this invention provides a method and system for generating attribute tests based on cross-function semantic graphs and adversarial iteration.
[0010] To achieve the above-mentioned objectives, the technical solution adopted by the present invention is as follows:
[0011] An attribute test generation method based on cross-functional semantic graphs and adversarial iteration includes the following steps:
[0012] S1: Parse the target code repository and build a structured index containing function signatures, parameters, return values, docstrings, comments, and call dependencies;
[0013] S2: Extract input precondition constraints from the source code of the target code repository. The extraction includes identifying assertions, type / range checks and exception triggering conditions based on abstract syntax trees, and mapping local constraints to the function parameter level by combining data flow backtracking.
[0014] S3: Construct a cross-function semantic graph, where nodes represent functions and edges represent semantic relationships between functions. The semantic relationships include at least one of inverse function relationships, round-trip relationships, state-invariant relationships, or relational identity relationships.
[0015] S4: Based on the structured index, input precondition constraints and cross-function semantic graph, plan candidate attributes and bind traceable evidence sources and attribute-evidence alignment methods to each candidate attribute. The evidence sources include document strings, code comments, source code assertions or verifiable algebraic / relational patterns.
[0016] S5: The candidate attributes are synthesized into attribute test code, which includes an input strategy generated based on the input precondition constraints, a cross-function call sequence, and assertion logic aligned with the evidence source;
[0017] S6: Perform adversarial verification: Attempt to construct an anti-implementation that can pass the current attribute test code but has semantic errors; if the construction is successful, generate a refinement suggestion based on the bypass information, adjust the candidate attributes based on the refinement suggestion, and return to step S4 for iteration until the anti-implementation cannot be constructed or the preset termination condition is met.
[0018] Furthermore, the input precondition constraints generated in step S2 are used to constrain the input generation strategy for attribute testing, so as to reduce invalid test cases and noise failures caused by the input not meeting the preconditions.
[0019] Furthermore, the method for constructing the cross-function semantic graph in step S3 includes at least one of rule matching, call relationship mining, document retrieval enhancement, or dynamic execution trajectory analysis.
[0020] Furthermore, in step S4, the set of adjacent functions that have semantic association with the target function in the cross-function semantic graph is used first to construct cross-function combination attributes.
[0021] Furthermore, the refinement suggestions in step S6 include: supplementing necessary attribute conditions, strengthening assertion logic, expanding the coverage of cross-function semantic relationships, or adjusting the input strategy to cover key boundary areas.
[0022] Furthermore, the preset termination conditions include reaching a threshold number of iterations, multiple consecutive failures of adversarial verification, or exhaustion of test resource budget.
[0023] This invention also discloses an attribute test generation system that implements the above-described attribute test generation method, comprising:
[0024] The parsing and context building module is used to build structured indexes;
[0025] The constraint extraction module is used to generate input precondition constraints;
[0026] The cross-function semantic graph construction module is used to construct graph structures that represent the semantic relationships between functions;
[0027] The attribute planning module for evidence constraints is used to generate candidate attributes for binding evidence sources;
[0028] The attribute test synthesis module is used to generate test code that includes constraint-driven input strategies and evidence-aligned assertions;
[0029] The adversarial verification and iterative refinement module is used to construct the reverse implementation, generate refinement suggestions, and drive closed-loop iteration.
[0030] The coordinator is used to schedule the execution of each module in a closed-loop process: attribute planning, test synthesis, adversarial verification, and attribute refinement.
[0031] Furthermore, when the adversarial verification and iterative refinement module detects that an attribute can be bypassed, it triggers the attribute planning module to introduce new cross-functional relationships or adjust the input strategy boundaries.
[0032] Furthermore, the system supports a multi-agent collaborative architecture, where each functional module can be configured as an independent agent or a merged role, and the underlying language model can be replaced with a large language model from a different vendor or architecture.
[0033] The present invention also discloses a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described attribute test generation method.
[0034] Compared with the prior art, the advantages of the present invention are as follows:
[0035] 1. Significantly improve the semantic constraint strength and defect detection capability of attribute testing: Through an adversarial iterative refinement mechanism, the system actively constructs a reverse implementation that is semantically erroneous but satisfies the current attribute, accurately exposes attribute vulnerabilities, and drives targeted enhancement of assertion logic, input boundaries, or cross-function relationships. This effectively avoids weak attribute problems such as "constant truth assertions" and "shallow verification," enabling the generated tests to reliably distinguish between correct implementations and various semantically erroneous implementations, and significantly improves the detection rate of deep logic defects.
[0036] 2. Achieve systematic coverage of implicit cross-function contracts: Based on explicit modeling of semantic relationships between functions (such as inverse functions, round trips, state invariance, etc.) using cross-function semantic graphs, guide attribute planning to focus on key multi-function collaboration scenarios in real software libraries. The generated attribute tests can verify the correctness of cross-function combination behaviors such as encoding / decoding and construction / parsing, breaking through the coverage limitations of single-function tests and more closely reflecting actual business logic and defect triggering conditions.
[0037] 3. Significantly optimize the validity of test inputs and resource utilization: Automatically extract input preconditions (such as parameter range, type constraints, and exception triggering conditions) from the source code through static program analysis, and transform them into explicit constraints of the input strategy. This concentrates test samples in the semantically valid input domain, significantly reducing abnormal interruptions and noise failures caused by invalid parameters. It also efficiently focuses the test budget on high-quality test cases that can trigger core logic, improving test execution efficiency and signal purity.
[0038] 4. Enhance the credibility, interpretability, and auditability of attribute generation: Adopt an evidence constraint mechanism, requiring each attribute to be bound to a traceable evidence source (such as docstrings, code comments, source code assertions, or verifiable patterns), and retain attribute-evidence alignment information in the test report, effectively suppressing semantic misinterpretation and "illusion" risks during the generation process; When a test fails, evidence can be quickly linked to locate the cause, providing a clear basis for defect reports and improving credibility and collaboration efficiency in engineering practice.
[0039] 5. Constructing a self-reinforcing closed-loop system for attribute strength: Through a multi-agent collaborative process of "attribute planning → test synthesis → adversarial verification → refinement iteration," attribute test generation is transformed from a one-time output into a continuous optimization process. The system automatically triggers attribute strengthening strategies (such as supplementing necessary conditions, expanding semantic relationships, and adjusting input boundaries) based on adversarial feedback, achieving a gradual increase in attribute constraint strength, reducing reliance on human experience, and adapting to the continuous demands of complex software libraries for test depth and robustness.
[0040] 6. Enhance the practicality of industrial-grade attribute testing: The synergistic effect of the above technologies enables the generated attribute tests to have both "operability" and "strong constraints," significantly reducing false positives and improving the effective defect detection rate in real open-source library and third-party component testing. This provides highly reliable, low-maintenance-cost automated testing assets for continuous integration (CI) environments, effectively enhancing the quality assurance capabilities of the software supply chain. Attached Figure Description
[0041] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 This is a flowchart of the attribute test generation method based on cross-function semantic graph and adversarial iteration in an embodiment of the present invention;
[0043] Figure 2 This is an example diagram of attribute reasoning in an embodiment of the present invention;
[0044] Figure 3 This is an example diagram illustrating the use of the Hypothesis framework for attribute testing in an embodiment of the present invention;
[0045] Figure 4 This is a flowchart of the workflow of the Adversarial Validator Agent in this embodiment of the invention. Detailed Implementation
[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0047] I. System Overall Architecture and Workflow
[0048] like Figure 1 As shown, the overall architecture of this invention adopts a "multi-agent collaboration + closed-loop iterative refinement" approach to automatically generate attribute tests. The system uses a coordinator to uniformly schedule several complementary agents, causing them to repeatedly execute a closed loop of "attribute planning → code synthesis → execution verification → adversarial bypass → attribute enhancement" around the same objective function (or set of objective functions) until the attribute cannot be bypassed or the budget limit is reached. The overall design emphasizes three points: first, attributes must come from traceable evidence; second, attributes can reveal cross-functional relationships; and third, adversarial countermeasures continuously expose attribute vulnerabilities and drive enhancement.
[0049] The process of this invention is as follows: A method for generating attribute tests based on cross-function semantic graphs and adversarial iteration includes the following steps:
[0050] S1: Parse the target code repository and build a structured index containing function signatures, parameters, return values, docstrings, comments, and call dependencies;
[0051] S2: Extract input precondition constraints from the source code of the target code repository. The extraction includes identifying assertions, type / range checks and exception triggering conditions based on abstract syntax trees, and mapping local constraints to the function parameter level by combining data flow backtracking.
[0052] S3: Construct a cross-function semantic graph, where nodes represent functions and edges represent semantic relationships between functions. The semantic relationships include at least one of inverse function relationships, round-trip relationships, state-invariant relationships, or relational identity relationships.
[0053] S4: Based on the structured index, input precondition constraints and cross-function semantic graph, plan candidate attributes and bind traceable evidence sources and attribute-evidence alignment methods to each candidate attribute. The evidence sources include document strings, code comments, source code assertions or verifiable algebraic / relational patterns.
[0054] S5: The candidate attributes are synthesized into attribute test code, which includes an input strategy generated based on the input precondition constraints, a cross-function call sequence, and assertion logic aligned with the evidence source;
[0055] S6: Perform adversarial verification: Attempt to construct an anti-implementation that can pass the current attribute test code but has semantic errors; if the construction is successful, generate a refinement suggestion based on the bypass information, adjust the candidate attributes based on the refinement suggestion, and return to step S4 for iteration until the anti-implementation cannot be constructed or the preset termination condition is met.
[0056] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0057] II. Detailed Implementation of the Steps
[0058] 2.1 Parsing and Context-Based Intelligent Agent (Context / Index Agent)
[0059] This agent is responsible for transforming the code repository into a structured context that can be invoked by subsequent agents. It parses the source code and documentation, builds function indexes (function signatures, parameters, return values, docstrings / comments, dependency and calling information, etc.), and forms a searchable context package. Any subsequent attribute or test logic should be able to point back to the source of evidence or code context provided here, thereby reducing the need for arbitrary inferences in large models.
[0060] 2.2 Constraint Extraction
[0061] This step addresses the input domain validity issue by directly extracting precondition constraints from the source code to constrain the test input generation space. It uses an Abstract Syntax Tree (AST) structure to identify assertions, type / range checks, and exception triggering conditions, and, when necessary, incorporates lightweight data flow backtracking to map local constraints back to the function parameter level, forming an executable description of input constraints. This results in test cases that are more focused on the "semantic validity domain," reducing numerous invalid failures caused by unmet preconditions, thus allowing the test budget to be used for regions that truly test semantics.
[0062] 2.3 Cross-function semantic graph modeling
[0063] This step is responsible for constructing a cross-functional semantic graph, explicitly characterizing the implicit cross-functional contracts commonly found in real-world software libraries. The nodes of the graph are functions, and the edges represent the relation types that can be used to construct cross-functional attributes, such as inverse, round-trip, state invariant, and relational identity. The core value of this semantic graph lies in expanding the search space for "attribute generation" from single functions to cross-functional combinations, enabling the system to prioritize cross-functional attributes that are more sensitive to real-world defects and have stronger constraints.
[0064] 2.4 Evidence-Grounded Planner Agent
[0065] After obtaining the index context, input constraints, and cross-function semantic neighborhood, the agent begins to plan candidate attributes for the objective function. Its key mechanism is "evidence constraints": each attribute not only provides an executable semantic description, but also outputs its evidence anchors (such as explicit descriptions from docstrings, assertions in code, or verifiable relational patterns), and marks the alignment between the attribute and the evidence.
[0066] like Figure 2 As shown, unlike traditional methods that allow LLMs to run freely, this agent is designed to generate attributes within the evidence boundary and prioritizes the use of cross-functional associations provided by semantic graphs to organize the attribute structure, thereby improving the interpretability of attributes and reducing the risk of false alarms caused by illusory attributes.
[0067] 2.5 Attribute Testing Synthesis Agent (PBT Synthesis Agent)
[0068] This agent writes attributes into runnable attribute tests. It transforms the planned attributes into assertion logic, extracts the input domain information provided by the agent based on constraints, generates corresponding input strategies, and finally produces complete attribute test code (including necessary imports, auxiliary constructions, cross-function call sequences, and assertions). The goal of this agent is not only to be compileable, but also to ensure that the test structure can stably trigger key semantic paths: the input strategy must cover the boundaries of the valid domain, cross-function calls must reflect semantic relationships, and assertions must be aligned with evidence and have binding force.
[0069] This invention utilizes an open-source library based on Hypothesis to develop attribute tests. Figure 3 This demonstrates the basic form of property testing based on the Hypothesis library.
[0070] 2.6 Adversarial Validator Agent
[0071] This agent acts as the framework's strength enhancement engine, used to overcome critical aspects of superficial attributes. Instead of directly generating the final test, it attempts to construct a semantically flawed counter-implementation that passes the current attribute test, used to verify the existence of vulnerabilities in the attribute. Once a bypass is found, the agent provides refined suggestions and drives the system back to the attribute planning phase. This could involve supplementing necessary conditions, strengthening assertions, introducing more cross-functional relationships (expanding the semantic graph neighborhood), or adjusting the input strategy to cover areas that can penetrate vulnerabilities. Through this adversarial closed loop, attributes gradually evolve from weak constraints to strong constraints that are difficult to satisfy with flawed implementations, thus improving defect detection capabilities from a mechanistic perspective.
[0072] Simultaneously, the system collects results after running attribute tests, providing evidence for the existence of real defects and feedback signals for adversarial bypass detection and refinement. It outputs failure examples and anomaly information as objective evidence for closed-loop iteration. Finally, when the adversarial agent can no longer bypass or the termination condition is met, the system outputs an attribute test suite and a reproducible report that can be directly used for CI. Figure 4 The pseudocode illustrates the entire adversarial process.
[0073] In another embodiment, an attribute test generation system is provided, which corresponds one-to-one with the attribute test generation methods in the above embodiments. The system includes:
[0074] The parsing and context building module is used to build structured indexes;
[0075] The constraint extraction module is used to generate input precondition constraints;
[0076] The cross-function semantic graph construction module is used to construct graph structures that represent the semantic relationships between functions;
[0077] The attribute planning module for evidence constraints is used to generate candidate attributes for binding evidence sources;
[0078] The attribute test synthesis module is used to generate test code that includes constraint-driven input strategies and evidence-aligned assertions;
[0079] The adversarial verification and iterative refinement module is used to construct the reverse implementation, generate refinement suggestions, and drive closed-loop iteration.
[0080] The coordinator is used to schedule the execution of each module in a closed-loop process: attribute planning, test synthesis, adversarial verification, and attribute refinement.
[0081] For specific limitations regarding the attribute test generation system, please refer to the limitations on the attribute test generation method above, which will not be repeated here. Each module in the aforementioned attribute test generation system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0082] In another embodiment of the present invention, a terminal device is provided, comprising a processor and a memory. The memory stores a computer program, which includes program instructions. The processor executes the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to achieve a corresponding method flow or corresponding function. The processor described in this embodiment of the present invention can be used for the operation of an attribute testing generation method.
[0083] In another embodiment of the present invention, a storage medium is provided, specifically a computer-readable storage medium (Memory). This computer-readable storage medium is a memory device in a terminal device used to store programs and data. It is understood that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and extended storage media supported by the terminal device. The computer-readable storage medium provides storage space that stores the terminal's operating system. Furthermore, this storage space also stores one or more instructions suitable for loading and execution by a processor. These instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device.
[0084] One or more instructions stored in a computer-readable storage medium can be loaded and executed by a processor to implement the corresponding steps of the attribute test generation method in the above embodiments; one or more instructions in the computer-readable storage medium are loaded and executed by a processor.
[0085] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0086] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0087] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has 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 of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for generating attribute tests based on cross-functional semantic graphs and adversarial iteration, characterized in that, Includes the following steps: S1: Parse the target code repository and build a structured index containing function signatures, parameters, return values, docstrings, comments, and call dependencies; S2: Extract input precondition constraints from the source code of the target code repository. The extraction includes identifying assertions, type / range checks and exception triggering conditions based on abstract syntax trees, and mapping local constraints to the function parameter level by combining data flow backtracking. S3: Construct a cross-function semantic graph, where nodes represent functions and edges represent semantic relationships between functions. The semantic relationships include at least one of inverse function relationships, round-trip relationships, state-invariant relationships, or relational identity relationships. S4: Based on the structured index, input precondition constraints and cross-function semantic graph, plan candidate attributes and bind traceable evidence sources and attribute-evidence alignment methods to each candidate attribute. The evidence sources include document strings, code comments, source code assertions or verifiable algebraic / relational patterns. S5: The candidate attributes are synthesized into attribute test code, which includes an input strategy generated based on the input precondition constraints, a cross-function call sequence, and assertion logic aligned with the evidence source; S6: Perform adversarial verification: Attempt to construct an anti-implementation that can pass the current attribute test code but has semantic errors; if the construction is successful, generate a refinement suggestion based on the bypass information, adjust the candidate attributes based on the refinement suggestion, and return to step S4 for iteration until the anti-implementation cannot be constructed or the preset termination condition is met.
2. The attribute test generation method according to claim 1, characterized in that, The input precondition constraints generated in step S2 are used to constrain the input generation strategy for attribute testing, so as to reduce invalid test cases and noise failures caused by the input not meeting the preconditions.
3. The attribute test generation method according to claim 1, characterized in that, The construction of the cross-function semantic graph in step S3 includes at least one of rule matching, call relationship mining, document retrieval enhancement, or dynamic execution trajectory analysis.
4. The attribute test generation method according to claim 1, characterized in that, In step S4, the set of adjacent functions that have semantic association with the target function in the cross-function semantic graph is used first to construct cross-function combination attributes.
5. The attribute test generation method according to claim 1, characterized in that, The refinement suggestions in step S6 include: supplementing necessary attribute conditions, strengthening assertion logic, expanding the coverage of cross-function semantic relationships, or adjusting the input strategy to cover key boundary areas.
6. The attribute test generation method according to claim 1, characterized in that, The preset termination conditions include reaching a threshold number of iterations, multiple consecutive failures of adversarial verification, or exhaustion of test resource budget.
7. An attribute test generation system implementing the method according to any one of claims 1-6, characterized in that, include: The parsing and context building module is used to build structured indexes; The constraint extraction module is used to generate input precondition constraints; The cross-function semantic graph construction module is used to construct graph structures that represent the semantic relationships between functions; The attribute planning module for evidence constraints is used to generate candidate attributes for binding evidence sources; The attribute test synthesis module is used to generate test code that includes constraint-driven input strategies and evidence-aligned assertions; The adversarial verification and iterative refinement module is used to construct the reverse implementation, generate refinement suggestions, and drive closed-loop iteration. The coordinator is used to schedule the execution of each module in a closed-loop process: attribute planning, test synthesis, adversarial verification, and attribute refinement.
8. The attribute test generation system according to claim 7, characterized in that, When the adversarial verification and iterative refinement module detects that an attribute can be bypassed, it triggers the attribute planning module to introduce new cross-functional relationships or adjust the input strategy boundaries.
9. The attribute test generation system according to claim 7, characterized in that, The system supports a multi-agent collaborative architecture, where each functional module can be configured as an independent agent or a merged role, and the underlying language model can be replaced with a large language model from a different vendor or architecture.
10. A computer-readable storage medium having a computer program stored thereon, the computer program, when executed by a processor, implementing the attribute test generation method as described in any one of claims 1-6.