Automatic generation management method and system for test cases

The API is identified through code scanning and generated API documents, combined with the matching parameters of the entity relationship data model, and automatically generate test cases, solving the problems of low testing efficiency and insufficient accuracy in the existing technology, and achieving more efficient and accurate software testing.

CN119807058APending Publication Date: 2025-04-11GUANGZHOU RUIHU TECH CO LTD

Patent Information

Application Number
CN202411881801.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The prior art has problems in software testing inadequate testing coverage, low test accuracy, unstable testing environment, low testing efficiency and test safety.

Method used

Automatically identify and extract the application program interface (API) in the code to be tested through pre-configured code scanning, generate API documents that meet the interface document standards, and match input and output parameters based on the entity relationship data model to automatically generate test cases.

Benefits of technology

It improves the efficiency of the test preparation stage, enhances the automation, standardization and accuracy of the test work, and ensures the accuracy and coverage of test cases, thus providing strong support for software quality assurance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807058A_ABST
    Figure CN119807058A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of testing, and discloses an automatic generation management method for a test case, which comprises the following steps of: according to an extracted path, a request method, an input parameter and an output field of an application program interface; whether a pre-configured entity relation data model exists or not is judged, if yes, the pre-configured entity relation data model is obtained, and if not, a test database associated with the to-be-tested item code is obtained, and data analysis is conducted on the test database to obtain the entity relation data model; obtaining association information between the data tables based on the entity relational data model; generating a dependency graph and a field rule base; and generating a test case according to the application program interface document, the dependency graph and the field rule base. According to the automatic generation management method for the test case, through technical means of automation, standardization, flexibility, precise matching and the like, the efficiency and accuracy of test work are greatly improved, and powerful support is provided for software quality guarantee.
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 cases, and in particular to a method and system for automatically generating and managing test cases. Background Art

[0002] At present, software testing is an important link in the entire life cycle of software. Software test cases are the basis of software testing and the guide of testing work, so it is particularly important to manage software test cases. When using test cases to test interfaces, there are problems such as insufficient test coverage, low test accuracy, unstable test environment, low test efficiency, and test security; therefore, designing a solution to improve the overall test effect has become a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention

[0003] In view of the above defects, an embodiment of the present invention discloses a method for automatically generating and managing test cases, which can improve the overall testing efficiency.

[0004] A first aspect of an embodiment of the present invention discloses a method for automatically generating and managing test cases, comprising:

[0005] Scanning the code of the project to be tested by a pre-configured code scanning method to identify all application program interfaces in the code of the project to be tested, and extracting the path, request method, input parameter and output field of the corresponding application program interface from the code of the project to be tested;

[0006] Generate an application program interface document that complies with the interface document standard according to the extracted application program interface path, request method, input parameters and output fields;

[0007] Determine whether there is a pre-configured entity relationship data model. If so, obtain the pre-configured entity relationship data model. If not, obtain a test database associated with the project code to be tested, perform data analysis on the test database to obtain a corresponding entity relationship data model, and verify the entity relationship data model to determine whether it meets the requirements. If so, execute the next step; wherein the entity relationship data model includes information of each data table in the database, the relationship between each data table, and attribute information of the data table;

[0008] Acquire association information between data tables based on the entity-relationship data model, and match the association information with the application program interface document to determine the data tables and fields corresponding to the input parameters and the data tables and fields corresponding to the output fields;

[0009] Performing a first traversal operation on the association relationship, the data table corresponding to the input parameter, and the data table corresponding to the output field to generate a corresponding dependency graph, and performing a second traversal operation on the association relationship, the field corresponding to the input parameter, and the field corresponding to the output field to determine a field rule library;

[0010] Test cases are automatically generated according to the application program interface document, dependency diagram and field rule library, and corresponding test cases are output.

[0011] As an optional implementation, in the first aspect of the embodiment of the present invention, the scanning of the project code to be tested by a preconfigured code scanning method to identify all application program interfaces in the project code to be tested, and extracting the path, request method, input parameter and output field of the corresponding application program interface from the project code to be tested, includes:

[0012] Scan the code of the project to be tested to determine whether there is an annotation method in the corresponding code. If so, obtain all the annotation information in the code, and parse the annotation information to determine the path and request method of the application interface in the annotation information, as well as the parameter list and return type annotation in the annotation information;

[0013] If not, load the API class through the Class.forName() method;

[0014] Get the method list declared by the API class by calling the Class.getDeclaredMethods() method;

[0015] Get the input parameter type of each method in the method list by calling the Method.getParameterTypes() method. If there is a parameter annotation, parse the corresponding parameter annotation to obtain the detailed information of the input parameter. The detailed information of the input parameter includes the parameter name, parameter type, and whether it is required.

[0016] The return type of each method in the method list is obtained by calling the Method.getReturnType() method. If the return type is an object, the field information of the object is further obtained through reflection. The further obtaining of the field information of the object through reflection includes: using the Class.getDeclaredFields() method to obtain the field list of the object, and using the method of the Field class to obtain detailed information of the output field, and the detailed information of the field includes the field name, field type and modifier.

[0017] As an optional implementation, in the first aspect of the embodiment of the present invention, the acquiring of the test database associated with the code of the project to be tested, and performing data parsing on the test database to obtain a corresponding entity relationship data model includes:

[0018] Acquire a test database associated with the project code to be tested, and connect to the corresponding test database according to connection information, wherein the connection information includes a database address and a port;

[0019] Retrieve all data tables, fields, data types and constraint information in the test database; the constraint information includes foreign key information and primary key information;

[0020] The fields in each data table are analyzed to determine the marked foreign key fields, and the relationship type between the data tables is determined based on the foreign key fields and the corresponding primary key fields to obtain the corresponding entity relationship data model.

[0021] As an optional implementation manner, in the first aspect of the embodiment of the present invention, the performing a first traversal operation on the input parameters, the output parameters, and the association relationship to determine a first dependency relationship between the input parameters and the output parameters and the application program interface, and performing a second traversal operation on the association relationship, the fields corresponding to the input parameters, and the fields corresponding to the output fields to determine a field rule base includes:

[0022] Obtaining the first response data of the API, and storing the corresponding first response data and its structure information, wherein the first response data includes a field name, a field type, and a field value;

[0023] Traversing each field in the first response data, identifying fields that serve as foreign keys or association keys, and recording values ​​of these fields and their corresponding APIs;

[0024] For each identified association key, check whether the first response data of other APIs contains the same value as the primary key or unique identifier; if matching data is found, establish a dependency relationship from the current API to the target API;

[0025] Obtaining the second response data of the API, and storing the corresponding second response data and its structure information, wherein the second response data includes a field name, a field type, and a field value;

[0026] Traverse each field in the second response data, and record the corresponding field name, field value and type;

[0027] Determine the type of the field based on the field value; if the field type is a string, determine its string length limit;

[0028] If the field value is a finite set, it is identified as an enumeration type and all possible enumeration values ​​are recorded; if the field value is an object or array, the internal structure of the object or array is recursively parsed to extract the rule information of the nested fields;

[0029] The extracted field rule information is stored in the field rule library.

[0030] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after automatically generating test cases according to the application program interface document, the dependency graph and the field rule library, and outputting corresponding test cases, it also includes:

[0031] Obtaining a test data model defined by a tester and a field generation rule configured for each field in the test data model;

[0032] According to the analysis of the virtual data engine, the corresponding writing generation logic is obtained according to the field generation rules and the test data model;

[0033] The writing generation logic is called to generate a corresponding test data set.

[0034] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after automatically generating test cases according to the application program interface document, the dependency graph and the field rule library, and outputting corresponding test cases, it also includes:

[0035] Remove corresponding redundant test cases by comparing and analyzing the input combinations and expected outputs of test cases;

[0036] Get the number of generated test cases and the number of covered input combinations, and match them with the preset coverage or number of test cases based on the number of generated test cases and the number of covered input combinations. If they do not meet the requirements, regenerate new test cases until they meet the requirements.

[0037] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after automatically generating test cases according to the application program interface document, the dependency graph and the field rule library, and outputting corresponding test cases, it also includes:

[0038] A corresponding checkpoint list is determined based on a preset defect knowledge base, and matching optimization is performed on the generated test cases according to the checkpoint list. The defect knowledge base includes defect types, trigger conditions, and defect results.

[0039] A second aspect of an embodiment of the present invention discloses an automatic generation management system for test cases, including:

[0040] Scanning module: used to scan the code of the project to be tested by a pre-configured code scanning method to identify all the application program interfaces in the code of the project to be tested, and extract the path, request method, input parameter and output field of the corresponding application program interface from the code of the project to be tested;

[0041] Extraction module: used to generate an application interface document that complies with the interface document standard according to the extracted application interface path, request method, input parameters and output fields;

[0042] Judgment module: used to judge whether there is a pre-configured entity relationship data model, if so, obtain the pre-configured entity relationship data model, if not, obtain the test database associated with the project code to be tested, perform data analysis on the test database to obtain the corresponding entity relationship data model, and verify the entity relationship data model to determine whether it meets the requirements, and if so, execute the next step; wherein the entity relationship data model includes information of each data table in the database, the relationship between each data table, and attribute information of the data table;

[0043] Association information module: used to obtain association information between data tables based on the entity relationship data model, and match the association information with the application interface document to determine the data table and field corresponding to the input parameter and the data table and field corresponding to the output field;

[0044] Traversal module: used for performing a first traversal operation on the association relationship, the data table corresponding to the input parameter, and the data table corresponding to the output field to generate a corresponding dependency graph, and performing a second traversal operation on the association relationship, the field corresponding to the input parameter, and the field corresponding to the output field to determine a field rule library;

[0045] Use case generation module: used to automatically generate test cases based on the application interface document, dependency diagram and field rule library, and output corresponding test cases.

[0046] The third aspect of an embodiment of the present invention discloses an electronic device, comprising: a memory storing executable program code; a processor coupled to the memory; the processor calls the executable program code stored in the memory to execute the automatic generation and management method of test cases disclosed in the first aspect of the embodiment of the present invention.

[0047] A fourth aspect of an embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the automatic generation and management method of test cases disclosed in the first aspect of an embodiment of the present invention.

[0048] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0049] In the embodiment of the present invention, the code of the project to be tested can be automatically scanned through the pre-configured code scanning method, all application program interfaces can be quickly identified, and key information such as paths, request methods, input parameters and output fields can be extracted. This automated method greatly reduces manual intervention and improves the efficiency of the test preparation stage. This automatic generation and management method of test cases greatly improves the efficiency and accuracy of testing work through technical means such as automation, standardization, flexibility and precise matching, and provides strong support for software quality assurance. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0051] Figure 1 It is a flowchart of the automatic generation management method of test cases disclosed in an embodiment of the present invention;

[0052] Figure 2 It is a schematic diagram of the process of performing code scanning disclosed in an embodiment of the present invention;

[0053] Figure 3 It is a schematic diagram of the process of obtaining the entity relationship data model disclosed in the embodiment of the present invention;

[0054] Figure 4 It is a structural diagram of an automatic generation management system of a test case provided by an embodiment of the present invention;

[0055] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in 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. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] It should be noted that the terms "first", "second", "third", "fourth", etc. in the specification and claims of the present invention are used to distinguish different objects rather than to describe a specific order. The terms "including" and "having" in the embodiments of the present invention and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0058] At present, software testing is an important link in the entire life cycle of software. Software test cases are the basis of software testing and the guide of testing work, so it is particularly important to manage software test cases well. When the existing test cases are used to test the interface, there will be problems such as insufficient test coverage, low test accuracy, unstable test environment, low test efficiency, and test security; based on this, the embodiment of the present invention discloses an automatic generation management method, system, electronic device and storage medium for test cases, which can automatically scan the code of the project to be tested through a pre-configured code scanning method, quickly identify all application program interfaces, and extract key information such as paths, request methods, input parameters and output fields. This automated method greatly reduces manual intervention and improves the efficiency of the test preparation stage. This automatic generation management method for test cases greatly improves the efficiency and accuracy of testing work through technical means such as automation, standardization, flexibility and precise matching, and provides strong support for software quality assurance.

[0059] Embodiment 1

[0060] See also Figure 1 , Figure 1 It is a flow chart of the automatic generation management method of test cases disclosed in the embodiment of the present invention. Among them, the execution subject of the method described in the embodiment of the present invention is an execution subject composed of software and / or hardware, and the execution subject can receive relevant information by wired or / and wireless means, and can send certain instructions. Of course, it can also have certain processing functions and storage functions. The execution subject can control multiple devices, such as a remote physical server or cloud server and related software, or it can be a local host or server and related software that performs related operations on a device placed somewhere. In some scenarios, multiple storage devices can also be controlled, and the storage devices can be placed in the same place or different places as the devices. For example Figure 1 As shown, the test case-based automatic generation management method includes the following steps:

[0061] S101: Scanning the code of the project to be tested by a pre-configured code scanning method to identify all application program interfaces in the code of the project to be tested, and extracting the path, request method, input parameter and output field of the corresponding application program interface from the code of the project to be tested;

[0062] S102: Generate an application program interface document that complies with the interface document standard according to the extracted application program interface path, request method, input parameters, and output fields;

[0063] S103: Determine whether there is a pre-configured entity relationship data model. If so, obtain the pre-configured entity relationship data model. If not, obtain a test database associated with the project code to be tested, perform data analysis on the test database to obtain a corresponding entity relationship data model, and verify the entity relationship data model to determine whether it meets the requirements. If so, execute the next step; wherein the entity relationship data model includes information of each data table in the database, the relationship between each data table, and attribute information of the data table;

[0064] S104: Acquire association information between data tables based on the entity relationship data model, and match the association information with the application program interface document to determine the data table and field corresponding to the input parameter and the data table and field corresponding to the output field;

[0065] S105: performing a first traversal operation on the association relationship, the data table corresponding to the input parameter, and the data table corresponding to the output field to generate a corresponding dependency graph, and performing a second traversal operation on the association relationship, the field corresponding to the input parameter, and the field corresponding to the output field to determine a field rule library;

[0066] S106: Automatically generate test cases according to the application program interface document, dependency graph and field rule library, and output corresponding test cases.

[0067] The solution of the embodiment of the present invention can automatically scan the code of the project to be tested through a pre-configured code scanning method, quickly identify all application program interfaces (APIs), and extract key information such as paths, request methods, input parameters, and output fields. This automated method greatly reduces manual intervention and improves the efficiency of the test preparation stage. An application program interface document that meets the interface document standard is generated based on the extracted API information, ensuring the consistency and standardization of the document. This helps communication and collaboration between team members, and also facilitates subsequent testing and maintenance work.

[0068] The method of the embodiment of the present invention can determine whether there is a pre-configured entity relationship data model. If not, the corresponding data model can be automatically parsed from the test database and verified. This flexibility ensures that the required data model can be quickly and accurately obtained in different projects or different test phases. Based on the entity relationship data model, the association information between data tables can be obtained and matched with the application interface document to determine the data tables and fields corresponding to the input parameters and output fields. This precise matching and association ensures the accuracy and effectiveness of the test case.

[0069] The method of the embodiment of the present invention generates a dependency graph through traversal operations and determines a field rule library, which provides comprehensive information support for the generation of test cases. The dependency graph helps to understand the associations and dependencies between various APIs, while the field rule library ensures the accuracy and compliance of the fields in the test cases. According to the application interface document, the dependency graph and the field rule library, test cases can be automatically generated and the corresponding test cases can be output. This automatic generation method not only improves the efficiency of the testing work, but also ensures the consistency and repeatability of the test cases.

[0070] In the embodiment of the present invention, the dependency graph is a graphical representation for showing the dependency relationships between system components. The dependency graph can help testers identify the interactions and dependencies between system components, thereby ensuring that test cases can cover all possible paths and scenarios. By constructing a dependency graph, testers can more easily find potential test omissions, thereby improving the coverage of test cases.

[0071] Specifically, based on the dependency graph, design test cases to cover all possible paths and scenarios. This includes normal paths, abnormal paths, and boundary conditions. Execute the designed test cases and record the test results. For test cases that fail, detailed investigation and repair are required.

[0072] The entity relationship data model in the embodiment of the present invention is a model for describing real-world entities and their relationships. In database management, the entity relationship data model can help managers understand and maintain the structure of the database. The update mechanism is used to automatically update and adjust historical data after each data import to ensure data accuracy and consistency.

[0073] Interface documents, dependency diagrams, and field rule libraries are important resources in software testing. By combining these resources, automated test case generation can be achieved. This can greatly improve the efficiency and coverage of test case generation while reducing human errors and omissions.

[0074] When carrying out specific implementation, dependency graph analysis can also be performed: Next, the dependency graph needs to be analyzed to determine the coverage and order of the test cases. This can be achieved through a graph traversal algorithm or a path search algorithm. According to the rules in the field rule library, the request parameters and return results are checked and constrained. This can ensure the accuracy and effectiveness of the test cases. Based on the above information, test cases are automatically generated. This includes steps such as constructing request parameters, simulating the request process, and verifying the return results. Existing test frameworks or tools (such as Postman, SoapUI, etc.) can be used to assist in the generation and execution of test cases.

[0075] When implementing the method, you can also use the AI ​​big model embedding method: In order to improve the quality and coverage of test case generation, you can embed the AI ​​big model as a detection completion. The AI ​​big model can analyze historical test cases and test results, learn the test strategies and ideas of testers, and thus generate more comprehensive and accurate test cases. At the same time, the AI ​​big model can also intelligently optimize and adjust the generated test cases to improve the efficiency and accuracy of the test.

[0076] More preferably, Figure 2 As shown, the code of the project to be tested is scanned by a pre-configured code scanning method to identify all application program interfaces in the code of the project to be tested, and the path, request method, input parameter and output field of the corresponding application program interface are extracted from the code of the project to be tested, including:

[0077] S1011: Scan the code of the project to be tested to determine whether there is an annotation method in the corresponding code. If so, obtain all the annotation information in the code, and parse the annotation information to determine the path and request method of the application program interface in the annotation information, as well as the parameter list and return type annotation in the annotation information;

[0078] S1012: If not, load the API class through the Class.forName() method;

[0079] S1013: Get the method list declared by the API class by calling the Class.getDeclaredMethods() method;

[0080] S1014: Calling the Method.getParameterTypes() method to obtain the input parameter type of each method in the method list. If a parameter annotation exists, parsing the corresponding parameter annotation to obtain detailed information of the input parameter, the detailed information of the input parameter including the parameter name, parameter type and whether it is required.

[0081] S1015: Get the return type of each method in the method list by calling the Method.getReturnType() method. If the return type is an object, further get the field information of the object by reflection. The further getting the field information of the object by reflection includes: using the Class.getDeclaredFields() method to get the field list of the object, and using the method of the Field class to get detailed information of the output field. The detailed information of the field includes the field name, field type and modifier.

[0082] The method of the embodiment of the present invention can not only identify the path and request method of the API, but also extract detailed information of the input parameters and output fields of the API from the code, including parameter name, parameter type, whether it is required, field name, field type and modifiers, etc. This information is crucial for subsequent API testing, integration and documentation.

[0083] And this method supports two different code scanning methods, one is annotation-based scanning and the other is reflection-based scanning. This makes it suitable for projects with different coding styles and frameworks, increasing the applicability and flexibility of the method. By extracting detailed information of the API, this method helps to generate clear and accurate API documentation, which is very helpful for developers to understand the functions and usage of the API. At the same time, detailed API information also helps to quickly locate problems and make modifications during code maintenance.

[0084] More preferably, Figure 3 As shown, the step of acquiring a test database associated with the code of the project to be tested and parsing the test database to obtain a corresponding entity relationship data model includes:

[0085] S1031: Acquire a test database associated with the project code to be tested, and connect to the corresponding test database according to connection information, wherein the connection information includes a database address and a port;

[0086] S1032: Retrieve all data tables, fields, data types and constraint information in the test database; the constraint information includes foreign key information and primary key information;

[0087] S1033: Analyze the fields in each data table to determine the marked foreign key fields, and determine the relationship type between the data tables according to the foreign key fields and the corresponding primary key fields to obtain a corresponding entity relationship data model.

[0088] The embodiment of the present invention can quickly build an entity relationship data model associated with the project code to be tested by automatically connecting to the test database and retrieving the data tables, fields, data types and constraint information therein, which greatly reduces the time and labor cost of manually building the data model and improves efficiency.

[0089] Since this method obtains data model information directly from the test database, it ensures that the generated entity-relationship data model is consistent with the actual database structure. This helps reduce errors and problems caused by inconsistent data models.

[0090] This method can analyze the fields in the data table to determine the marked foreign key fields, and determine the relationship type between the data tables based on the foreign key fields and the corresponding primary key fields. This helps to identify and handle complex database relationships, such as one-to-many, many-to-many, etc., thereby ensuring that the generated entity-relationship data model can accurately reflect the actual situation of the database.

[0091] If the project code or database structure changes, you can rescan the code and update the entity-relationship data model. Compare and merge functions are provided to easily apply new changes to the entity-relationship data model.

[0092] More preferably, performing a first traversal operation on the input parameters, the output parameters, and the association relationship to determine a first dependency relationship between the input parameters and the output parameters and the application program interface, and performing a second traversal operation on the association relationship, the fields corresponding to the input parameters, and the fields corresponding to the output fields to determine a field rule base includes:

[0093] Obtaining the first response data of the API, and storing the corresponding first response data and its structure information, wherein the first response data includes a field name, a field type, and a field value;

[0094] Traversing each field in the first response data, identifying fields that serve as foreign keys or association keys, and recording values ​​of these fields and their corresponding APIs;

[0095] For each identified association key, check whether the first response data of other APIs contains the same value as the primary key or unique identifier; if matching data is found, establish a dependency relationship from the current API to the target API;

[0096] Obtaining the second response data of the API, and storing the corresponding second response data and its structure information, wherein the second response data includes a field name, a field type, and a field value;

[0097] Traverse each field in the second response data, and record the corresponding field name, field value and type;

[0098] Determine the type of the field based on the field value; if the field type is a string, determine its string length limit;

[0099] If the field value is a finite set, it is identified as an enumeration type and all possible enumeration values ​​are recorded; if the field value is an object or array, the internal structure of the object or array is recursively parsed to extract the rule information of the nested fields;

[0100] The extracted field rule information is stored in the field rule library.

[0101] The embodiment of the present invention can automatically identify the dependencies between APIs through traversal operations, especially based on foreign keys or association key fields in response data. This helps developers understand the call sequence and data flow between APIs, thereby optimizing system architecture and API design. The visualization of dependency relationships can further improve the team's understanding of the overall structure of the system and promote collaboration and communication.

[0102] This method can parse the field information in the API response data in detail, including field name, field type, field value, and field-specific rules (such as string length limit, enumeration type, etc.). This information is organized and stored in the field rule library, providing valuable resources for subsequent API testing, data validation, and document writing.

[0103] With the support of dependency and field rule libraries, developers can write test cases more accurately to ensure that all possible input and output scenarios are covered. This helps improve the efficiency and quality of testing and reduce the failure rate after the system is launched. The field rule library can also be used in the automated testing framework to realize automatic data generation and verification, further reducing manual intervention and testing costs.

[0104] The process of generating a dependency graph by the first traversal operation in the embodiment of the present invention is mainly to identify the data dependency between each API by analyzing the response data of the API. For example, the data returned by an API for obtaining order information may contain fields such as product ID, user ID, coupon ID, etc. These fields usually point to identifiers of other resources (such as product details, user information, coupon information). By parsing these fields, we can build the dependency between APIs and generate a dependency graph. Its specific implementation, data collection: capture the response data of the API, usually by calling the API and parsing the data returned by it in JSON or XML format. Store the response data and its structural information, including field name, field type, field value, etc. Field parsing: traverse each field in the response data and identify fields that may be used as foreign keys or association keys (such as ID, UUID, etc.). Record the values ​​of these fields and their corresponding APIs. Dependency construction: For each identified association key, find out whether the response data of other APIs contains the same value as the primary key or unique identifier. If a match is found, a dependency relationship is established from the current API to the target API. Graphical representation: Use a graphics library (such as Graphviz, D3.js, etc.) to represent dependencies as a graph. Nodes represent APIs, and edges represent dependencies. Optimization and visualization: Optimize the graph, such as removing redundant edges, merging similar nodes, etc. Provide a visual interface to facilitate users to view and analyze the dependency graph.

[0105] The second traversal operation in the embodiment of the present invention mainly extracts the type, length, enumeration value, object value and other rule information of each field through the process of identifying the field rule base by analyzing the response data of the API. This information can help us understand the data structure returned by the API and be used in the subsequent data processing, verification and conversion process. Its specific implementation, data collection: the same as generating the dependency graph, first capture the response data of the API. Field traversal: traverse each field in the response data, record the field name, field value and its type. Type identification: determine the type of the field (such as string, integer, floating point number, Boolean value, array, object, etc.) according to the field value. For the string type, its length limit can be further determined. Enumeration value identification: If the field value is a finite set (such as status code, type code, etc.), it is identified as an enumeration type and all possible enumeration values ​​are recorded. Object value parsing: If the field value is an object or array, its internal structure is recursively parsed to extract the rule information of the nested field. Rule base construction: the extracted field rule information is stored in the rule base. The rule base can be a database, configuration file, or in-memory data structure for subsequent data processing and analysis. Rule application: In the subsequent data processing process, the information in the rule base can be used to verify, convert, or format the data. For example, an enumeration value list can be used to verify the legitimacy of input data, or field type information can be used to parse and convert data formats.

[0106] More preferably, after automatically generating test cases according to the application program interface document, the dependency graph and the field rule library, and outputting corresponding test cases, the method further includes:

[0107] Obtaining a test data model defined by a tester and a field generation rule configured for each field in the test data model;

[0108] According to the analysis of the virtual data engine, the corresponding writing generation logic is obtained according to the field generation rules and the test data model;

[0109] The writing generation logic is called to generate a corresponding test data set.

[0110] The embodiment of the present invention can automatically generate a test data set that meets the requirements of the test data model through a virtual data engine and field generation rules. This greatly reduces the time for testers to manually write test data and improves the efficiency of test data generation. The test data model defines the structure and field requirements of the data, and the field generation rules specify the data generation logic for each field. Through the combination of the two, it can be ensured that the generated test data is accurate and consistent in structure and content, thereby improving the reliability and accuracy of the test.

[0111] The test data model and field generation rules can be flexibly configured to adapt to various complex test scenarios. For example, different data types, data ranges, data relationships, etc. can be defined to simulate complex data situations in real business scenarios. Automated test data generation can be combined with the test automation framework and continuous integration process to achieve automation and continuous monitoring of the test process. This helps to find and fix problems in a timely manner and improve the efficiency and quality of software development. By automating the generation of test data, the dependence on testers can be reduced and the testing cost can be reduced. At the same time, since the generation of test data is controllable and repeatable, the test failure and repair costs caused by inconsistent or incorrect test data can also be reduced.

[0112] Specifically, test cases need to correspond to test data. Different data values ​​correspond to different test cases. The intelligent virtual data engine can simulate the generation of test data. For example, the city field is a string type. A general test case may just enter a random string such as "aaa", but the intelligent virtual data engine can match and generate humanized data such as "Guangzhou" and "Shanghai", which can be more in line with the real scenario.

[0113] More preferably, after automatically generating test cases according to the application program interface document, the dependency graph and the field rule library, and outputting corresponding test cases, the method further includes:

[0114] Remove corresponding redundant test cases by comparing and analyzing the input combinations and expected outputs of test cases;

[0115] Get the number of generated test cases and the number of covered input combinations, and match them with the preset coverage or number of test cases based on the number of generated test cases and the number of covered input combinations. If they do not meet the requirements, regenerate new test cases until they meet the requirements.

[0116] The embodiment of the present invention can identify and remove redundant or repeated test cases by comparing and analyzing the input combinations and expected outputs of the test cases, which helps to reduce unnecessary work in the testing process and improve the quality and efficiency of the test cases.

[0117] Obtaining the number of generated test cases and the number of input combinations covered, and matching them with the pre-set coverage or number of test cases, can ensure the coverage of the application program interface (API) by the test cases. This helps to discover potential defects and problems and improve the reliability and stability of the software. By regenerating new test cases to meet the requirements of coverage or number of test cases, the effective use of test resources can be ensured. This helps to avoid the waste of test resources while ensuring the comprehensiveness and effectiveness of the testing work. The process of automating the removal of redundant test cases and ensuring test coverage can be combined with the continuous integration and continuous delivery process. This helps to discover and fix problems in the early stages of software development, reducing the cost and risk of later fixes.

[0118] Specific working principle: First, analyze the input parameters and values ​​of the system to be tested to understand the input space of the system. According to the selected combination strategy, the program combines the input parameters and their values ​​to generate different input combinations. These combinations will cover different parts of the input space. The program generates corresponding test cases based on the generated input combinations. Each test case contains a specific set of input parameter values ​​and expected output results. Coverage and case number control, the program controls the coverage and number of test cases by monitoring the number of generated test cases and the number of covered input combinations. If the set coverage or number of cases is not reached, the program will continue to generate new test cases until the requirements are met. Test case optimization, the generated test cases may contain redundant or repeated cases. The program removes redundant cases and retains representative cases by comparing and analyzing the input combinations and expected outputs of the test cases.

[0119] More preferably, after automatically generating test cases according to the application program interface document, the dependency graph and the field rule library, and outputting corresponding test cases, the method further includes:

[0120] A corresponding checkpoint list is determined based on a preset defect knowledge base, and matching optimization is performed on the generated test cases according to the checkpoint list. The defect knowledge base includes defect types, trigger conditions, and defect results.

[0121] The embodiment of the present invention can optimize test cases for common defect types, trigger conditions and defect results by determining a checkpoint list based on a defect knowledge base. This helps to ensure that the test cases can cover key test scenarios and improve the pertinence and effectiveness of the test. By optimizing the test cases using a defect knowledge base and a checkpoint list, it is possible to reduce test omissions and false positives caused by improper test case design. This helps to improve the accuracy and reliability of the test and reduce the cost and risk of later repairs. By automatically matching and optimizing test cases, the workload of manual testing can be reduced and test efficiency can be improved. At the same time, because the test cases are more pertinent and effective, more defects can be found in a shorter time, further shortening the test cycle.

[0122] Taking the login function as an example, describe how to use the defect knowledge base to optimize the test case design. Test function: User login function, preliminary test case: Normal login: Enter the correct user name and password to verify whether the login is successful. Wrong password: Enter the correct user name and wrong password to verify whether the password error can be prompted. Wrong user name: Enter the wrong user name and the correct password to verify whether the user name does not exist. User name and password are empty: Do not enter the user name and password to verify whether the input cannot be empty.

[0123] Test cases optimized using the knowledge base: Normal login (remains unchanged): Enter the correct username and password to verify whether you can log in successfully. Wrong password (remains unchanged): Enter the correct username and wrong password to verify whether it can prompt that the password is wrong. Wrong username (remains unchanged): Enter the wrong username and correct password to verify whether it can prompt that the username does not exist. Username and password are empty (remains unchanged): Do not enter the username and password to verify whether it can prompt that the input cannot be empty. SQL injection attack (added according to the knowledge base): Enter a username or password containing SQL injection statements to verify whether the system can identify and defend against this attack. Special character input (added according to the knowledge base): Enter special characters (such as @, #, $, etc.) in the username or password to verify whether the system can handle these characters correctly. Concurrent login (added according to the knowledge base): Simulate multiple users logging into the system at the same time to verify whether the system can correctly handle concurrent requests and avoid problems such as login conflicts or system crashes.

[0124] In addition to the above implementation methods, different test permissions may be assigned to different users during specific implementation to enhance the security of the test.

[0125] Different people in the enterprise have different functional testing requirements, and different functions are developed by different development teams, which may involve cooperation between multiple groups. How to efficiently test the functions developed by each group? Different small functions may form a large function. How to efficiently complete all tests of the large function.

[0126] In interface testing, if sensitive information is not adequately protected, it may lead to the leakage of sensitive information to unauthorized users. This will threaten the privacy of users and the security of enterprises. In interface testing, introduce security testing, simulate attack behaviors, and check whether there are security vulnerabilities in the interface. Use professional security testing tools, such as vulnerability scanners, penetration testing tools, etc., to conduct comprehensive security testing on the interface. Record and repair the discovered security vulnerabilities in a timely manner, and track the repair process to ensure that the vulnerabilities are completely resolved.

[0127] In addition to the above solutions, in order to improve the overall testing efficiency, test cases need to be prioritized. The following is the specific design logic for test case priority sorting:

[0128] Key legal access requests: The highest priority. These test cases cover the most important legal access scenarios, such as user login, data query, file download, etc. These scenarios are directly related to the core functions of the system and user experience, so they must be tested first. Test cases should be detailed and comprehensive to ensure that all possible legal access paths are covered.

[0129] Boundary legitimate access requests: The next highest priority. These test cases are designed to verify the legitimate access behavior of the system under boundary conditions, such as maximum data volume query, minimum permission access, etc. These scenarios help to discover potential performance issues and security vulnerabilities. Test cases should focus on the system's extreme conditions and abnormal situations to ensure that the system can still operate normally under these conditions.

[0130] General legitimate access requests: lower priority. These test cases cover other common legitimate access scenarios, such as user registration, information modification, etc. Although these scenarios are not as important as key legitimate access requests, they also need to be tested to ensure the stability and reliability of the system. The test cases can be relatively simple, but they should ensure that all basic legitimate access operations are covered.

[0131] Illegal access requests: Priority is determined based on the risk level. These test cases are designed to verify the system's behavior in the face of illegal access, such as unauthorized access, SQL injection, cross-site scripting attacks, etc. These scenarios help to discover security vulnerabilities and potential threats to the system. Test cases should be designed for known security vulnerabilities and potential threats to ensure that the system can resist these attacks.

[0132] In order to improve the overall test efficiency, you can also simulate a variety of actual scenarios and conduct actual simulations based on pre-configured scenario parameters; you can also perform interface analysis based on user behavior; you can simulate network delays, packet loss, service unavailability and other failures to verify the system's fault tolerance. Build a user behavior model based on the collected data to generate more realistic test cases; collect user behavior logs, collect user operation paths and usage habits through front-end embedding or back-end log analysis.

[0133] The solution of the embodiment of the present invention can simulate a variety of actual scenarios for prediction. In order to more accurately predict the performance of the software in different scenarios, a variety of actual scenarios can be simulated and actual simulations can be performed based on a variety of pre-configured scenario parameters. This includes: Scenario configuration: According to the functions of the software and user needs, a variety of possible scenario parameters are configured, such as network delay, packet loss rate, service response time, etc. Simulation execution: Use simulation tools or frameworks to simulate the actual operation of the software according to the configured scenario parameters. This can include simulation of network delays, simulation of service unavailability, etc. Result analysis: Collect data during the simulation operation, such as response time, error rate, etc., and analyze them to evaluate the performance of the software in different scenarios.

[0134] When implementing the software, interface analysis based on user behavior is another important direction, which can help developers understand the user's usage habits and needs more deeply, thereby optimizing the design and implementation of the software. This includes: User behavior log collection: Collect user operation paths and usage habits through front-end embedding or back-end log analysis. This can include information such as buttons clicked by users, text entered, and pages visited. Build user behavior models: Build user behavior models based on the collected user behavior data. This can help developers understand the user's usage patterns and needs more accurately. Generate test cases: Generate more realistic test cases based on the user behavior model. These test cases can simulate the user's operations in actual use, thereby more comprehensively testing the software's functions and performance. Fault tolerance verification: Simulate network delays, packet loss, service unavailability and other failure conditions to verify the system's fault tolerance. This ensures that the software can still maintain stable and reliable performance under adverse conditions.

[0135] In the embodiment of the present invention, the code of the project to be tested can be automatically scanned through the pre-configured code scanning method, all application program interfaces can be quickly identified, and key information such as paths, request methods, input parameters and output fields can be extracted. This automated method greatly reduces manual intervention and improves the efficiency of the test preparation stage. This automatic generation and management method of test cases greatly improves the efficiency and accuracy of testing work through technical means such as automation, standardization, flexibility and precise matching, and provides strong support for software quality assurance.

[0136] Embodiment 2

[0137] See also Figure 4 , Figure 4 Schematic diagram of the structure of the automatic generation management system of the test case disclosed in the embodiment of the present invention. Figure 4 As shown, the test case automatic generation management system may include:

[0138] Scanning module 21: used to scan the code of the project to be tested by a pre-configured code scanning method to identify all application program interfaces in the code of the project to be tested, and extract the path, request method, input parameter and output field of the corresponding application program interface from the code of the project to be tested;

[0139] Extraction module 22: used to generate an application program interface document that complies with the interface document standard according to the extracted path, request method, input parameter and output field of the application program interface;

[0140] Determination module 23: used to determine whether there is a pre-configured entity relationship data model, if so, obtain the pre-configured entity relationship data model, if not, obtain the test database associated with the project code to be tested, perform data analysis on the test database to obtain the corresponding entity relationship data model, and verify the entity relationship data model to determine whether it meets the requirements, and if so, execute the next step; wherein the entity relationship data model includes information of each data table in the database, the relationship between each data table, and attribute information of the data table;

[0141] The association information module 24 is used to obtain association information between data tables based on the entity relationship data model, and match the association information with the application interface document to determine the data table and field corresponding to the input parameter and the data table and field corresponding to the output field;

[0142] Traversal module 25: used for performing a first traversal operation on the association relationship, the data table corresponding to the input parameter, and the data table corresponding to the output field to generate a corresponding dependency graph, and performing a second traversal operation on the association relationship, the field corresponding to the input parameter, and the field corresponding to the output field to determine a field rule base;

[0143] The use case generation module 26 is used to automatically generate test cases according to the application program interface document, dependency diagram and field rule library, and output corresponding test cases.

[0144] In the embodiment of the present invention, the code of the project to be tested can be automatically scanned through the pre-configured code scanning method, all application program interfaces can be quickly identified, and key information such as paths, request methods, input parameters and output fields can be extracted. This automated method greatly reduces manual intervention and improves the efficiency of the test preparation stage. This automatic generation and management method of test cases greatly improves the efficiency and accuracy of testing work through technical means such as automation, standardization, flexibility and precise matching, and provides strong support for software quality assurance.

[0145] Embodiment 3

[0146] See also Figure 5 , Figure 5 Schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. The electronic device may be a computer, a server, etc. Of course, in certain circumstances, it may also be a smart device such as a mobile phone, a tablet computer, a monitoring terminal, and an image acquisition device with processing functions. Figure 5 As shown, the electronic device may include:

[0147] A memory 510 storing executable program codes;

[0148] a processor 520 coupled to the memory 510;

[0149] The processor 520 calls the executable program code stored in the memory 510 to execute part or all of the steps in the automatic generation management method of the test case in the first embodiment.

[0150] An embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute part or all of the steps in the method for automatically generating and managing test cases in the first embodiment.

[0151] The embodiment of the present invention further discloses a computer program product, wherein when the computer program product is run on a computer, the computer is enabled to execute part or all of the steps in the method for automatically generating and managing test cases in the first embodiment.

[0152] An embodiment of the present invention also discloses an application publishing platform, wherein the application publishing platform is used to publish a computer program product, wherein when the computer program product runs on a computer, the computer executes some or all of the steps in the automatic generation management method of test cases in embodiment one.

[0153] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the processes does not necessarily mean 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.

[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place or distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0155] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0156] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several requests for a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to perform some or all of the steps of the method described in each embodiment of the present invention.

[0157] In the embodiments provided by the present invention, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.

[0158] A person of ordinary skill in the art can understand that some or all of the steps in the various methods of the embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0159] The above is a detailed introduction to the automatic generation management method, system, electronic device and storage medium of the test cases disclosed in the embodiments of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for automatically generating and managing test cases, characterized in that: include: Scanning the code of the project to be tested by a pre-configured code scanning method to identify all application program interfaces in the code of the project to be tested, and extracting the path, request method, input parameter and output field of the corresponding application program interface from the code of the project to be tested; Generate an application program interface document that complies with the interface document standard according to the extracted application program interface path, request method, input parameters and output fields; Determine whether there is a pre-configured entity relationship data model. If so, obtain the pre-configured entity relationship data model. If not, obtain a test database associated with the project code to be tested, perform data analysis on the test database to obtain a corresponding entity relationship data model, and verify the entity relationship data model to determine whether it meets the requirements. If so, execute the next step; wherein the entity relationship data model includes information of each data table in the database, the relationship between each data table, and attribute information of the data table; Acquire association information between data tables based on the entity-relationship data model, and match the association information with the application program interface document to determine the data tables and fields corresponding to the input parameters and the data tables and fields corresponding to the output fields; Performing a first traversal operation on the association relationship, the data table corresponding to the input parameter, and the data table corresponding to the output field to generate a corresponding dependency graph, and performing a second traversal operation on the association relationship, the field corresponding to the input parameter, and the field corresponding to the output field to determine a field rule library; Test cases are automatically generated according to the application program interface document, dependency diagram and field rule library, and corresponding test cases are output.

2. The test case automatic generation management method according to claim 1, characterized in that: The method of scanning the code of the project to be tested by a pre-configured code scanning method to identify all application program interfaces in the code of the project to be tested, and extracting the path, request method, input parameter and output field of the corresponding application program interface from the code of the project to be tested includes: Scan the code of the project to be tested to determine whether there is an annotation method in the corresponding code. If so, obtain all the annotation information in the code, and parse the annotation information to determine the path and request method of the application interface in the annotation information, as well as the parameter list and return type annotation in the annotation information; If not, load the API class through the Class.forName() method; Get the method list declared by the API class by calling the Class.getDeclaredMethods() method; Get the input parameter type of each method in the method list by calling the Method.getParameterTypes() method. If there is a parameter annotation, parse the corresponding parameter annotation to obtain the detailed information of the input parameter. The detailed information of the input parameter includes the parameter name, parameter type, and whether it is required. The return type of each method in the method list is obtained by calling the Method.getReturnType() method. If the return type is an object, the field information of the object is further obtained through reflection. The further obtaining of the field information of the object through reflection includes: using the Class.getDeclaredFields() method to obtain the field list of the object, and using the method of the Field class to obtain detailed information of the output field, and the detailed information of the field includes the field name, field type and modifier.

3. The automatic generation management method of test cases according to claim 1, characterized in that: The step of acquiring a test database associated with the code of the project to be tested and parsing the test database to obtain a corresponding entity relationship data model includes: Acquire a test database associated with the project code to be tested, and connect to the corresponding test database according to connection information, wherein the connection information includes a database address and a port; Retrieve all data tables, fields, data types and constraint information in the test database; the constraint information includes foreign key information and primary key information; The fields in each data table are analyzed to determine the marked foreign key fields, and the relationship type between the data tables is determined based on the foreign key fields and the corresponding primary key fields to obtain the corresponding entity relationship data model.

4. The test case automatic generation management method according to claim 1, characterized in that: The first traversal operation is performed on the input parameters, the output parameters and the association relationship to determine the first dependency relationship between the input parameters and the output parameters and the application program interface, and the second traversal operation is performed on the association relationship, the fields corresponding to the input parameters, and the fields corresponding to the output fields to determine the field rule base, including: Obtaining the first response data of the API and storing the corresponding first response data and its structure information, wherein the first response data includes a field name, a field type, and a field value; Traversing each field in the first response data, identifying fields that serve as foreign keys or association keys, and recording values ​​of these fields and their corresponding APIs; For each identified association key, check whether the first response data of other APIs contains the same value as the primary key or unique identifier; if matching data is found, establish a dependency relationship from the current API to the target API; Obtaining the second response data of the API, and storing the corresponding second response data and its structure information, wherein the second response data includes a field name, a field type, and a field value; Traverse each field in the second response data, and record the corresponding field name, field value and its type; Determine the type of the field based on the field value; if the field type is a string, determine its string length limit; If the field value is a finite set, it is identified as an enumeration type and all possible enumeration values ​​are recorded; if the field value is an object or array, the internal structure of the object or array is recursively parsed to extract the rule information of the nested fields; The extracted field rule information is stored in the field rule library.

5. The automatic generation management method of test cases according to claim 1, characterized in that: After automatically generating test cases according to the application program interface document, the dependency diagram and the field rule library, and outputting corresponding test cases, the method further includes: Obtaining a test data model defined by a tester and a field generation rule configured for each field in the test data model; According to the analysis of the virtual data engine, the corresponding writing generation logic is obtained according to the field generation rules and the test data model; The writing generation logic is called to generate a corresponding test data set.

6. The automatic generation management method of test cases according to claim 1, characterized in that: After automatically generating test cases according to the application program interface document, the dependency diagram and the field rule library, and outputting corresponding test cases, the method further includes: Remove corresponding redundant test cases by comparing and analyzing the input combinations and expected outputs of test cases; Get the number of generated test cases and the number of covered input combinations, and match them with the preset coverage or number of test cases based on the number of generated test cases and the number of covered input combinations. If they do not meet the requirements, regenerate new test cases until they meet the requirements.

7. The automatic generation management method of test cases according to claim 1, characterized in that: After automatically generating test cases according to the application program interface document, the dependency diagram and the field rule library, and outputting corresponding test cases, the method further includes: A corresponding checkpoint list is determined based on a preset defect knowledge base, and matching optimization is performed on the generated test cases according to the checkpoint list. The defect knowledge base includes defect types, trigger conditions, and defect results.

8. A test case automatic generation management system, characterized in that: include: Scanning module: used to scan the code of the project to be tested by a pre-configured code scanning method to identify all the application program interfaces in the code of the project to be tested, and extract the path, request method, input parameter and output field of the corresponding application program interface from the code of the project to be tested; Extraction module: used to generate an application interface document that complies with the interface document standard according to the extracted application interface path, request method, input parameters and output fields; Judgment module: used to judge whether there is a pre-configured entity relationship data model, if so, obtain the pre-configured entity relationship data model, if not, obtain the test database associated with the project code to be tested, perform data analysis on the test database to obtain the corresponding entity relationship data model, and verify the entity relationship data model to determine whether it meets the requirements, and if so, execute the next step; wherein the entity relationship data model includes information of each data table in the database, the relationship between each data table, and attribute information of the data table; Association information module: used to obtain association information between data tables based on the entity relationship data model, and match the association information with the application interface document to determine the data table and field corresponding to the input parameter and the data table and field corresponding to the output field; Traversal module: used for performing a first traversal operation on the association relationship, the data table corresponding to the input parameter, and the data table corresponding to the output field to generate a corresponding dependency graph, and performing a second traversal operation on the association relationship, the field corresponding to the input parameter, and the field corresponding to the output field to determine a field rule library; Use case generation module: used to automatically generate test cases based on the application interface document, dependency diagram and field rule library, and output corresponding test cases.

9. An electronic device, characterized in that: include: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the automatic generation and management method of test cases according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program enables a computer to execute the automatic generation and management method of test cases according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Intelligent test method and device, equipment and storage medium

    CN112035357A

  • Automatic data testing method and device and electronic equipment

    CN118363870A

  • Test case automatic generation method and device, electronic equipment and storage medium

    CN118760613A

  • Method and system for automated generation of test scenarios and automation scripts

    US20210326247A1

Cited By

  • Interface test case generation method based on double-layer graph network

    CN120849285A