Test case generation method for database, test method, equipment and medium

After upgrading the database version, the attribute mapping is constructed based on the attribute information of the matching function of the description document, and a multi-dimensional test case is generated, which solves the problem of insufficient coverage of test cases in the existing technology, and achieves more efficient test coverage and effects.

CN120429239AInactive Publication Date: 2025-08-05TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510872985.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2025-08-05
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, after the database version is upgraded, past test cases cannot effectively cover the new test scenarios introduced by the new version of the database, resulting in poor testing results.

Method used

By matching function attribute information based on the database description document, building attribute maps, generating multi-dimensional test cases, and using parameter attribute information and use case samples to dynamically generate test cases to cover more scenarios.

Benefits of technology

Improve test coverage, ensure that test cases can effectively cover multiple scenarios in the new database version, and improve testing efficiency and effectiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120429239A_ABST
    Figure CN120429239A_ABST
Patent Text Reader

Abstract

The invention provides a test case generation method for a database, which can be applied to the field of database testing. The method comprises the steps that description documents corresponding to a database are matched according to key fields, function attribute information of multiple functions is obtained, and the function attribute information comprises at least one parameter and at least one use case sample corresponding to the functions; according to the function attribute information of the multiple functions, attribute mapping of the multiple functions is constructed, and the attribute mapping comprises the corresponding relation between each parameter and the parameter attribute information of the multiple parameter attribute items; and generating a plurality of test cases of each function according to the respective parameter attribute information for the plurality of parameter attribute items and the case samples corresponding to the functions. The invention also provides a test method, equipment and a medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database testing, and more particularly to a test case generation method, a testing method, a device and a medium for a database. Background Art

[0002] Functions in databases are diverse and complex. Database upgrades may involve modifications to these functions. To improve the robustness of database systems, it's often necessary to rewrite test cases to test these functions. However, rewriting test cases for the data is time-consuming, resulting in low database testing efficiency. Related techniques group previously used test cases to extract relevant test case templates for each group. These extracted test case templates are then used to test the database in conjunction with the test data used by the original test cases.

[0003] In the process of realizing the concept of the present invention, there are at least the following problems in the related art: the test cases used in the past were designed for the test scenarios of the database before the version upgrade, and were unable to predict the new test scenarios introduced by the new version of the database, resulting in poor results when using the test cases generated in the related art to test the new version of the database. Summary of the Invention

[0004] In view of the above problems, the present invention provides a test case generation method, a testing method, a device and a medium for a database to improve the quality of test cases.

[0005] According to a first aspect of the present invention, a test case generation method for a database is provided, the method comprising: matching a description document corresponding to the database according to key fields to obtain function attribute information of each of a plurality of functions, wherein the function attribute information comprises at least one parameter and at least one use case sample corresponding to the function; constructing attribute mappings for each of the plurality of functions according to the function attribute information of each of the plurality of functions, wherein the attribute mappings comprise a correspondence between each of the parameters and the parameter attribute information of each of a plurality of parameter attribute items; generating a plurality of test cases for each function according to the parameter attribute information for each of the plurality of parameter attribute items and the use case samples corresponding to the functions.

[0006] According to an embodiment of the present invention, the above-mentioned generation of multiple test cases for each function based on the parameter attribute information of each of the above-mentioned multiple parameter attribute items and the use case samples corresponding to the function includes: determining the candidate parameter values of the above-mentioned parameters based on the parameter attribute information of each of the above-mentioned multiple parameter attribute items; determining multiple groups of parameter value combinations for testing based on the above-mentioned multiple parameters and the candidate parameter values of each of the above-mentioned multiple parameters; generating multiple test cases for each of the above-mentioned functions based on the above-mentioned multiple groups of parameter value combinations and the above-mentioned use case samples.

[0007] According to an embodiment of the present invention, the above-mentioned determination of multiple groups of parameter value combinations for testing based on the above-mentioned multiple parameters and the candidate parameter values of each of the above-mentioned multiple parameters includes: determining a target orthogonal table from multiple preset candidate orthogonal tables based on the number of the above-mentioned multiple parameters and the number of candidate parameter values of the above-mentioned multiple parameters; and filling the above-mentioned target orthogonal table according to the candidate parameter values of the above-mentioned multiple parameters to obtain the above-mentioned multiple groups of parameter value combinations.

[0008] According to an embodiment of the present invention, the above-mentioned parameter attribute items include: mandatory attribute items and constraint attribute items, the first attribute information corresponding to the above-mentioned mandatory attribute items represents whether the above-mentioned parameters are mandatory, and the second attribute information corresponding to the above-mentioned constraint attribute items is determined based on at least one of the type, format and dependency relationship of the above-mentioned parameters; the above-mentioned determination of the candidate parameter values of the above-mentioned parameters based on the parameter attribute information of each of the above-mentioned multiple parameter attribute items includes: when the above-mentioned first attribute information represents that the above-mentioned parameter is mandatory, determining multiple first candidate parameter values that meet the above-mentioned second attribute information, second candidate parameter values that do not meet the above-mentioned second attribute information, and a third candidate parameter value representing an empty value; when the above-mentioned first attribute information represents that the above-mentioned parameter is non-mandatory, determining a fourth candidate parameter value that meets the above-mentioned second attribute information and a third candidate parameter value representing an empty value.

[0009] According to an embodiment of the present invention, the above-mentioned parameter attribute items include: dependency attribute items, and the third attribute information corresponding to the above-mentioned dependency attribute items is used to characterize whether the above-mentioned parameters have a dependency relationship across parameter levels, and the dependency parameters when the above-mentioned parameters have a dependency relationship across parameter levels, and the above-mentioned dependency relationship across parameter levels is determined based on the sub-information characterizing the grammatical definition of the above-mentioned function included in the above-mentioned function attribute information; the above-mentioned method also includes: when the above-mentioned third attribute information characterizes that the above-mentioned parameters have a dependency relationship, determining the target function that does not satisfy the second attribute information of the above-mentioned parameters, wherein the above-mentioned target function includes the dependency parameters of the above-mentioned parameters, and the above-mentioned target function is nested in the function of the above-mentioned parameters; according to the parameter attribute information of each of the multiple parameter attribute items of the sub-parameters of the above-mentioned target function, determining multiple candidate sub-parameter values that satisfy the second attribute information of the above-mentioned sub-parameters.

[0010] According to an embodiment of the present invention, the above-mentioned determination of multiple first candidate parameter values that meet the above-mentioned second attribute information includes: determining the type of the above-mentioned parameter based on the above-mentioned second attribute information; when the type of the above-mentioned parameter represents that the above-mentioned parameter has a boundary value, the boundary value and the intermediate value of the above-mentioned parameter are respectively used as the above-mentioned first candidate parameter value.

[0011] According to an embodiment of the present invention, the above method also includes: obtaining the execution path of each of the above multiple test cases, the above execution path representing the code execution order triggered by the test case during the execution process; optimizing the above multiple test cases according to the execution path of each of the above multiple test cases to merge test cases with the same execution path.

[0012] The second aspect of the present invention provides a database testing method, which includes: testing the first database and the second database respectively according to multiple test cases corresponding to the first database, and obtaining a first test result corresponding to the first database and a second test result corresponding to the second database, wherein the multiple test cases are generated according to any of the above methods; and obtaining a test result for the first database by comparing the first test result with the second test result.

[0013] A third aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.

[0014] The fourth aspect of the present invention further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the computer program or instructions are executed by a processor.

[0015] According to an embodiment of the present invention, the description document corresponding to the database is matched by key fields. Leveraging the synchronous updating feature of the description document along with the database, function attribute information corresponding to scenarios such as newly added functions or parameter changes is obtained. Based on the obtained function attribute information, a property mapping is dynamically constructed to utilize the parameter attribute information for each of multiple parameter attribute items to standardize the attributes of the function parameters from multiple dimensions. Based on the obtained parameter attribute information for each of the multiple parameter attribute items and the use case samples corresponding to the function, multiple test cases are generated for each function. By utilizing the synchronization feature of the function attribute information used to construct the attribute mapping with the database and the multi-dimensional coverage feature of the parameter attribute information for each of the multiple parameter attribute items, the coverage of the test cases is ensured, thereby improving the test coverage rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The above contents and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings.

[0017] Figure 1 An application scenario diagram of a test case generation method, a test method, a device, and a medium for a database according to an embodiment of the present invention is shown.

[0018] Figure 2 A flow chart of a test case generation method for a database according to an embodiment of the present invention is shown.

[0019] Figure 3 A schematic diagram of a test case generation method for a database according to an embodiment of the present invention is shown.

[0020] Figure 4 A flowchart of a database testing method according to an embodiment of the present invention is shown.

[0021] Figure 5 The figure shows a structural block diagram of a test case generating device for a database according to an embodiment of the present invention.

[0022] Figure 6 The figure shows a structural block diagram of a database testing device according to an embodiment of the present invention.

[0023] Figure 7 A block diagram of an electronic device suitable for implementing a test case generation method for a database and a database testing method according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0024] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concept of the present invention.

[0025] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the presence of the features, steps, operations and / or components, but do not exclude the presence or addition of one or more other features, steps, operations or components.

[0026] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0027] When expressions such as "at least one of A, B, and C, etc." are used, they should generally be interpreted in accordance with the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0028] In the technical solutions of the present invention, the collection, updating, analysis, processing, use, transmission, provision, disclosure, and storage of all data involved (including, but not limited to, user personal information) comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. In particular, necessary measures are taken to prevent unauthorized access to user personal information data and maintain the security of user personal information and network security.

[0029] There are many types of functions in the database, and their usage scenarios are complex. The syntax rules of each function are different, and there are often scenarios where multiple functions are nested. If test cases are designed manually, it is necessary to understand the usage scenarios of each function and design corresponding test cases for each function. The process of writing test cases is complicated and affects testing efficiency.

[0030] Related technologies have proposed extracting test templates from previously used test cases, combining them with the test data used in the original test cases, or manually re-determining the data used for testing, to generate test cases for testing the database. However, the test cases used in the past are only used to verify the test scenarios involved in the historical version of the database. After the database version is upgraded, new scenarios that need to be tested may be introduced. For example, for a function in the database, the nesting relationship of the function in the new version of the database, and even the value range of the parameters in the function may change. For another example, after the function adds support for the date (DATE) type, the historical template still only tests the integer type (INT) or the floating point type (FLOAT).

[0031] The method of generating test cases in related technologies does not provide sufficient coverage of the generated test case scenarios, resulting in poor testing results for the new version of the database.

[0032] In view of this, an embodiment of the present invention provides a test case generation method for a database, comprising: matching the description document corresponding to the database according to key fields to obtain function attribute information of each of multiple functions, wherein the function attribute information includes at least one parameter and at least one use case sample corresponding to the function; constructing attribute mappings for each of the multiple functions according to the function attribute information of each of the multiple functions, wherein the attribute mapping includes a correspondence between each parameter and the parameter attribute information of each of the multiple parameter attribute items; generating multiple test cases for each function according to the parameter attribute information for each of the multiple parameter attribute items and the use case samples corresponding to the function.

[0033] Figure 1 An application scenario diagram of a test case generation method, a test method, a device, and a medium for a database according to an embodiment of the present invention is shown.

[0034] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a server 104, and a database 105. Communication link media are provided between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 104, and between the server 104 and the database 105. The communication link media may include various connection types, such as wired or wireless communication links or fiber optic cables. The database 105 may be a database or database cluster serving as a test object.

[0035] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 104 through the medium of the communication link to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0036] The first terminal device 101 , the second terminal device 102 , and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0037] The server 104 may be a server that provides various services, such as a background management server (for example only) that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process received data such as user requests, and feed back processing results (e.g., web pages, information, or data obtained or generated based on user requests) to the terminal devices.

[0038] It should be noted that the test case generation method for a database and the test method for a database provided in the embodiment of the present invention can generally be executed by the server 104. Accordingly, the test case generation device for a database and the test device for a database provided in the embodiment of the present invention can generally be set in the server 104. The test case generation method for a database and the test method for a database provided in the embodiment of the present invention can also be executed by a server or server cluster that is different from the server 104 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 104. Accordingly, the test case generation device for a database and the test device for a database provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the server 104 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 104.

[0039] It should be understood that Figure 1 The number of the first terminal device, the second terminal device, the third terminal device, the server and the database in the embodiment is only . According to the implementation requirements, there can be any number of the first terminal device, the second terminal device, the third terminal device and the server.

[0040] The following will be based on Figure 1 The scene described by Figure 2~Figure 3 A test case generation method for a database according to an embodiment of the present invention is described in detail.

[0041] Figure 2 A flow chart of a test case generation method for a database according to an embodiment of the present invention is shown.

[0042] like Figure 2 As shown, the test case generation method for a database in this embodiment includes operations S210 to S230.

[0043] In operation S210, description documents corresponding to the database are matched according to key fields to obtain function attribute information of each of the multiple functions, wherein the function attribute information includes at least one parameter and at least one use case sample corresponding to the function.

[0044] In operation S220 , attribute maps of the plurality of functions are constructed according to the function attribute information of the plurality of functions, wherein the attribute map includes a correspondence between each parameter and the parameter attribute information of the plurality of parameter attribute items.

[0045] In operation S230 , a plurality of test cases for each function are generated based on parameter attribute information for each of the plurality of parameter attribute items and use case samples corresponding to the function.

[0046] According to an embodiment of the present invention, the description document corresponding to the database includes an operating environment description section, a function description section, and a permission management section. The function description section in the description document is used to record the function syntax rules of the database, for example, including records of the syntax rules of various types of functions, such as flow control functions, string functions, numeric functions, and date and time functions.

[0047] According to an embodiment of the present invention, a key field may be a field in a description document that identifies function attribute information. Key fields may include a function name field, a grammar rule field, a function description field, and a use case sample field, etc. Correspondingly, function attribute information may include the function name, grammar rule, function description, and use case sample. A function description may be a description of the function's function, for example, "concatenate two or more strings"; a grammar rule may include a definition of each parameter included in the function, and the grammar rule may include information such as parameter name and parameter type. A use case sample may be a specific application example of the function.

[0048] According to an embodiment of the present invention, a description document is traversed based on pre-defined key fields, the content of the description document is matched, and the content in the description document that matches the key fields is determined, thereby obtaining function attribute information for each of the multiple functions. For example, the "function name field" can be used to match the content in the description document to obtain the function name corresponding to the "function name field". The method for obtaining information corresponding to other key fields is the same as the method for obtaining information corresponding to the "function name field", and will not be repeated here.

[0049] According to an embodiment of the present invention, multiple parameter attribute items are used to describe the parameter attributes of an input function from multiple dimensions. For example, a parameter attribute item may include a parameter name, a parameter type, etc. Parameter attribute information represents the specific information of the parameter attribute item corresponding to the parameter. For example, a parameter attribute item may include a parameter name, and the parameter attribute information corresponding to the parameter attribute item may be the specific parameter name "num".

[0050] According to an embodiment of the present invention, for each function, parameter attribute information of a parameter can be extracted from the function attribute information of multiple functions according to the parameter attribute items to obtain the corresponding relationship between the parameter and the parameter attribute information of multiple parameter attribute items.

[0051] According to an embodiment of the present invention, a test case includes code for testing data. For example, the test code may be a digitized query statement. Based on parameter attribute information for each of the multiple parameter attribute items, parameter values for each of the multiple sets of input functions used for testing are determined. This, combined with the use case samples corresponding to the functions, generates multiple test cases for each function.

[0052] According to an embodiment of the present invention, the description document corresponding to the database is matched by key fields. Leveraging the synchronous updating feature of the description document along with the database, function attribute information corresponding to scenarios such as newly added functions or parameter changes is obtained. Based on the obtained function attribute information, a property mapping is dynamically constructed to utilize the parameter attribute information for each of multiple parameter attribute items to standardize the attributes of the function parameters from multiple dimensions. Based on the obtained parameter attribute information for each of the multiple parameter attribute items and the use case samples corresponding to the function, multiple test cases are generated for each function. By utilizing the synchronization feature of the function attribute information used to construct the attribute mapping with the database and the multi-dimensional coverage feature of the parameter attribute information for each of the multiple parameter attribute items, the coverage of the test cases is ensured, thereby improving the test coverage rate.

[0053] According to an embodiment of the present invention, multiple test cases are generated for each function based on parameter attribute information for each of the multiple parameter attribute items and use case samples corresponding to the function, including: determining candidate parameter values for the parameters based on the parameter attribute information for each of the multiple parameter attribute items; determining multiple groups of parameter value combinations for testing based on the multiple parameters and the candidate parameter values for each of the multiple parameters; and generating multiple test cases for each function based on the multiple groups of parameter value combinations and the use case samples.

[0054] According to an embodiment of the present invention, candidate parameter values represent parameter values to be tested. Parameter attribute information for each of multiple parameter attribute items defines multiple attributes of the parameter. Candidate parameter values for the parameter are determined based on the parameter attributes defined in the parameter attribute information. For example, if the parameter attribute information only defines the parameter data type as floating point, an algorithm for generating random numbers can be invoked to randomly generate one or more candidate parameter values for the parameter.

[0055] According to an embodiment of the present invention, for each function, based on the multiple parameters included in the function and the candidate parameter values of the multiple parameters, the candidate parameter values of the multiple parameters are arranged and combined, thereby determining multiple groups of parameter value combinations. For example, function A includes parameter 1 and parameter 2, and the candidate parameter values of parameter 1 include "Hello" and "Hola", and the candidate parameter values of parameter 2 include "World" and "!"; the candidate parameter values of parameter 1 and parameter 2 are arranged and combined to obtain the parameter value combination "Hello" "World", the parameter value combination "Hello" "!", the parameter value combination "Hola" "World", and the parameter value combination "Hola" "!".

[0056] According to an embodiment of the present invention, for each set of parameter value combinations, the candidate parameter values in the parameter value combination are used to replace the parameter values in the use case sample to generate a test case for the function. For example, the use case sample of the function is a function for concatenating two strings. The function in the use case sample includes two parameters: parameter 1 and parameter 2. The values of parameter 1 and parameter 2 are "you" and "good", respectively. The parameter value combination: parameter 1: "Hello", parameter 2: "World" can be used to replace the parameter values in the use case sample to obtain a test case.

[0057] According to an embodiment of the present invention, parameter attribute information for each of a plurality of parameter attribute items is utilized to determine the candidate parameter values actually selected in the test case, thereby determining a plurality of parameter value combinations based on the candidate parameter values, and dynamically generating a plurality of test cases for the function based on the plurality of parameter value combinations and sample cases, so as to utilize the plurality of parameter value combinations to cover as many test scenarios as possible, thereby improving the test coverage of the database.

[0058] According to an embodiment of the present invention, multiple groups of parameter value combinations for testing are determined based on multiple parameters and candidate parameter values of each of the multiple parameters, including: determining a target orthogonal table from multiple preset candidate orthogonal tables based on the number of multiple parameters and the number of candidate parameter values of the multiple parameters; and filling the target orthogonal table according to the candidate parameter values of the multiple parameters to obtain multiple groups of parameter value combinations.

[0059] According to an embodiment of the present invention, a candidate orthogonal table is a pre-set, selectable orthogonal table. An orthogonal table is a tool for designing test cases. Based on the number of parameters and the number of candidate parameter values for each parameter, multiple candidate orthogonal tables are screened to cover the number of parameters and candidate values in the orthogonal table. The candidate orthogonal table with the fewest rows among the multiple candidate orthogonal tables that cover the number of parameters and candidate values in the orthogonal table is determined as the target orthogonal table, thereby minimizing the number of generated test cases.

[0060] According to an embodiment of the present invention, candidate parameter values for each parameter are mapped column-by-column to an orthogonal table, and the cells in the orthogonal table are directly populated to generate multiple sets of parameter value combinations. This target orthogonal table covers all pairwise interaction scenarios for candidate parameter values for all parameters, reducing redundant parameter value combinations and allowing the database to allocate more test cases to other scenarios, thereby improving test coverage.

[0061] According to an embodiment of the present invention, parameter attribute items include: mandatory attribute items and constraint attribute items, the first attribute information corresponding to the mandatory attribute item represents whether the parameter is mandatory, and the second attribute information corresponding to the constraint attribute item is determined based on at least one of the type, format and dependency relationship of the parameter; according to the parameter attribute information of each of the multiple parameter attribute items, the candidate parameter values of the parameter are determined, including: when the first attribute information represents that the parameter is mandatory, determining multiple first candidate parameter values that meet the second attribute information, second candidate parameter values that do not meet the second attribute information, and a third candidate parameter value representing a null value; when the first attribute information represents that the parameter is non-mandatory, determining a fourth candidate parameter value that meets the second attribute information and a third candidate parameter value representing a null value.

[0062] According to an embodiment of the present invention, for some functions, even if individual parameters in the function are not assigned values, the function can still be executed normally, so a mandatory attribute item can be set for the parameter to indicate whether the parameter value can be left blank.

[0063] According to an embodiment of the present invention, the type of a parameter can be the data type of the parameter. For example, the parameter type can include integers, strings, Boolean values, enumeration values, dates, etc. The format of a parameter can be a specific format requirement of the parameter, for example, a string must conform to an email format, a date must be in the YYYY-MM-DD format, a value must be within a certain range, etc. Parameter dependencies are used to constrain the relationship between a parameter and other parameters in the same function. For example, the value of parameter 1 must be valid only when the value of parameter 2 is greater than 10. For another example, if function A nests function B, the nesting relationship is: function A (function B (parameter 3, parameter 4), parameter 5). Parameter 3 must be type-compatible with parameter 5 in function A.

[0064] According to an embodiment of the present invention, the type and format of a parameter can define the value range of the parameter, for example, the date and the date format can limit the set of legal dates that the parameter can take; the type and dependency of a parameter can define the compatibility relationship between parameter types, for example, a floating-point type parameter value needs to be converted into an integer type parameter value to be compatible with the parameter value of another parameter; the format and dependency of a parameter can define the conditional boundaries of the parameter, for example, when the parameter value of one parameter is greater than 10, the value range of the parameter value of another parameter is greater than or equal to 50.

[0065] According to an embodiment of the present invention, the format, type and dependency of the parameters can more accurately define the constraint conditions of the parameters. By parsing the independent or combined semantics of the type, format and dependency, the abstract parameters are converted into executable test rules, ensuring that the generated use cases are both comprehensive and consistent with business logic.

[0066] According to an embodiment of the present invention, when the first attribute information representation parameter is mandatory, multiple first candidate parameter values are determined within the range of satisfying the second attribute information. For example, the type of parameter 1 is an integer type, there are no format requirements and dependencies, and multiple first candidate parameter values of parameter 1 can be randomly selected within the numerical value range limited by the integer type.

[0067] According to an embodiment of the present invention, determining multiple first candidate parameter values that meet the second attribute information includes: determining the type of the parameter based on the second attribute information; when the type of the parameter represents that the parameter has a boundary value, respectively taking the boundary value and the intermediate value of the parameter as the first candidate parameter value.

[0068] According to an embodiment of the present invention, the parameter type is determined based on the second attribute information. If the parameter type is an integer or date type, the parameter has boundary values. Boundary values may include maximum and minimum values. If the second attribute information does not contain any constraints on the parameter value range, the maximum, minimum, and median values that the parameter can take under this type are determined, and the maximum, minimum, and median values of the parameter are respectively used as the first candidate parameter value. For example, the maximum value of a date type parameter is 9999-12-31, and the minimum value is 0000-01-01.

[0069] According to an embodiment of the present invention, software errors often occur at the edge of the input or output range. For parameters with boundary values, the boundary values and intermediate values of the parameters are used as candidate parameter values, making the first candidate parameter value more representative, thereby improving test coverage.

[0070] According to an embodiment of the present invention, a second candidate parameter value that does not satisfy the second attribute information is determined. For example, if the type of parameter 1 is an integer with no format requirements or dependencies, a type different from the integer type is determined based on the parameter type, including multiple types such as floating-point types, and data of that type is randomly generated. For example, floating-point or string type data is randomly generated as the second candidate parameter value. For another example, the format of data in date format is randomly changed to determine it as the second candidate parameter value. The third candidate parameter value can be represented by "NULL".

[0071] According to an embodiment of the present invention, when the first attribute information representing the parameter is optional, a fourth candidate parameter value that satisfies the second attribute information and a third candidate parameter value representing a null value are determined for the parameter.

[0072] According to an embodiment of the present invention, the parameters are divided into mandatory parameters and non-mandatory parameters using the first attribute information corresponding to the mandatory attribute items of the parameters. For the mandatory parameters, the second attribute information corresponding to the constraint attribute items of the parameters is determined based on the type, format, and dependency relationship of the parameters. The second attribute information is used to determine the first candidate parameter value for regular testing, and the second and third candidate parameter values for abnormal testing. For the non-mandatory parameters, the second attribute information is used to determine the fourth and third candidate parameter values for regular testing.

[0073] According to an embodiment of the present invention, the mandatory attribute items of the parameters are used to divide the parameters into mandatory parameters and non-mandatory parameters, so as to provide more candidate parameter values for the mandatory parameters in a targeted manner and increase the test scenarios of the key parameters. The second attribute information corresponding to the constraint attribute item is used to determine the candidate parameter values that meet the second attribute information and the candidate parameter values that do not meet the second attribute information. The candidate value parameters for the test parameter valid scenario and the candidate value parameters for the test parameter invalid scenario are determined to cover more test scenarios and improve the test coverage.

[0074] According to an embodiment of the present invention, the parameter attribute item includes: a dependency attribute item, and the third attribute information corresponding to the dependency attribute item is used to characterize whether the parameter has a dependency relationship across parameter levels, and the dependent parameter when the parameter has a dependency relationship across parameter levels, and the dependency relationship across parameter levels is determined based on the sub-information of the grammatical definition of the function characterizing the function included in the function attribute information; the test case generation method for a database also includes: when the third attribute information characterizes that the parameter has a dependency relationship across parameter levels, determining a target function that does not satisfy the second attribute information of the parameter, wherein the target function includes the dependent parameter of the parameter, and the target function is nested in the function of the parameter; based on the parameter attribute information of each of the multiple parameter attribute items of the sub-parameter of the target function, determining multiple candidate sub-parameter values that satisfy the second attribute information of the sub-parameter.

[0075] According to an embodiment of the present invention, when a function is nested within another function, parameters act directly on the function, or directly on the other nested functions. For example, if the nesting relationship is: function A (function B (parameter 3, parameter 4), parameter 5), parameters 3 and 4 act directly on function B, and parameter 5 and the parameters represented by function B act directly on function A.

[0076] According to an embodiment of the present invention, the sub-information representing the grammatical definition of a function is used to define the parameter hierarchy and logical constraints of each parameter within the function. For example, a logical constraint is that parameter 1 is less than parameter 2, and another example is that the format of parameter 1 is the same as parameter 2. The parameter hierarchy is used to identify the function on which the parameter directly acts or the hierarchy of other functions nested within the function. For example, in the case of a nested relationship of: function A (function B (parameter 3, parameter 4), parameter 5), the parameter hierarchy of parameter 3 and parameter 4 can be the first level; the parameter hierarchy of parameter 5 and the parameter represented by function B can be the second level.

[0077] According to an embodiment of the present invention, the sub-information representing the grammatical definition of the function is called to determine the third attribute information corresponding to the dependency attribute item based on the sub-information of the grammatical definition of the function. If the third attribute information represents that the parameter has a dependency relationship across parameter levels, a target function that does not satisfy the second attribute information of the parameter is selected from other functions in the database.

[0078] For example, in the case of a nested relationship of function A (function B (parameter 4), parameter 5), the third attribute information of parameter 5 represents the dependency relationship between parameter 5 and parameter 4. Specifically, the second attribute information of parameter 5 includes that parameter 5 is of the same type as parameter 4, and the type of parameter 4 is an integer type, and a function similar to function B is selected from the database. However, the second attribute information of the parameters in the function includes other types of functions as the target function.

[0079] According to an embodiment of the present invention, based on the parameter attribute information of each of the multiple parameter attribute items of the sub-parameters of the objective function, the method for determining the candidate parameter values in any of the above embodiments can be used to determine multiple candidate sub-parameter values that meet the second attribute information of the sub-parameters.

[0080] According to an embodiment of the present invention, test cases are generated based on candidate sub-parameter values for parameters in the target function, candidate parameter values for parameters in the function, and sample examples of functions within which the target function is nested. The third attribute information of the parameter is used to add test cases for function nesting errors, thus adding test scenarios to database testing and improving test coverage.

[0081] Figure 3 A schematic diagram of a test case generation method for a database according to an embodiment of the present invention is shown.

[0082] like Figure 3As shown, taking the generation of a test case for a function as an example, the function attribute information of the function is obtained by matching the description document 301 corresponding to the database according to the key fields. Based on the function attribute information of the function, a function attribute map 302 is constructed. Attribute map 302 includes the parameter attribute information of each of the n parameters in the function. For example, the n parameters include the parameter corresponding to parameter name 1, the parameter corresponding to parameter name 2, ..., and the parameter corresponding to parameter name n. n is a positive integer.

[0083] In addition, the parameter attribute information includes information corresponding to multiple parameter attribute items, such as dependency attribute items, required attribute items, and constraint attribute items, for each of the n parameters. Multiple candidate parameter values are determined based on the parameter attribute information for each of the multiple parameter attribute items. A target orthogonal table is determined from the multiple candidate orthogonal tables based on the number of the multiple parameters and the number of candidate parameter values for the multiple parameters. The target orthogonal table is populated based on the candidate parameter values for the multiple parameters to obtain m groups of parameter value combinations. Based on the m groups of parameter value combinations and a use case example including function code, m test cases 303 for the function are generated.

[0084] According to an embodiment of the present invention, the test case generation method for a database also includes: obtaining the execution paths of multiple test cases, the execution paths representing the code execution order triggered by the test cases during the execution process; optimizing the multiple test cases according to the execution paths of the multiple test cases to merge test cases with the same execution paths.

[0085] According to an embodiment of the present invention, for the same function, if the function's input parameters are different, the database may execute different logic. For example, the function includes a judgment statement, and if the input parameter is greater than 100, it executes operation 1, otherwise it executes operation 2. For another example, if the function contains a database structured query statement, different parameter values will cause the database to use different scanning methods, namely, full scan or index scan.

[0086] According to an embodiment of the present invention, by pre-running test cases in a database, the execution paths of multiple test cases can be determined based on the database logs. Test cases with the same execution path can be merged to conserve database hardware resources. The saved hardware resources can then be allocated to test cases with different execution paths, thereby improving the average coverage of database testing.

[0087] Figure 4 A flowchart of a database testing method according to an embodiment of the present invention is shown.

[0088] like Figure 4 As shown, the test case generation method for a database in this embodiment includes: operations S410 to S420.

[0089] In operation S410, the first database and the second database are tested respectively according to multiple test cases corresponding to the first database to obtain a first test result corresponding to the first database and a second test result corresponding to the second database, wherein the multiple test cases are generated according to the test case generation method for a database of any embodiment.

[0090] In operation S420 , a test result for the first database is obtained by comparing the first test result and the second test result.

[0091] According to an embodiment of the present invention, the first database can be a database that has not yet been tested and is yet to be put into use, and the second database can be a database that has already passed testing and is now in use. After the test environment is deployed, multiple test cases corresponding to the first database are sequentially read, and multiple test cases are executed on the second database. To record the second test results of each of the multiple test cases, each test case and its corresponding second test result can be saved in a file using the "database query language name + database version number" file naming format. The database query language name can be obtained from the test case.

[0092] According to an embodiment of the present invention, the test results can be stored in a dictionary format, where the key is the database query statement executed in the test case, and the value is the feedback information given by the second database. If a file with the same name already exists in the local test environment, the newly generated file will be used to overwrite the existing file with the same name in the local environment. Otherwise, it will be automatically submitted and saved in the test case library.

[0093] According to an embodiment of the present invention, a plurality of test cases corresponding to the first database are read in sequence, and the first database is tested in the same manner as the second database to obtain a plurality of first test results.

[0094] According to an embodiment of the present invention, the test result may include a test case used in the test, and a first test result and a second test result corresponding to the test case. The first test result and the second test result are compared, and if the first test result and the second test result are different, the first test result and the second test result, as well as the test case corresponding to the first test result and the second test result, are saved to generate a test report and send it to an email address of an operation and maintenance personnel, so that the operation and maintenance personnel can adjust and dimension the database based on the test results.

[0095] According to an embodiment of the present invention, when the first test result is the same as the second test result, the first test result, the second test result, and the test cases corresponding to the first test result and the second test result may be saved in a database.

[0096] Based on the above test case generation method for database, the present invention also provides a test case generation device for database. Figure 5 The device is described in detail.

[0097] Figure 5 The figure shows a structural block diagram of a test case generating device for a database according to an embodiment of the present invention.

[0098] like Figure 5 As shown, the test case generating apparatus 500 for a database in this embodiment includes an information determining module 510 , a mapping constructing module 520 and a test case generating module 530 .

[0099] Information determination module 510 is configured to match the description document corresponding to the database based on the key fields to obtain function attribute information for each of the multiple functions, where the function attribute information includes at least one parameter and at least one use case sample corresponding to the function. In one embodiment, information determination module 510 can be configured to perform operation S210 described above and will not be further described here.

[0100] Mapping construction module 520 is configured to construct attribute mappings for each of the multiple functions based on the function attribute information of each of the multiple functions, wherein the attribute mappings include a correspondence between each parameter and the parameter attribute information of each of the multiple parameter attribute items. In one embodiment, mapping construction module 520 can be configured to perform operation S220 described above, which will not be further described here.

[0101] The use case generation module 530 is used to generate multiple test cases for each function based on the parameter attribute information for each of the multiple parameter attribute items and the use case samples corresponding to the function. In one embodiment, the use case generation module 530 can be used to perform the operation S230 described above, which will not be repeated here.

[0102] According to an embodiment of the present invention, the use case generation module 530 includes: a parameter determination submodule, a combination determination submodule, and a use case generation submodule.

[0103] The parameter determination submodule is used to determine the candidate parameter values of the parameters according to the parameter attribute information of each of the multiple parameter attribute items.

[0104] The combination determination submodule is used to determine multiple groups of parameter value combinations for testing based on multiple parameters and candidate parameter values of each of the multiple parameters.

[0105] The use case generation submodule is used to generate multiple test cases for each function based on multiple sets of parameter value combinations and use case samples.

[0106] According to an embodiment of the present invention, the combination determination submodule includes: a target determination unit and a combination determination unit.

[0107] The target determination unit is configured to determine a target orthogonal table from a plurality of preset candidate orthogonal tables according to the number of the plurality of parameters and the number of candidate parameter values of the plurality of parameters.

[0108] The combination determination unit is used to fill the target orthogonal table according to the candidate parameter values of multiple parameters to obtain multiple groups of parameter value combinations.

[0109] According to an embodiment of the present invention, parameter attribute items include: mandatory attribute items and constraint attribute items. The first attribute information corresponding to the mandatory attribute item represents whether the parameter is mandatory, and the second attribute information corresponding to the constraint attribute item is determined based on at least one of the type, format and dependency relationship of the parameter.

[0110] According to an embodiment of the present invention, the parameter determination submodule includes: a first determination unit and a second determination unit.

[0111] The first determining unit is configured to determine, when the first attribute information representing a parameter is mandatory, a plurality of first candidate parameter values that meet the second attribute information, a second candidate parameter value that does not meet the second attribute information, and a third candidate parameter value representing a null value.

[0112] The second determining unit is configured to determine, when the first attribute information characterizing the parameter is optional, a fourth candidate parameter value that satisfies the second attribute information and a third candidate parameter value that characterizes a null value.

[0113] According to an embodiment of the present invention, the parameter attribute item includes: a dependency attribute item, and the third attribute information corresponding to the dependency attribute item represents whether the parameter has a dependency relationship across parameter levels, and the dependent parameter when the parameter has a dependency relationship across parameter levels, and the dependency relationship across parameter levels is determined based on the sub-information of the grammatical definition representing the function included in the function attribute information.

[0114] The parameter determination submodule further includes: a third determination unit and a fourth determination unit.

[0115] The third determining unit is used to determine the objective function of the second attribute information that does not satisfy the parameters when the third attribute information represents that the parameters have a dependency relationship, wherein the objective function includes the dependency parameters of the parameters and the objective function is nested in the function of the parameters.

[0116] The fourth determining unit is configured to determine, based on parameter attribute information of each of the plurality of parameter attribute items of the sub-parameters of the objective function, a plurality of candidate sub-parameter values that satisfy the second attribute information of the sub-parameters.

[0117] According to an embodiment of the present invention, the first determination unit includes: a type determination subunit and a parameter determination subunit.

[0118] The type determination subunit is used to determine the type of the parameter according to the second attribute information.

[0119] The parameter determination subunit is used to respectively use the boundary value and the intermediate value of the parameter as the first candidate parameter value when the type of the parameter characterizes that the parameter has a boundary value.

[0120] According to an embodiment of the present invention, the test case generating device 500 for a database further includes: a path determination module and a use case optimization module.

[0121] The path determination module is used to obtain the execution path of each of the multiple test cases. The execution path represents the execution order of the code in the database triggered by the test case during the execution process.

[0122] The use case optimization module is used to optimize multiple test cases according to their respective execution paths to merge test cases with the same execution path.

[0123] Based on the above test case generation method for database, the present invention also provides a test case generation device for database. Figure 5 The device is described in detail.

[0124] Figure 6 The figure shows a structural block diagram of a database testing device according to an embodiment of the present invention.

[0125] like Figure 6 As shown, the database testing device 600 of this embodiment includes a testing module 610 and a comparison module 620 .

[0126] The testing module 610 is used to test the first database and the second database respectively according to multiple test cases corresponding to the first database, and obtain a first test result corresponding to the first database and a second test result corresponding to the second database, wherein the multiple test cases are generated according to any of the above-mentioned test case generation methods for the database.

[0127] The comparison module 620 is configured to obtain a test result for the first database by comparing the first test result and the second test result.

[0128] According to embodiments of the present invention, any multiple modules among the information determination module 510, mapping construction module 520, use case generation module 530, testing module 610, and comparison module 620 may be combined into a single module, or any one of these modules may be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of other modules and implemented in a single module. According to embodiments of the present invention, at least one of the information determination module 510, mapping construction module 520, use case generation module 530, testing module 610, and comparison module 620 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or may be implemented in hardware or firmware through any other reasonable means of circuit integration or packaging, or implemented in any one of software, hardware, and firmware, or any suitable combination of these. Alternatively, at least one of the information determination module 510, the mapping construction module 520, the use case generation module 530, the testing module 610 and the comparison module 620 may be at least partially implemented as a computer program module, which may perform corresponding functions when executed.

[0129] Figure 7 A block diagram of an electronic device suitable for implementing a test case generation method for a database and a database testing method according to an embodiment of the present invention is shown.

[0130] like Figure 7 As shown, an electronic device 700 according to an embodiment of the present invention includes a processor 701, which can perform various appropriate actions and processes based on programs stored in a read-only memory (ROM) 702 or programs loaded from a storage unit 708 into a random access memory (RAM) 703. The processor 701 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or related chipsets and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include onboard memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.

[0131] Various programs and data required for the operation of the electronic device 700 are stored in the RAM 703. The processor 701, ROM 702, and RAM 703 are connected to each other via a bus 704. The processor 701 performs various operations according to the method flow of the embodiment of the present invention by executing the programs in the ROM 702 and / or RAM 703. It should be noted that the programs may also be stored in one or more memories other than the ROM 702 and RAM 703. The processor 701 may also perform various operations according to the method flow of the embodiment of the present invention by executing the programs stored in the one or more memories.

[0132] According to an embodiment of the present invention, electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to bus 704. Electronic device 700 may also include one or more of the following components connected to I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including devices such as a cathode ray tube (CRT), liquid crystal display (LCD), and speakers; a storage section 708 including a hard disk; and a communication section 709 including a network interface card such as a LAN card or modem. Communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to I / O interface 705 as needed. Removable media 711, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed in drive 710 as needed, so that computer programs read from the removable media can be installed into storage section 708 as needed.

[0133] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments, or may exist independently and not incorporated into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present invention.

[0134] According to an embodiment of the present invention, a computer-readable storage medium may be a non-volatile computer-readable storage medium, and may include, for example, but not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present invention, a computer-readable storage medium may include the ROM 702 and / or RAM 703 described above, and / or one or more memories other than ROM 702 and RAM 703.

[0135] Embodiments of the present invention also include a computer program product comprising a computer program containing program code for executing the method shown in the flowchart. When the computer program product is executed in a computer system, the program code is used to cause the computer system to implement the test case generation method for a database and the database testing method provided by the embodiments of the present invention.

[0136] The computer program executes the above functions defined in the system / device of the embodiment of the present invention when the computer program is executed by the processor 701. According to the embodiment of the present invention, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0137] In one embodiment, the computer program may be stored on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may be transmitted and distributed in the form of a signal on a network medium, downloaded and installed via the communication portion 709, and / or installed from a removable medium 711. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0138] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 709 and / or installed from the removable medium 711. When the computer program is executed by the processor 701, the above-described functions defined in the system of the embodiment of the present invention are performed. According to the embodiment of the present invention, the systems, devices, means, modules, units, etc. described above can be implemented by computer program modules.

[0139] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages. Specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect via the Internet).

[0140] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0141] It will be understood by those skilled in the art that the features described in the various embodiments of the present invention may be combined and / or coupled in various ways, even if such combinations or couplings are not explicitly described in the present invention. In particular, the features described in the various embodiments of the present invention may be combined and / or coupled in various ways without departing from the spirit and teachings of the present invention. All such combinations and / or couplings fall within the scope of the present invention.

[0142] The above describes embodiments of the present invention. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present invention. Although each embodiment has been described separately above, this does not mean that the measures in each embodiment cannot be advantageously used in combination. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.

Claims

1. A test case generation method for a database, characterized in that: The method comprises: Matching the description documents corresponding to the database according to the key fields to obtain function attribute information of each of the plurality of functions, wherein the function attribute information includes at least one parameter and at least one use case sample corresponding to the function; Constructing attribute mappings for each of the multiple functions according to the function attribute information of each of the multiple functions, wherein the attribute mappings include a correspondence between each of the parameters and the parameter attribute information of each of the multiple parameter attribute items; A plurality of test cases for each function is generated based on the parameter attribute information for each of the plurality of parameter attribute items and the use case samples corresponding to the function.

2. The method according to claim 1, characterized in that The step of generating multiple test cases for each function based on the parameter attribute information for each of the multiple parameter attribute items and the use case samples corresponding to the function includes: Determining candidate parameter values for the parameters according to the parameter attribute information of each of the plurality of parameter attribute items; Determining a plurality of groups of parameter value combinations for testing based on the plurality of parameters and the candidate parameter values of the plurality of parameters; Based on the multiple groups of parameter value combinations and the use case samples, multiple test cases for each of the functions are generated.

3. The method according to claim 2, characterized in that The step of determining a plurality of groups of parameter value combinations for testing based on the plurality of parameters and the candidate parameter values of the plurality of parameters includes: Determining a target orthogonal table from a plurality of preset candidate orthogonal tables according to the number of the plurality of parameters and the number of candidate parameter values of the plurality of parameters; The target orthogonal table is filled according to the candidate parameter values of the multiple parameters to obtain the multiple groups of parameter value combinations.

4. The method according to claim 2, characterized in that The parameter attribute items include: a mandatory attribute item and a constraint attribute item, wherein the first attribute information corresponding to the mandatory attribute item indicates whether the parameter is mandatory, and the second attribute information corresponding to the constraint attribute item is determined based on at least one of the type, format, and dependency relationship of the parameter; The determining, based on the parameter attribute information of each of the plurality of parameter attribute items, a candidate parameter value of the parameter includes: In a case where the first attribute information indicates that the parameter is mandatory, determining a plurality of first candidate parameter values that satisfy the second attribute information, a second candidate parameter value that does not satisfy the second attribute information, and a third candidate parameter value that indicates a null value; In a case where the first attribute information indicates that the parameter is optional, a fourth candidate parameter value that satisfies the second attribute information and a third candidate parameter value that indicates a null value are determined.

5. The method according to claim 4, characterized in that The parameter attribute item includes: a dependency attribute item, wherein third attribute information corresponding to the dependency attribute item is used to characterize whether the parameter has a dependency relationship across parameter levels, and a dependent parameter if the parameter has a dependency relationship across parameter levels, wherein the dependency relationship across parameter levels is determined based on sub-information characterizing a grammatical definition of the function included in the function attribute information; The method further comprises: In a case where the third attribute information represents that the parameters have a dependency relationship, determining an objective function that does not satisfy the second attribute information of the parameters, wherein the objective function includes dependent parameters of the parameters and the objective function is nested in a function of the parameters; According to the parameter attribute information of each of the multiple parameter attribute items of the sub-parameters of the objective function, multiple candidate sub-parameter values that meet the second attribute information of the sub-parameters are determined.

6. The method according to claim 4, characterized in that The determining of a plurality of first candidate parameter values that satisfy the second attribute information includes: determining the type of the parameter according to the second attribute information; In the case that the type of the parameter indicates that the parameter has a boundary value, the boundary value and the intermediate value of the parameter are respectively used as the first candidate parameter value.

7. The method according to claim 1, characterized in that The method further comprises: Obtaining execution paths of each of the multiple test cases, where the execution paths represent the execution order of codes in the database triggered during the execution of the test cases; The multiple test cases are optimized according to their respective execution paths to merge test cases with the same execution path.

8. A database testing method, characterized in that: The method comprises: testing the first database and the second database respectively according to a plurality of test cases corresponding to the first database, to obtain a first test result corresponding to the first database and a second test result corresponding to the second database, wherein the plurality of test cases are generated by the method according to any one of claims 1 to 7; By comparing the first test result and the second test result, a test result for the first database is obtained.

9. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7 or claim 8.

10. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 or claim 8 are implemented.

Citation Information

Patent Citations

  • Method for automatically generating test case based on genetic algorithm

    CN106445821A

  • Database testing method and device, equipment and storage medium

    CN109726136A

  • Test case generation method, system and device based on full-link marking and medium

    CN112559363A

  • Test case generation method and device and test case display method and device

    CN114328276A

  • Database iteration test method and device, equipment and storage medium

    CN114647576A