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

Through the intelligent boundary test case generation method based on multi-dimensional parameter analysis, the problem of insufficient parameter analysis and boundary coverage in the existing technology is solved, and deep testing of complex interfaces and high coverage test data generation is realized, which improves the testing efficiency and quality.

CN119883938AInactive Publication Date: 2025-04-25四川互慧软件有限公司

Patent Information

Application Number
CN202510354140.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-04-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art has limitations in parameter analysis, boundary coverage and script generation in software testing, resulting in limited testing depth and breadth, and it is impossible to effectively cover the deep parameters of complex interfaces and generate high coverage boundary/exception test data.

Method used

The intelligent boundary test case generation method based on multi-dimensional parameter analysis is adopted. By deeply analyzing multi-dimensional parameters, a flat parameter path mapping table is generated, intelligent boundary values ​​are dynamically generated, and executable test scripts are generated through the template engine.

Benefits of technology

It realizes in-depth analysis of complex interface parameter structures, generates boundary/exception test data with high coverage, reduces the repetition rate and maintenance cost of test scripts, and improves the coverage rate and exception detection capabilities of test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883938A_ABST
    Figure CN119883938A_ABST
Patent Text Reader

Abstract

The invention provides an intelligent boundary test case generation method and system based on multi-dimensional parameter analysis, and relates to the technical field of test case generation of software test automation, and the method comprises the following steps: analyzing multi-dimensional parameters: inputting a parameter schema, carrying out data analysis processing on parameters of non-data types, and storing the parameters of the non-data types into a database; outputting a flattened parameter path mapping table; generating an intelligent boundary value: performing constraint analysis on different types of parameters according to an analysis result to obtain the intelligent boundary value; script generation and optimization: an executable script is generated and optimized. The method has the advantages that a complex interface parameter structure is deeply analyzed, high-coverage-rate boundary / abnormal test data is generated, and maintainable parameterized test scripts are automatically generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of test case generation for software test automation, and in particular to a method and system for generating intelligent boundary test cases based on multi-dimensional parameter analysis. Background Art

[0002] With the rapid development of software development technology, testing is one of the important links to ensure software quality.

[0003] In the actual testing process, in order to improve the test efficiency and coverage, automated testing tools are usually used to generate test scripts. However, existing technologies still have many limitations in parameter parsing, boundary coverage, and script generation, which restrict the depth and breadth of testing. For example, traditional tools (such as Postman) can only identify primary parameters and cannot automatically expand and parse nested structures (such as nested arrays of JSON objects), resulting in the lack of deep parameter test items in the generated test cases; existing fuzzy testing methods use a fixed rule base and cannot dynamically generate context-related anomalies based on parameter semantics, with boundary value coverage of less than 60%; test scripts generated by mainstream frameworks (such as Swagger Codegen) lack parameterized design, with a code duplication rate of up to 70%, and high maintenance costs.

[0004] Therefore, there is an urgent need to optimize the generation of test cases to achieve in-depth analysis of complex interface parameter structures, generate high-coverage boundary / abnormal test data, and automatically generate maintainable parameterized test scripts. Summary of the invention

[0005] The purpose of the present invention is to provide an intelligent boundary test case generation method and system based on multi-dimensional parameter analysis, which can realize in-depth analysis of complex interface parameter structures, generate high-coverage boundary / abnormal test data, and automatically generate maintainable parameterized test scripts.

[0006] The present invention is achieved through the following technical solutions: The method for generating intelligent boundary test cases based on multi-dimensional parameter analysis includes the following steps: Parse multi-dimensional parameters: Input parameter schema, perform data parsing on parameters of different data types, and output a flattened parameter path mapping table; Generate intelligent boundary values: perform constraint analysis on different types of parameters according to the analysis results to obtain intelligent boundary values; Script generation and optimization: Generate executable scripts based on intelligent boundary values ​​and perform optimization.

[0007] Preferably, when the data type of the parameter is an object, the method for performing data parsing is: Iterate over all properties of an object; Recursively call the resolve method for each attribute; Generates a key name with a hierarchical path.

[0008] Preferably, when the data type of the parameter is an array, the method for performing data parsing is: Extract the schema definition of the elements of the array; Identify array positions by adding wildcard characters.

[0009] Preferably, when the data type of the parameter is a basic type, the method for performing data parsing processing is to directly record the path and constraints.

[0010] Preferably, when outputting the flattened parameter path mapping table, the nested structure is flattened by a recursive parsing algorithm.

[0011] Preferably, when the parameter is a numerical value, the method for performing constraint analysis to obtain the intelligent boundary value is: If there is a maximum value constraint max and a minimum value constraint min, then: When the parameter is an integer, get the deviation value , the obtained multiple boundary test values ​​include min-1, min, min+1, median, max-1, max and max+1, where the median is between min+1 and max-1; When the parameter is a floating point number, get the deviation value , multiple boundary test values ​​obtained include min- 、min、min+ , median, max- , max and max+ , where the median is between min+ and max- between; If there are no constraints, then: For 32-bit integer parameters, the boundary value is .

[0012] Preferably, when the parameter is of string type, the method for performing constraint parsing to obtain the intelligent boundary value is: Perform regular constraint parsing: decompose regular expression atomic patterns and generate compliant samples; Generate injection attack use cases: Cross-combine multiple attack vectors based on the abnormal pattern library and perform context-sensitive processing, including adding escape characters in JSON format.

[0013] Preferably, the script generation and optimization method is: Generate executable script files through template engine; Implement dynamic parameterization.

[0014] Preferably, the method for generating an executable script file through a template engine is: Read parameterized test template file; Dynamically inject multiple elements, including test case datasets, assertion rules, and data-driven tags; Generate an executable script file, wherein the format of the executable script file includes a Python / pytest format example; The method for implementing dynamic parameterization comprises: Identifying a fixed value placeholder of the executable script file; Replace the fixed value placeholder with a variable reference and generate a parameter configuration file; Establish a mapping relationship between the test data set and the script variables; Add data loading logic.

[0015] The present invention also provides an automated script generation system based on multi-dimensional parameter analysis, which is applied to any of the above-mentioned intelligent boundary test case generation methods based on multi-dimensional parameter analysis. include: Multidimensional parameter parsing engine: used to input parameter schema, perform data parsing for parameters of different data types, and output a flattened parameter path mapping table; Intelligent boundary value generation module: used to perform constraint analysis on different types of parameters according to the analysis results to obtain intelligent boundary values; Script generation engine: used to generate executable scripts based on intelligent boundary values ​​and perform optimization.

[0016] The technical solution of the present invention has at least the following advantages and beneficial effects: The present invention performs targeted analysis on multi-dimensional parameters, can fully cover deep parameters in complex structures, ensure that the generated test cases cover all parameter paths, and obtain comprehensive deep parameter test items; The present invention can perform constraint analysis for different types of parameters and automatically generate diverse boundary values ​​that meet the parameter constraints, which helps the generated boundaries to have higher coverage and generate more comprehensive test cases, thereby making the abnormal testing of boundaries more reliable and complete. The present invention automatically generates executable test scripts according to the acquired boundaries through a template engine, has strong flexibility and configurability, and improves the maintainability and scalability of the test scripts; The present invention realizes a fully automated test case generation process by seamlessly integrating the three links of parameter analysis, boundary value generation and script generation, greatly shortening the test case creation time; The present invention effectively improves the coverage of test cases, the anomaly detection capability and the maintainability of test scripts, while reducing the testing cost and manpower investment, thus facilitating promotion and implementation. BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 A schematic diagram of a flow chart of a method for generating intelligent boundary test cases based on multi-dimensional parameter analysis provided in Example 1 of the present invention; Figure 2 A schematic diagram of a process for analyzing multi-dimensional parameters provided in Example 1 of the present invention; Figure 3 A schematic diagram of the principles of an automated script generation system for multi-dimensional parameter parsing provided in Example 2 of the present invention. DETAILED DESCRIPTION

[0017] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 here can be arranged and designed in various different configurations.

[0018] Example 1 Intelligent boundary test case generation method based on multi-dimensional parameter analysis, see Figure 1 , including the following steps: Parse multi-dimensional parameters: Input parameter schema, perform data parsing on parameters of different data types, and output a flattened parameter path mapping table; Generate intelligent boundary values: perform constraint analysis on different types of parameters according to the analysis results to obtain intelligent boundary values; Script generation and optimization: Generate executable scripts based on intelligent boundary values ​​and perform optimization.

[0019] First, this embodiment can first perform deep analysis on multi-dimensional parameters and generate a flattened parameter path mapping table, thereby ensuring that the test case can fully cover all deep parameters in the complex structure and avoid test blind spots caused by insufficient analysis. In this way, this embodiment effectively solves the problem of the inability to automatically identify deep parameters in the prior art, thereby ensuring the comprehensiveness and accuracy of the interface test.

[0020] Secondly, in terms of generating test data, this embodiment dynamically generates boundary values ​​based on the type and constraint information of the parameters. This dynamic boundary value generation mechanism can ensure that the test data triggers the boundary conditions and abnormal states of the system as much as possible, thereby maximizing the potential system defects. The setting of boundaries is very important in test cases. This method of dynamically generating boundary values ​​greatly improves the diversity and boundary coverage of test data, which helps to maximize the triggering of abnormal conditions and discover potential problems during the test process.

[0021] Finally, this embodiment generates an executable test script through a template engine. Specifically, the template engine can automatically generate a test script with a standardized format and clear structure based on the template according to the flattened parameter path mapping table and the boundary value data set. This embodiment dynamically adjusts the parameters of the test case, and there is no need to modify the script logic due to changes in test data, thereby significantly reducing the repetition rate and maintenance cost of the test script. The generated script also has strong scalability and maintainability. When adding a new test scenario or modifying the test data, it can respond quickly, thereby greatly improving the efficiency of the test work.

[0022] In summary, this embodiment significantly improves the coverage of test cases, anomaly detection capabilities, and maintainability of test scripts by deeply parsing complex parameter structures, dynamically generating boundary test data, and automatically generating maintainable test scripts, and effectively solves the problems of missing deep parameter tests, insufficient boundary value coverage, and high script maintenance costs in the prior art. This method is widely applicable to various test scenarios and has important application value in improving system test quality, improving test efficiency, and reducing maintenance costs.

[0023] For parsing multidimensional parameters, please refer to Figure 2 , first classify different data types according to the data structure: In this embodiment, when the data type of the parameter is an object, the method for performing data parsing is: Iterate over all properties of an object; Recursively call the resolve method for each attribute; Generates a key name with a hierarchical path. An example is user.address.street.

[0024] The above solution uses recursive parsing to ensure that all attributes inside the object can be extracted, avoiding missing deep parameters. It can effectively avoid missing deep fields during testing, and regardless of the nesting depth of the object, complete parsing can be achieved through recursive parsing.

[0025] On the other hand, when the data type of the parameter is an array, the method for performing data parsing is: Extract the schema definition of the elements of the array; Identify array positions by adding wildcards, for example, items[*].id.

[0026] At the same time, when the data type of the parameter is a basic type, the method for data parsing is to directly record the path and constraints. Directly recording the path and constraints for basic type parameters can avoid redundant parsing. It is particularly noted that the parameter metadata obtained after parsing can be stored in the parameter feature library. Parameter metadata refers to data information such as the type, format, and constraints of the parameter itself.

[0027] Next, when outputting the flattened parameter path mapping table, the nested structure is flattened by a recursive parsing algorithm.

[0028] This embodiment proposes differentiated parsing strategies for parameters of different data types to achieve deep parsing of complex data types and generate a flattened parameter path mapping table, providing a basis for subsequent test data generation and script generation. The above solution inputs a nested schema and then parses it, and finally flattens the nested structure through a recursive parsing algorithm to avoid missing deep parameters and greatly improve test coverage. By flattening, complex data types are converted into independent path mapping tables, which reduces the difficulty of data processing and improves the reliability and accuracy of test case generation.

[0029] As a preferred solution of this embodiment, when the parameter is a numerical value, the method for performing constraint analysis to obtain the intelligent boundary value is: If there is a maximum value constraint max and a minimum value constraint min, then: When the parameter is an integer, get the deviation value , the obtained multiple boundary test values ​​include min-1, min, min+1, median, max-1, max and max+1, where the median is between min+1 and max-1; When the parameter is a floating point number, get the deviation value , multiple boundary test values ​​obtained include min- 、min、min+ , median, max- , max and max+ , where the median is between min+ and max- between; If there are no constraints, then: For 32-bit integer parameters, the boundary value is .

[0030] As a further preferred solution, the number of boundary test values ​​can be set according to the value range. For example, when the value range is smaller, more boundary test values ​​are required. Because the smaller the value range means the lower the value tolerance, the more sensitive the boundary needs to be, so the boundary test needs to be more rigorous and comprehensive. The specific solution can be that the number of boundary test values ​​N required is: ; in, represents rounding up, Represents the value range threshold, Represents the difference between the maximum and minimum values ​​of the parameter.

[0031] After obtaining the number of boundary test values ​​N, one of the boundary test values ​​is set to the median of max and min, and the rest are evenly divided near max and min. Among the number of boundary test values ​​assigned to max, one is set to max, and the rest are added or subtracted based on max according to integer multiples of the corresponding deviation value based on the parameter being a floating point or integer. Among the number of boundary test values ​​assigned to min, one is set to min, and the rest are added or subtracted based on min based on the parameter being a floating point or integer. For example, for integers, N is 9, then among the remaining eight, 4 are assigned to the vicinity of min and 4 are assigned to the vicinity of max. Among them, one of the 4 assigned to the vicinity of min is set to min, and the remaining three can be set to min-2, min-1 and min+1, or min-1, min, min+1 and min+2; among the 4 assigned to the vicinity of max, one is set to max, and the remaining three can be set to max-2, max1 and max+1, or max-1, min, max+1 and max+2.

[0032] When the parameter type is a string type, the method for performing constraint parsing to obtain the intelligent boundary value is: Perform regular constraint parsing: decompose regular expression atomic patterns and generate compliant examples, for example, ^[AZ]{3}$ generates "ABC"; Generate injection attack use cases: Cross-combine multiple attack vectors based on the abnormal pattern library and perform context-sensitive processing, including adding escape characters in JSON format.

[0033] The atomic pattern refers to the smallest constraint unit in the regular expression. The attack vector can come from the pre-configured abnormal pattern library, including more than 200 attack vectors such as XSS and SQL injection.

[0034] Finally, the script generation and optimization method is: Generate executable script files through the template engine; Implement dynamic parameterization.

[0035] Specifically, the method for generating an executable script file through a template engine is: Read parameterized test template file; Dynamically inject multiple elements, including test case datasets, assertion rules, and data-driven tags; Generate an executable script file, wherein the format of the executable script file includes a Python / pytest format example; The method for implementing dynamic parameterization comprises: Identifying a fixed value placeholder of the executable script file; Replace the fixed value placeholder with a variable reference and generate a parameter configuration file; Establish a mapping relationship between the test data set and the script variables; Add data loading logic.

[0036] In the test script, it is necessary to reduce the duplication rate and improve the test coverage. This embodiment uses a template engine to generate a test script. The core function of the template engine is to merge the predefined test case template with the dynamically generated data set, and finally generate a structured and executable test script. In the process of generating the script, dynamic injection of multiple elements can be achieved, with high coverage. The hierarchical test case data set can be obtained based on the preamble scheme of this embodiment; the assertion rules are usually used to verify the correctness of the test results, such as ensuring that the interface response time is within the set threshold through the response time threshold, and verifying whether the content of the returned data is correct through the response content check. Finally, the template engine merges the parameterized test template file with the dynamic data to generate an executable test script with high maintainability and high coverage.

[0037] Example 2 This embodiment provides an automated script generation system based on multi-dimensional parameter analysis, which is applied to the intelligent boundary test case generation method based on multi-dimensional parameter analysis in the above embodiment. Figure 3 ,include: Multidimensional parameter parsing engine: used to input parameter schema, perform data parsing for parameters of different data types, and output a flattened parameter path mapping table; Intelligent boundary value generation module: used to perform constraint analysis on different types of parameters according to the analysis results to obtain intelligent boundary values; Script generation engine: used to generate executable scripts based on intelligent boundary values ​​and perform optimization.

[0038] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. An intelligent boundary test case generation method based on multi-dimensional parameter analysis, characterized in that: The following steps are involved: Parse multi-dimensional parameters: Input parameter schema, perform data parsing on parameters of different data types, and output a flattened parameter path mapping table; Generate intelligent boundary values: perform constraint analysis on different types of parameters according to the analysis results to obtain intelligent boundary values; Script generation and optimization: Generate executable scripts based on intelligent boundary values ​​and perform optimization.

2. The method for generating intelligent boundary test cases based on multi-dimensional parameter analysis according to claim 1, characterized in that: When the data type of the parameter is an object, the method for performing data parsing is: Iterate over all properties of an object; Recursively call the resolve method for each attribute; Generates a key name with a hierarchical path.

3. The method for generating intelligent boundary test cases based on multi-dimensional parameter analysis according to claim 1, characterized in that: When the data type of the parameter is an array, the method for performing data parsing is: Extract the schema definition of the elements of the array; Identify array positions by adding wildcard characters.

4. The method for generating intelligent boundary test cases based on multi-dimensional parameter analysis according to claim 1, characterized in that: When the data type of the parameter is a basic type, the method for performing data parsing is to directly record the path and constraints.

5. The method for generating intelligent boundary test cases based on multi-dimensional parameter analysis according to claim 1, characterized in that: When the flattened parameter path mapping table is output, the nested structure is flattened by a recursive parsing algorithm.

6. The method for generating intelligent boundary test cases based on multi-dimensional parameter analysis according to claim 1, characterized in that: When the parameter is a numerical value, the method for performing constraint analysis to obtain the intelligent boundary value is: If there is a maximum value constraint max and a minimum value constraint min, then: When the parameter is an integer, get the deviation value , the obtained multiple boundary test values ​​include min-1, min, min+1, median, max-1, max and max+1, where the median is between min+1 and max-1; When the parameter is a floating point number, get the deviation value , multiple boundary test values ​​obtained include min- 、min、min+ , median, max- , max and max+ , where the median is between min+ and max- between; If there are no constraints, then: For 32-bit integer parameters, the boundary value is .

7. The method for generating intelligent boundary test cases based on multi-dimensional parameter analysis according to claim 1, characterized in that: When the parameter is of string type, the method for performing constraint parsing to obtain the intelligent boundary value is: Perform regular constraint parsing: decompose regular expression atomic patterns and generate compliant samples; Generate injection attack use cases: Cross-combine multiple attack vectors based on the abnormal pattern library and perform context-sensitive processing, including adding escape characters in JSON format.

8. The method for generating intelligent boundary test cases based on multi-dimensional parameter analysis according to claim 1, characterized in that: The script generation and optimization method is: Generate executable script files through template engine; Implement dynamic parameterization.

9. The method for generating intelligent boundary test cases based on multi-dimensional parameter analysis according to claim 8, characterized in that: The method for generating an executable script file through a template engine is: Read parameterized test template file; Dynamically inject multiple elements, including test case datasets, assertion rules, and data-driven tags; Generate an executable script file, wherein the format of the executable script file includes a Python / pytest format example; The method for implementing dynamic parameterization comprises: Identifying a fixed value placeholder of the executable script file; Replace the fixed value placeholder with a variable reference and generate a parameter configuration file; Establish a mapping relationship between the test data set and the script variables; Add data loading logic.

10. An automated script generation system based on multi-dimensional parameter analysis, applied to any one of the intelligent boundary test case generation methods based on multi-dimensional parameter analysis described in claims 1-9, characterized in that: include: Multi-dimensional parameter parsing engine: used to input parameter schema, perform data parsing for parameters of different data types, and output a flattened parameter path mapping table; Intelligent boundary value generation module: used to perform constraint analysis on different types of parameters according to the analysis results to obtain intelligent boundary values; Script generation engine: used to generate executable scripts based on intelligent boundary values ​​and perform optimization.

Citation Information

Patent Citations

  • Interface testing method and device

    CN102096631A

  • Software test integrated control method and system

    CN104866426A

Cited By

  • Intelligent parameter generation method combining combinatorial optimization algorithm and fuzzy test

    CN120492359A