Intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy test

By combining combined optimization algorithms and fuzzy testing, the problems of high redundancy of use cases and low proportion of effective test cases in the existing technology are solved, efficient parameter generation and testing optimization are achieved, and testing depth and efficiency are improved.

CN120492359AActive Publication Date: 2025-08-15四川互慧软件有限公司
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510990191.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-18
Publication Date
2025-08-15
Estimated Expiration
2045-07-18

AI Technical Summary

Technical Problem

The use cases generated by the prior art in strong parameter correlation scenarios are highly redundant, and the key exception combination cannot be identified. The proportion of effective test cases generated by fuzzy testing tools is low, and manual writing of constraint verification logic leads to a large amount of testing time.

Method used

Combining the combination optimization algorithm and fuzz testing, through parameter space initialization, directional fuzzy mutation, dynamic weight adjustment and multi-level constraint processing, a defect-mode-driven parameter generation optimization mechanism is built to achieve a dynamic balance between parameter combination coverage and fuzz testing effectiveness.

Benefits of technology

It realizes the test effect of high defect detection rate and low redundancy, improves the testing depth and effectiveness, improves the testing efficiency and resource utilization, and is suitable for interface testing scenarios with complex parameter constraints.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120492359A_ABST
    Figure CN120492359A_ABST
Patent Text Reader

Abstract

The invention provides an intelligent parameter generation method combining a combinatorial optimization algorithm and a fuzzy test, and relates to the technical field of software test parameter generation, and the method comprises the following steps: carrying out parameter space initialization; generating a basic use case and performing directional fuzzy variation on the basic use case; performing dynamic weight adjustment on various test strategies; carrying out multi-level constraint processing and carrying out constraint conflict resolution; feedback data is obtained through testing, and a variation strategy is selected based on the feedback data. The method has the advantages that the dynamic balance between the parameter combination coverage rate and the fuzzy test effectiveness is realized, a parameter generation optimization mechanism driven by a defect mode is constructed, and joint solution for efficiently processing multiple types of constraints is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software test parameter generation, and in particular to an intelligent parameter generation method combining a combinatorial optimization algorithm with fuzzy testing. Background Art

[0002] When conducting software testing, it is necessary to produce test cases and related parameters.

[0003] In existing technologies, traditional orthogonal methods generate highly redundant test cases in scenarios with strongly correlated parameters and fail to identify key anomaly combinations (such as the combined effects of amount overflow and currency type mismatch). Furthermore, existing fuzz testing tools (such as AFL) generate a low percentage of valid test cases and have poor coverage of semantic anomalies in structured parameters (such as JSON with more than 3 nested levels). Furthermore, mainstream tools (such as Postman) rely on manually written constraint validation logic, resulting in a significant portion of testing time being consumed by parameter validation.

[0004] Therefore, it is necessary to improve the existing technology to achieve a dynamic balance between parameter combination coverage and fuzz testing effectiveness, build a defect pattern-driven parameter generation optimization mechanism, and realize the efficient processing of joint solutions of multiple types of constraints. Summary of the Invention

[0005] The purpose of the present invention is to provide an intelligent parameter generation method that combines a combinatorial optimization algorithm with fuzzy testing, which can achieve a dynamic balance between parameter combination coverage and fuzzy testing effectiveness, construct a defect pattern-driven parameter generation optimization mechanism, and achieve efficient processing of the joint solution of multiple types of constraints.

[0006] The present invention is achieved through the following technical solutions: The intelligent parameter generation method combining the combinatorial optimization algorithm and fuzz testing includes the following steps: Initialize the parameter space; Generate basic use cases and perform directed fuzzy mutation on the basic use cases; Dynamically adjust the weights of various testing strategies; Perform multi-level constraint processing and resolve constraint conflicts; Feedback data is obtained through testing and mutation strategies are selected based on the feedback data.

[0007] Preferably, the method for initializing the parameter space is: Parse the interface parameter definition and extract parameter information, including parameter type, value range, and associated constraints; A parameter combination tree structure is constructed to identify strongly correlated parameter groups, which represent parameter groups with correlation coefficients greater than 0.7.

[0008] Preferably, the method for generating a basic use case is: Generate basic use cases covering all parameter pairwise combinations based on orthogonal method; The method for performing directed fuzzy mutation on the basic use case is: When the parameter type is a numeric parameter, boundary breaking and parameter confusion are performed; When the parameter type of the parameter is an enumeration parameter, an illegal enumeration value is inserted; When the parameter type of a parameter is a format-constrained parameter, a syntactically correct but semantically abnormal value is constructed.

[0009] Preferably, the method for dynamically adjusting the weights of various test strategies is: Calculate the weight of the strategy based on the feedback data obtained from real-time testing : ; ; in, is the defect density, is the path coverage, To execute time-consuming, 、 and is the weight; When a boundary value defect is detected, the weight of the numerical mutation is increased by 30%; Increased character set mutation frequency when encountering format validation defects.

[0010] Preferably, the weight setting method is: ; ; .

[0011] Preferably, the method for performing multi-level constraint processing includes: Parse grammatical constraints, logical constraints, and business constraints; The method for resolving constraint conflicts is: When multiple constraints conflict, business constraints are prioritized and the conflict is recorded.

[0012] Preferably, the method for parsing the grammatical constraints is through regular expression matching; the method for parsing the logical constraints is to call the Z3 solver; the method for parsing the business constraints is to inject a custom verification function.

[0013] Preferably, the method of obtaining feedback data through testing and selecting a mutation strategy based on the feedback data is: Assign initial weights to different types of defects: During the test, the corresponding weights are updated based on the initial weights according to the defects that occur; The mutation strategy is selected based on the weight of the defect.

[0014] Preferably, the method for updating the corresponding weight according to the defects that occur is: ; in, is the updated weight, is the initial weight, a is a constant greater than 1, and times is the number of times the corresponding defect occurs; The maximum threshold is set to 1.2, and if the weight reaches the maximum threshold, no further update is performed.

[0015] Preferably, the method of selecting a mutation strategy based on the initial weight according to the weight of the defect is: For defects with weights greater than 0.8, boundary values and illegal values are generated for specific parameters; For defects with a weight not less than 0.5 and not greater than 0.8, superimpose 2-3 associated abnormal conditions; For defects with weights less than 0.5, random mutation is performed.

[0016] The technical solution of the present invention has at least the following advantages and beneficial effects: The present invention optimizes the test case generation process through a dynamic feedback mechanism to achieve a high defect detection rate and low redundancy test effect; This paper generates basic test cases by adopting combinatorial optimization methods such as orthogonal design to ensure the coverage of pairwise combinations in the parameter space. At the same time, it introduces a directed fuzzy mutation strategy to impose outliers and boundary disturbances on key parameter positions, thereby increasing the probability of triggering potential defects and enhancing the depth and effectiveness of testing. The present invention dynamically adjusts the weights of different mutation strategies based on the real-time feedback of defect density, path coverage, and execution time during the test execution process, achieving online optimization and rapid iteration of test strategies, effectively improving test efficiency. The present invention has a higher test resource utilization rate, and the defect weight growth adopts a logarithmic function to avoid excessive dominance of a single defect mode, thereby enhancing system stability and generalization capability; Aiming at the situation where there are multi-level and multi-type constraints between parameters, the present invention designs a constraint parsing and conflict resolution mechanism to avoid a large number of invalid test cases caused by illegal combinations in traditional fuzz testing, thereby improving the legitimacy and execution success rate of test cases. The present invention is applicable to interface test scenarios with complex parameter constraints and has good versatility and scalability. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A schematic flow chart of an intelligent parameter generation method combining a combinatorial optimization algorithm and fuzzy testing provided in Example 1 of the present invention; Figure 2 Schematic diagram of the results of the system modules provided in Example 1 of the present invention. DETAILED DESCRIPTION

[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations.

[0019] Example 1 This embodiment provides an intelligent parameter generation method that combines a combination optimization algorithm with fuzzy testing. Figure 1 , including the following steps: Initialize the parameter space; Generate basic use cases and perform directed fuzzy mutation on the basic use cases; Dynamically adjust the weights of various testing strategies; Perform multi-level constraint processing and resolve constraint conflicts; Feedback data is obtained through testing and mutation strategies are selected based on the feedback data.

[0020] This embodiment can be used to improve the diversity and effectiveness of parameter generation and enhance the ability of test cases to detect potential defects. First, a corresponding parameter space is constructed based on the functional requirements and parameter definitions of the system or interface under test. After the parameter space is initialized, a set of basic test cases is generated. These basic test cases cover the main combinations in the parameter space to ensure the basic breadth of the test. Based on this, targeted fuzzy mutation is performed. This can perturb, replace, or expand the boundaries of the original test case while maintaining the rationality of the original structure to introduce more potential abnormal inputs. Dynamic weight adjustment can be used to obtain the value and effectiveness of different test strategies. Because parameters may have multiple levels of logical dependencies and constraints, these constraints need to be parsed and conflicts resolved. Finally, after the test is completed, the system collects feedback data generated during the run. By analyzing this feedback data, the quality and effectiveness of the current test set can be determined. Based on this analysis, the direction and strategy selection for the next round of fuzzy mutation are adjusted. In other words, closed-loop optimization of fuzzy test mutation is achieved through feedback-driven optimization, improving test effectiveness.

[0021] In the specific implementation, see Figure 2 , the following system modules implement the above solution: First, a hybrid optimization engine is used to initialize the parameter space, generate basic use cases, perform directed fuzzy mutation on the basic use cases, and dynamically adjust the weights of various test strategies. Then, the intelligent constraint solver is used to process multi-level constraints and resolve constraint conflicts; Finally, the mutation strategy is selected based on feedback data through the feedback-driven optimization mechanism.

[0022] In this embodiment, the method for initializing the parameter space is: Parse the interface parameter definition and extract parameter information, including parameter type, value range, and associated constraints; A parameter combination tree structure is constructed to identify strongly correlated parameter groups, which represent parameter groups with correlation coefficients greater than 0.7.

[0023] When initializing the parameter space, you can structure the interface parameter information and identify the relationships between them. For example, through interface documentation such as OpenAPI (or Swagger), you can extract each parameter's type (e.g., string, integer, Boolean), value range (e.g., 1-100), format requirements (e.g., email, date-time), and dependencies (e.g., parameter B is valid only when parameter A is true). You can then organize all parameters into a "tree" structure, identifying which ones are strongly correlated. A strong correlation might mean that these parameters typically change together, such as "currency" and "amount unit." Traditional methods treat all parameters independently and ignore parameter correlation analysis, potentially leading to a rapid explosion in the number of parameter combinations. This embodiment identifies strong correlations between parameters and removes some redundant combinations, significantly reducing the testing burden.

[0024] As a preferred solution, the method for generating basic use cases is: Generate basic use cases covering all parameter pairwise combinations based on orthogonal method; The method for performing directed fuzzy mutation on the basic use case is: When the parameter type is a numeric parameter, boundary breaking and parameter confusion are performed; When the parameter type of the parameter is an enumeration parameter, an illegal enumeration value is inserted; When the parameter type of a parameter is a format-constrained parameter, a value that is syntactically correct but semantically abnormal is constructed.

[0025] This example generates representative parameter combinations and strategically incorporates "erroneous" or "borderline" data. This example uses an orthogonal approach to cover all pairwise combinations of parameters. This strategy aims to cover as many interaction patterns as possible without generating every possible combination. For example, 10 parameters might generate thousands of possible combinations, but using an orthogonal approach, only 45 combinations can be generated, still covering every possible pairwise combination.

[0026] When performing directed fuzzy mutation, if the parameter type is numeric, boundary breaching and parameter obfuscation are performed. Parameter obfuscation can replace numeric values with strings. If the parameter type is enumeration, illegal enumeration values can be inserted, meaning that enumeration values not defined in the definition, such as "non-standard country codes," can be inserted. If the parameter type is format-constrained, syntactically correct but semantically incorrect values can be constructed, for example, entering 2100-01-01 in a date field.

[0027] Traditional fuzz testing uses random mutations, which result in 90% invalid use cases. The solution in this embodiment generates guidance on mutation directions through combination, increasing the effectiveness to 78%.

[0028] Next, the method for dynamically adjusting the weights of various test strategies is as follows: Calculate the weight of the strategy based on the feedback data obtained from real-time testing : ; ; in, is the defect density, i.e. the number of defects triggered by unit test cases, Path coverage is the parameter used to measure the degree to which the current test case set covers the execution path of the system under test. To execute time-consuming, 、 and is the weight; Based on the above weight model, when the system detects a specific type of defect during testing, the basic weight of the relevant mutation strategy is further adjusted, that is: When a boundary value defect is detected (such as a numerical parameter exceeding the preset upper limit), the numerical mutation weight is increased by 30%; Increased the frequency of character set mutation when encountering format validation defects (such as emails containing emojis).

[0029] Specifically, in order to take into account the defect trigger rate, coverage breadth and execution efficiency, the weight setting method is as follows: ; ; .

[0030] This example uses an expression to calculate and measure the value of each mutation strategy. The setting means that the more problems found, the wider the coverage path, and the faster the operation, the more valuable the strategy. The weights of the strategies calculated by the above scheme can be used by the system to adjust which strategies should be called next, for example: If a strategic If the value is very high (for example, higher than a preset threshold), the system can increase the frequency of using the strategy and generate more test cases of this type of variation; If a strategic If it is very low (for example, below a preset threshold), the system can reduce its usage frequency to save resources, or temporarily exclude it to avoid waste.

[0031] Through the above-mentioned dynamic weight adjustment mechanism, the test strategy can adaptively evolve according to the defect distribution and test results during execution, thereby improving test efficiency and defect coverage rate, and enhancing overall test quality.

[0032] Then, as a preferred solution, the method for performing multi-level constraint processing includes: Parse grammatical constraints, logical constraints, and business constraints; The method for resolving constraint conflicts is: When multiple constraints conflict, business constraints are prioritized and the conflict is recorded.

[0033] On this basis, the method for parsing the grammatical constraints is to match through regular expressions; the method for parsing the logical constraints is to call the Z3 solver; and the method for parsing the business constraints is to inject a custom verification function.

[0034] The above scheme aims to ensure that the automatically generated test cases not only meet the legality of the input format, but also are compatible with business logic and semantic rules, thereby improving the validity of test data and defect triggering capabilities.

[0035] Syntax constraints are used to define the basic format or data structure of parameters, such as string length, date format, numeric range, and regular expression patterns. When performing parsing, the parameter syntax definition information can be extracted from the interface description document (such as OpenAPI, Swagger, RAML, etc.) or protocol definition language. For each parameter field, the syntax-level constraint rules are identified based on the definition information and converted into a standard regular expression. The purpose of this constraint is to test the parameter value and apply a regular expression to the matching judgment. If the match is successful, it is considered to meet the syntax constraint. Otherwise, it is recorded as syntax non-compliant.

[0036] Logical constraints, on the other hand, can define the relationship logic between different parameters, such as "When parameter A is true, parameter B must not be empty" or "Amount must not exceed Balance." During parsing, the Z3 solver is called to parse the constraints. By using the Z3 solver to model and symbolically calculate logical constraints, it enables automatic parsing and verification of constraint relationships between parameters. It supports complex nested conditions and the joint solution of multiple constraints, avoiding the redundancy and misjudgment issues of traditional rule-based matching methods when dealing with high-dimensional relational logic, significantly improving the rationality of test data generation and path coverage.

[0037] Business constraints often rely on domain knowledge or a business rule base, such as "users must be over 18 to register." Dynamic parsing and invocation of business-layer rules can be achieved by injecting custom validation functions.

[0038] During the generation of some test cases, multiple constraints at different levels may be triggered at the same time, resulting in conflicts between constraints. To this end, this embodiment designs a set of constraint conflict resolution strategies. When two or more constraints are identified as conflicting (i.e., they cannot be satisfied at the same time under the same input), the system handles them according to the preset priority strategy. The highest priority is set to the localized and most targeted business constraints. In addition, the remaining constraint priorities can be set to logical constraints > syntactic constraints. The remaining conflicting constraints are written into the log or debug report for reference by the test analysis module.

[0039] Through the above-mentioned multi-level constraint analysis and conflict resolution mechanism, this embodiment can achieve a balance between legality control and abnormality maintenance under complex parameter input conditions, effectively improving the rationality, controllability and coverage of test case generation.

[0040] Finally, the method of obtaining feedback data through testing and selecting a mutation strategy based on the feedback data is: Assign initial weights to different types of defects: During the test, the corresponding weights are updated based on the initial weights according to the defects that occur; The mutation strategy is selected based on the weight of the defect.

[0041] As a further optimization, the method for updating the corresponding weights according to the defects that occur is: ; in, is the updated weight, is the initial weight, a is a constant greater than 1, and times is the number of times the corresponding defect occurs; The maximum threshold is set to 1.2, and if the weight reaches the maximum threshold, no further update is performed.

[0042] The method for selecting a mutation strategy based on the initial weight and the weight of the defect is: For defects with weights greater than 0.8, boundary values and illegal values are generated for specific parameters; For defects with a weight not less than 0.5 and not greater than 0.8, superimpose 2-3 associated abnormal conditions; For defects with weights less than 0.5, random mutation is performed.

[0043] For a predefined set of defect types, an initial weight is preset for each defect type. This initial weight is used to represent the degree of impact of the defect on the system's test results. During testing, the system records the triggering of each defect type in real time. When a defect type is detected, its corresponding weight is updated based on the cumulative number of times the defect occurs. To prevent the rapid growth of the weight of individual high-frequency defect types from skewing the test strategy, the system sets a maximum threshold for defect weights of 1.2. When the weight of a defect type reaches this threshold, it is no longer incrementally updated to ensure weight convergence and strategy diversity.

[0044] Based on the updated weights corresponding to each defect type, the system adopts a hierarchical mutation strategy in the subsequent test case generation process. Specifically: For defects with a weight greater than 0.8, boundary values and illegal values are generated for specific parameters. That is, a directed boundary mutation strategy is used to construct boundary values, out-of-bounds values, illegal enumeration values, and other typical data that trigger this type of defect. For defects with a weight not less than 0.5 and not greater than 0.8, superimpose 2-3 associated abnormal conditions, that is, adopt a combined abnormal strategy and introduce multiple boundary or abnormal conditions of related parameters at the same time to simulate more complex or hidden abnormal triggering scenarios For defects with weights less than 0.5, random mutation is performed, that is, a random fuzzy mutation strategy is adopted to perform conventional random perturbations or type fuzzification to expand the input space coverage.

[0045] The feedback-driven weight adjustment mechanism of this embodiment can realize dynamic tuning of the test strategy, tilting test resources towards error-prone areas, thereby significantly improving the coverage and efficiency of defect detection. The comparison of the effect of the solution of this embodiment and the traditional method is shown in Table 1: Table 1

[0046] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention.

Claims

1. An intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy testing, characterized in that: The following steps are involved: Initialize the parameter space; Generate basic use cases and perform directed fuzzy mutation on the basic use cases; Dynamically adjust the weights of various testing strategies; Perform multi-level constraint processing and resolve constraint conflicts; Feedback data is obtained through testing and mutation strategies are selected based on the feedback data.

2. The intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy testing according to claim 1 is characterized in that: The method for initializing the parameter space is: Parse the interface parameter definition and extract parameter information, including parameter type, value range, and associated constraints; A parameter combination tree structure is constructed to identify strongly correlated parameter groups, which represent parameter groups with correlation coefficients greater than 0.

7.

3. The intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy testing according to claim 2 is characterized in that: The method for generating basic use cases is: Generate basic use cases covering all parameter pairwise combinations based on orthogonal method; The method for performing directed fuzzy mutation on the basic use case is: When the parameter type is a numeric parameter, boundary breaking and parameter confusion are performed; When the parameter type of the parameter is an enumeration parameter, an illegal enumeration value is inserted; When the parameter type of a parameter is a format-constrained parameter, a syntactically correct but semantically abnormal value is constructed.

4. The intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy testing according to claim 1 is characterized in that: The method for dynamically adjusting the weights of various test strategies is as follows: Calculate the weight of the strategy based on the feedback data obtained from real-time testing : ; ; in, is the defect density, is the path coverage, To execute time-consuming, 、 and is the weight; When a boundary value defect is detected, the weight of the numerical mutation is increased by 30%; Increased character set mutation frequency when encountering format validation defects.

5. The intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy testing according to claim 4 is characterized in that: The weight setting method is: ; ; 。 6. The intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy testing according to claim 1 is characterized in that: The method for performing multi-level constraint processing includes: Parse grammatical constraints, logical constraints, and business constraints; The method for resolving constraint conflicts is: When multiple constraints conflict, business constraints are prioritized and the conflict is recorded.

7. The intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy testing according to claim 6 is characterized in that: The method for parsing the grammatical constraints is through regular expression matching; the method for parsing the logical constraints is to call the Z3 solver; the method for parsing the business constraints is to inject a custom verification function.

8. The intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy testing according to claim 1 is characterized in that: The method of obtaining feedback data through testing and selecting a mutation strategy based on the feedback data is: Assign initial weights to different types of defects: During the test, the corresponding weights are updated based on the initial weights according to the defects that occur; The mutation strategy is selected based on the weight of the defect.

9. The intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy testing according to claim 8, characterized in that: The method for updating the corresponding weight according to the defects that occur is: ; in, is the updated weight, is the initial weight, a is a constant greater than 1, and times is the number of times the corresponding defect occurs; The maximum threshold is set to 1.2, and if the weight reaches the maximum threshold, no further update is performed.

10. The intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy testing according to claim 9 is characterized in that: The method for selecting a mutation strategy based on the initial weight and the weight of the defect is: For defects with weights greater than 0.8, boundary values and illegal values are generated for specific parameters; For defects with a weight not less than 0.5 and not greater than 0.8, superimpose 2-3 associated abnormal conditions; For defects with weights less than 0.5, random mutation is performed.

Citation Information

Patent Citations

  • Parallel fuzzy test scheduling method and device based on variation strategies

    CN110147310A

  • Fuzzy testing method for intelligent contract calling sequence optimization and resource allocation guidance

    CN115562987A

  • Fuzzy test optimization model training method and device, fuzzy test optimization method and device, equipment and medium

    CN119065976A

  • Intelligent boundary test case generation method and system based on multi-dimensional parameter analysis

    CN119883938A