Database interface testing method, device, equipment and storage medium

By using a common interface to identify and call operation type interfaces in the database interface test method, the problem of needing to rewrite test cases when testing different databases is solved, and the testing efficiency and effectiveness are improved.

CN114385483BActive Publication Date: 2024-10-29HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111480491.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-06
Publication Date
2024-10-29
Estimated Expiration
2041-12-06

AI Technical Summary

Technical Problem

In the existing technology, test cases need to be rewritten when testing different databases, resulting in increased duplication of work and low testing efficiency.

Method used

Provides a database interface testing method, which runs the test case instance of the database to be tested, calls the general interface of the database to be tested using the target parameters, obtains the test data through the general interface identification and calls the operation type interface, and realizes the same test case instance pairing Testing on different databases.

Benefits of technology

There is no need to rewrite test cases to test different databases, which improves testing efficiency and shortens the database object function verification cycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114385483B_ABST
    Figure CN114385483B_ABST
Patent Text Reader

Abstract

The present application relates to a database interface testing method, device, equipment and storage medium, and relates to the field of database testing. The database interface testing method comprises: running a test case instance of a database to be tested; during the running process, using target parameters to call the general interface of the database to be tested; identifying the operation type interface corresponding to the target parameter through the general interface, and calling the operation type interface to obtain test data and return it; testing the test data through the test case instance. The present application is used to solve the problem of needing to rewrite test cases when testing different databases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of database testing, and in particular to a database interface testing method, device, equipment and storage medium. Background Art

[0002] In order to meet the growing performance needs of customers, the blockchain platform continues to break through performance bottlenecks, including continuous optimization and transformation of storage modules, and design of a variety of KV (Key-Value, key-value pair storage data) databases that rely on underlying storage. Each KV database provides a complete set of database interfaces for external service calls, and the database can be tested separately to compare performance optimization effects, which brings a lot of repeated testing work.

[0003] Generally speaking, when it comes to database testing, there are many open source performance benchmarking tools such as sysbench and unit testing tools such as DBUnit in the industry. However, there are no ready-made open source testing tools for database integration testing or interface testing.

[0004] The completeness test of database functions is generally conducted by covering the interfaces provided by the database, designing the value range of the corresponding interface parameters, and splicing multiple interfaces for interface scenario testing. If the test object changes to a new database, the test scripts of this part of the database cannot be reused. Generally, the test scenario will be redesigned to verify the functional completeness of another database. This part of the work brings a lot of repeated testing work. Summary of the invention

[0005] The present application provides a database interface testing method, apparatus, device and storage medium to solve the problem of needing to rewrite test cases when testing different databases.

[0006] In a first aspect, an embodiment of the present application provides a database interface testing method, comprising:

[0007] Run the test case instance of the database to be tested;

[0008] During the operation, the universal interface of the database to be tested is called using target parameters;

[0009] Identify the operation type interface corresponding to the target parameter through the general interface, and call the operation type interface to obtain test data and return it;

[0010] The test data is tested through the test case instance.

[0011] Optionally, before identifying the operation type interface corresponding to the target parameter through the universal interface, the method further includes:

[0012] The operation type interface is encapsulated according to the format of the general interface.

[0013] Optionally, after testing the test data through the test case instance, the method further includes:

[0014] Get test results;

[0015] A test report is generated according to the test results.

[0016] Optionally, the operation type interface includes a query and modify type interface;

[0017] During the operation, the universal interface of the database to be tested is called using target parameters, including:

[0018] During the operation, the query interface and the modification interface of the database to be tested are called using the target parameters;

[0019] The step of identifying the operation type interface corresponding to the target parameter through the general interface includes:

[0020] The query and modification type interface corresponding to the target parameter is identified through the query interface and the modification interface.

[0021] Optionally, the operation type interface includes a query and delete type interface;

[0022] During the operation, the universal interface of the database to be tested is called using target parameters, including:

[0023] During the operation, the query interface and the deletion interface of the database to be tested are called using the target parameters;

[0024] The step of identifying the operation type interface corresponding to the target parameter through the general interface includes:

[0025] The query and delete type interface corresponding to the target parameter is identified through the query interface and the delete interface.

[0026] Optionally, during the running process, before calling the universal interface of the database to be tested with the target parameter, the method further includes:

[0027] The general interface is configured, wherein the general interface includes at least one of adding an interface, deleting an interface, modifying an interface, and querying an interface.

[0028] Optionally, before running the test case instance of the database to be tested, the method further includes:

[0029] The test case instance is obtained from a general test case set, wherein the general test case set includes at least one of a test case for general database operations, a test case for scenario-based database operations, and a test case for a specified database.

[0030] In a second aspect, an embodiment of the present application provides a database interface testing device, including:

[0031] The running module is used to run the test case instance of the database to be tested;

[0032] A calling module, used to call the general interface of the database to be tested using target parameters during operation;

[0033] An identification module, used to identify the operation type interface corresponding to the target parameter through the general interface, and call the operation type interface to obtain test data and return it;

[0034] A processing module is used to test the test data through the test case instance.

[0035] Optionally, the database interface testing device further includes a packaging module;

[0036] The encapsulation module is used to encapsulate the operation type interface according to the format of the general interface.

[0037] Optionally, the database interface testing device further includes a first acquisition module and a generation module;

[0038] The first acquisition module is used to obtain the test result;

[0039] The generating module is used to generate a test report according to the test result.

[0040] Optionally, the operation type interface includes a query and modify type interface;

[0041] The calling module is specifically used to call the query interface and modification interface of the database to be tested using target parameters during the running process;

[0042] The identification module is specifically used to identify the query and modification type interface corresponding to the target parameter through the query interface and the modification interface, and call the query and modification type interface to obtain test data and return it.

[0043] Optionally, the operation type interface includes a query and delete type interface;

[0044] The calling module is specifically used to call the query interface and the deletion interface of the database to be tested using the target parameters during the running process;

[0045] The identification module is specifically used to identify the query and delete type interface corresponding to the target parameter through the query interface and the delete interface, and call the query and delete type interface to obtain test data and return it.

[0046] Optionally, the database interface testing device further includes a configuration module;

[0047] The configuration module is used to configure the general interface, wherein the general interface includes at least one of adding an interface, deleting an interface, modifying an interface, and querying an interface.

[0048] Optionally, the database interface testing device further includes a second acquisition module;

[0049] The second acquisition module is used to acquire the test case instance from a general test case set, wherein the general test case set includes at least one of a test case for general database operations, a test case for scenario-based database operations, and a test case for a specified database.

[0050] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a communication bus, wherein the processor and the memory communicate with each other via the communication bus;

[0051] The memory is used to store computer programs;

[0052] The processor is used to execute the program stored in the memory to implement the database interface testing method described in the first aspect.

[0053] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the database interface testing method described in the first aspect.

[0054] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application runs a test case instance of the database to be tested, and during the running process, uses target parameters to call the general interface of the database to be tested, identifies the operation type interface corresponding to the target parameter through the general interface, and calls the operation type interface to obtain test data and return it, and tests the test data through the test case instance.

[0055] Compared with the prior art, when testing different databases, it is necessary to rewrite the test cases. In this application, it is not necessary to rewrite the test cases. By calling the general interface of the database to be tested during the process of running the test case instance of the database to be tested, and performing subsequent operations through the general interface, the test case instance only needs to be written according to the general interface, which is applicable to different databases, and can implement the same test case instance to test different databases. The general interfaces of different databases are the same, and the operation type interfaces of different databases are different. The specific operations of different databases are to identify the operation type interface corresponding to the target parameter through the general interface, and to call the operation type interface to obtain test data and return it, so as to call the operation type interface through the general interface, and then implement the test case instance to test the specific database to be tested. It is realized that the same test case instance tests different databases to verify the functional completeness of the database, without the need to write a large number of test cases, which greatly improves the test efficiency and shortens the database object function verification cycle. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0058] Figure 1 This is a schematic diagram of the architecture of the database interface testing system in the embodiment of the present application;

[0059] Figure 2 This is a schematic diagram of the method flow of database interface testing in an embodiment of the present application;

[0060] Figure 3 This is a flowchart of a method for database interface testing in a specific embodiment of the present application;

[0061] Figure 4 This is a flowchart of a method for database interface testing in a specific embodiment of the present application;

[0062] Figure 5 This is a schematic diagram of the structure of the database interface testing device in the embodiment of the present application;

[0063] Figure 6 Schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0065] In an embodiment of the present application, a database interface testing method is provided, which is applied to a database interface testing system.

[0066] In the present application embodiment, Figure 1 As shown, the database interface testing system includes a use case set, an execution layer and an adaptation layer.

[0067] Test case set: mainly composed of test cases, each test case consists of parameter configuration and test script. Parameter configuration can directly specify the number of concurrent threads and thread loops for the test case. Parameter configuration can be set as needed.

[0068] Execution layer: mainly performs test case execution. The execution layer can set the random concurrent execution mode of test cases to simulate random read and write operations on the database in the test scenario. The test report interpretation module is responsible for collecting test results and submitting them to the visualization tool for test result reporting. The test case execution module will execute pre-defined test cases. The interface implementation part will convert the database operations of general operations into operations of a specific database, and finally feed back the test results to the test report collection module. The report will finally display the test results in a visual way.

[0069] Adaptation layer: includes common, utils and dbs. common provides some basic common operations and encapsulation of some small tool operations. utils encapsulates some common operations on common databases. dbs connects to the database objects to be tested and encapsulation of these database interfaces.

[0070] In the present application embodiment, Figure 2 As shown in the figure, the method flow of database interface testing mainly includes:

[0071] Step 201: Run the test case instance of the database to be tested.

[0072] In a specific embodiment, before running the test case instance of the database to be tested, the database interface testing method also includes: obtaining a test case instance from a general test case set, wherein the general test case set includes at least one of test cases for general database operations, test cases for scenario-based database operations, and test cases for specified databases.

[0073] Test cases for common database operations refer to test cases for common database operations such as adding, deleting, modifying, and querying. Test cases for scenario-based database operations refer to test cases for scenario-based database operations such as random concurrent execution mode. Test cases for specified databases refer to test cases that only work for specified databases, and decorators such as pytest.mark.skip or other methods are required to filter out unmatched databases. The set of common test cases is defined in advance.

[0074] There is no need to rewrite the test case instance each time when testing different databases. You only need to obtain the test case instance suitable for the database to be tested from the pre-defined general test case set.

[0075] Step 202: During the running process, the general interface of the database to be tested is called using target parameters.

[0076] The target parameter can be the type of the general interface that needs to be called, for example, the target parameter is the query interface and the modification interface. The target parameter can also be the operation type corresponding to the operation type interface of the database to be tested, for example, the target parameter is the query and modification type. The target parameter can also be an expression described by the operation type interface according to the format of the general interface. For example, the target parameter is operation type interface A = k1*general interface a+k2*general interface b, which is an expression describing the operation type interface A according to the format of general interface a and general interface b, and k1 and k2 are constants.

[0077] The type of the general interface to be called can be determined according to the target parameter. The target parameter can also be other parameters as needed, and the present application does not limit the specific content of the target parameter.

[0078] In a specific embodiment, during the running process, before calling the universal interface of the database to be tested with target parameters, the database interface testing method also includes: configuring the universal interface, wherein the universal interface includes at least one of adding interface, deleting interface, modifying interface and querying interface.

[0079] Adding an interface, deleting an interface, modifying an interface, and querying an interface are common database operations that are used frequently.

[0080] The general interface may include general database operations, such as Insert, Delete, Update, Select, Write, Read, Reset, Roolback, Close, New, etc. The general interface may also include general operations of the iterators provided by the database, such as NewIterator, Seek, First, Last, Next, Prev, Key, Value, Release, etc.

[0081] Common interface is applicable to different databases.

[0082] Step 203: Identify the operation type interface corresponding to the target parameter through the general interface, and call the operation type interface to obtain test data and return it.

[0083] The target parameter can be the type of the general interface that needs to be called, for example, the target parameter is the query interface and the modification interface. The target parameter can also be the operation type corresponding to the operation type interface of the database to be tested, for example, the target parameter is the query and modification type. The target parameter can also be an expression described by the operation type interface according to the format of the general interface. For example, the target parameter is operation type interface A = k1*general interface a+k2*general interface b, which is an expression describing the operation type interface A according to the format of general interface a and general interface b, and k1 and k2 are constants.

[0084] The type of operation type interface to be called can be determined according to the target parameter. The target parameter can also be other parameters as needed, and the present application does not limit the specific content of the target parameter.

[0085] The test data may be acquired by calling the operation type interface through the general interface, and the test data may be acquired from the database to be tested by calling the operation type interface through the general interface.

[0086] In a specific embodiment, before identifying the operation type interface corresponding to the target parameter through the general interface, the database interface testing method further includes: encapsulating the operation type interface according to the format of the general interface.

[0087] According to the format of the general interface, the operation type interface is encapsulated. For example, operation type interface A = k1*general interface a + k2*general interface b. Operation type interface A is encapsulated according to the format of general interface a and general interface b. k1 and k2 are constants. Database attributes will be directly written into the interface for creating the database.

[0088] In a specific embodiment, the operation type interface includes a query and modify type interface. During the operation, the general interface of the database to be tested is called using the target parameter, including: during the operation, the query interface and the modify interface of the database to be tested are called using the target parameter. Through the general interface, the operation type interface corresponding to the target parameter is identified, including: through the query interface and the modify interface, the query and modify type interface corresponding to the target parameter is identified.

[0089] When the operation type interface includes a query and modify type interface, the common interfaces that need to be called are the query interface and the modify interface. Through the query interface and the modify interface, the query and modify type interface corresponding to the target parameter is identified, and the query and modify type interface is called to obtain test data and return it.

[0090] In a specific embodiment, the operation type interface includes a query and delete type interface. During the operation, the general interface of the database to be tested is called using the target parameter, including: during the operation, the query interface and the delete interface of the database to be tested are called using the target parameter. Through the general interface, the operation type interface corresponding to the target parameter is identified, including: through the query interface and the delete interface, the query and delete type interface corresponding to the target parameter is identified.

[0091] When the operation type interface includes the query and delete type interface, the common interfaces that need to be called are the query interface and the delete interface. Through the query interface and the delete interface, the query and delete type interface corresponding to the target parameter is identified, and the query and delete type interface is called to obtain the test data and return it.

[0092] As required, the operation type interface may further include other interfaces, which can be used to call the general interface corresponding to the operation type interface, and to call the operation type interface through the general interface to obtain test data and return it.

[0093] Step 204: Test the test data through the test case instance.

[0094] In a specific embodiment, after testing the test data through the test case instance, the database interface testing method further includes: obtaining the test result; and generating a test report according to the test result.

[0095] The test report is displayed through a visualization tool.

[0096] In a specific embodiment, Figure 3 As shown in the figure, the method flow of database interface testing mainly includes:

[0097] Step 301, obtaining a test case instance from a general test case set.

[0098] Step 302: Run the test case instance of the database to be tested.

[0099] Step 303: During the running process, the general interface of the database to be tested is called using the target parameters.

[0100] Step 304: Identify the operation type interface corresponding to the target parameter through the general interface, and call the operation type interface to obtain test data and return it.

[0101] Step 305: Test the test data through the test case instance.

[0102] Step 306, obtaining test results.

[0103] Step 307: Generate a test report based on the test results.

[0104] In a specific embodiment, Figure 4 As shown in the figure, the method flow of database interface testing mainly includes:

[0105] Step 401 , encapsulate the interface of the database db1 to be tested according to the format of the general interface of the test framework, and define the database properties of db1 in the configuration file of db1 , so that the properties defined in advance take effect when starting db1 .

[0106] Step 402: Generate a test case instance of db1 in the test framework according to the defined general test case template.

[0107] Step 403: execute the test case instance and obtain a test report.

[0108] In summary, the method provided in the embodiment of the present application runs a test case instance of the database to be tested. During the running process, the general interface of the database to be tested is called using the target parameters. Through the general interface, the operation type interface corresponding to the target parameters is identified, and the operation type interface is called to obtain test data and return it, and the test data is tested through the test case instance.

[0109] Compared with the prior art, when testing different databases, it is necessary to rewrite the test cases. In this application, it is not necessary to rewrite the test cases. By calling the general interface of the database to be tested during the process of running the test case instance of the database to be tested, and performing subsequent operations through the general interface, the test case instance only needs to be written according to the general interface, which is applicable to different databases, and can implement the same test case instance to test different databases. The general interfaces of different databases are the same, and the operation type interfaces of different databases are different. The specific operations of different databases are to identify the operation type interface corresponding to the target parameter through the general interface, and to call the operation type interface to obtain test data and return it, so as to call the operation type interface through the general interface, and then implement the test case instance to test the specific database to be tested. It is realized that the same test case instance tests different databases to verify the functional completeness of the database, without the need to write a large number of test cases, which greatly improves the test efficiency and shortens the database object function verification cycle.

[0110] Based on the same concept, a database interface testing device is provided in the embodiment of the present application. The specific implementation of the device can be found in the description of the method embodiment part, and the repeated parts will not be repeated. Figure 5 As shown, the device mainly includes:

[0111] Running module 501, used to run the test case instance of the database to be tested;

[0112] A calling module 502 is used to call the general interface of the database to be tested using target parameters during the running process;

[0113] An identification module 503 is used to identify the operation type interface corresponding to the target parameter through the general interface, and call the operation type interface to obtain test data and return it;

[0114] The processing module 504 is used to test the test data through the test case instance.

[0115] Optionally, the database interface testing device further includes a packaging module;

[0116] The encapsulation module is used to encapsulate the operation type interface according to the format of the general interface.

[0117] Optionally, the database interface testing device further includes a first acquisition module and a generation module;

[0118] The first acquisition module is used to obtain the test result;

[0119] The generating module is used to generate a test report according to the test result.

[0120] Optionally, the operation type interface includes a query and modify type interface;

[0121] The calling module is specifically used to call the query interface and modification interface of the database to be tested using target parameters during the running process;

[0122] The identification module is specifically used to identify the query and modification type interface corresponding to the target parameter through the query interface and the modification interface, and call the query and modification type interface to obtain test data and return it.

[0123] Optionally, the operation type interface includes a query and delete type interface;

[0124] The calling module is specifically used to call the query interface and the deletion interface of the database to be tested using the target parameters during the running process;

[0125] The identification module is specifically used to identify the query and delete type interface corresponding to the target parameter through the query interface and the delete interface, and call the query and delete type interface to obtain test data and return it.

[0126] Optionally, the database interface testing device further includes a configuration module;

[0127] The configuration module is used to configure the general interface, wherein the general interface includes at least one of adding an interface, deleting an interface, modifying an interface, and querying an interface.

[0128] Optionally, the database interface testing device further includes a second acquisition module;

[0129] The second acquisition module is used to acquire the test case instance from a general test case set, wherein the general test case set includes at least one of a test case for general database operations, a test case for scenario-based database operations, and a test case for a specified database.

[0130] Based on the same concept, an electronic device is also provided in the embodiment of the present application, such as Figure 6 As shown, the electronic device mainly includes: a processor 601, a memory 602 and a communication bus 603, wherein the processor 601 and the memory 602 communicate with each other through the communication bus 603. The memory 602 stores a program executable by the processor 601, and the processor 601 executes the program stored in the memory 602 to implement the following steps:

[0131] Run the test case instance of the database to be tested; during the running process, use the target parameters to call the general interface of the database to be tested; identify the operation type interface corresponding to the target parameters through the general interface, and call the operation type interface to obtain test data and return it; test the test data through the test case instance.

[0132] The communication bus 603 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 603 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0133] The memory 602 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the processor 601.

[0134] The above-mentioned processor 601 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0135] In another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program runs on a computer, the computer executes the database interface testing method described in the above embodiment.

[0136] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction is transmitted from a website site, a computer, a server or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk), etc.

[0137] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0138] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A database interface testing method, characterized in that: include: Running a test case instance of the database to be tested, wherein the test case instance is obtained from a general test case set; During the operation, the universal interface of the database to be tested is called using target parameters; Identify the operation type interface corresponding to the target parameter through the general interface, and call the operation type interface to obtain test data and return it; Testing the test data through the test case instance; The target parameter is the type of the general interface to be called, or the target parameter is the operation type corresponding to the operation type interface of the database to be tested, or the target parameter is an expression described by the operation type interface according to the format of the general interface; The general interface includes at least an add interface, a delete interface, a modify interface and a query interface, and the general interface is applicable to different databases; The method further includes: encapsulating an operation type interface according to a format of a general interface, wherein the operation type interface = a first general interface + a second general interface.

2. The database interface testing method according to claim 1, characterized in that: After testing the test data through the test case instance, the method further includes: Get test results; A test report is generated according to the test results.

3. The database interface testing method according to claim 1, characterized in that: The operation type interface includes a query and modify type interface; During the operation, the universal interface of the database to be tested is called using target parameters, including: During the operation, the query interface and the modification interface of the database to be tested are called using the target parameters; The step of identifying the operation type interface corresponding to the target parameter through the general interface includes: The query and modification type interface corresponding to the target parameter is identified through the query interface and the modification interface.

4. The database interface testing method according to claim 1, characterized in that: The operation type interface includes a query and delete type interface; During the operation, the universal interface of the database to be tested is called using target parameters, including: During the operation, the query interface and the deletion interface of the database to be tested are called using the target parameters; The step of identifying the operation type interface corresponding to the target parameter through the general interface includes: The query and delete type interface corresponding to the target parameter is identified through the query interface and the delete interface.

5. The database interface testing method according to claim 1, characterized in that: The general test case set includes at least one of a test case for general database operations, a test case for scenario-based database operations, and a test case for a specified database.

6. A database interface testing device, characterized in that: include: A running module, used to run a test case instance of the database to be tested, wherein the test case instance is obtained from a general test case set; A calling module, used to call the general interface of the database to be tested using target parameters during operation; An identification module, used to identify the operation type interface corresponding to the target parameter through the general interface, and call the operation type interface to obtain test data and return it; A processing module, used for testing the test data through the test case instance; The target parameter is the type of the general interface to be called, or the target parameter is the operation type corresponding to the operation type interface of the database to be tested, or the target parameter is an expression described by the operation type interface according to the format of the general interface; The general interface includes at least an add interface, a delete interface, a modify interface and a query interface, and the general interface is applicable to different databases; The device further comprises: encapsulating an operation type interface according to a format of a general interface, wherein the operation type interface = a first general interface + a second general interface.

7. An electronic device, characterized in that: include: A processor, a memory and a communication bus, wherein the processor and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to execute the program stored in the memory to implement the database interface testing method according to any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the database interface testing method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Database testing method and system capable of avoiding database type interference

    CN110058995A

  • Hybrid App testing method and device

    CN113094281A