CN110764997B - Database interface conformance testing method and device - Google Patents

Database interface conformance testing method and device Download PDF

Info

Publication number
CN110764997B
CN110764997B CN201910840662.2A CN201910840662A CN110764997B CN 110764997 B CN110764997 B CN 110764997B CN 201910840662 A CN201910840662 A CN 201910840662A CN 110764997 B CN110764997 B CN 110764997B
Authority
CN
China
Prior art keywords
interface
test
database
target database
task
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910840662.2A
Other languages
Chinese (zh)
Other versions
CN110764997A (en
Inventor
梁俊杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Wind Gather Intelligence Technology Co ltd
Original Assignee
Wuhan Wind Gather Intelligence Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Wind Gather Intelligence Technology Co ltd filed Critical Wuhan Wind Gather Intelligence Technology Co ltd
Priority to CN201910840662.2A priority Critical patent/CN110764997B/en
Publication of CN110764997A publication Critical patent/CN110764997A/en
Application granted granted Critical
Publication of CN110764997B publication Critical patent/CN110764997B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing

Abstract

The application provides a method and a device for testing the conformance of a database interface, which are used for simplifying the interface test of a database and reducing the hardware cost and the time cost required by the test. The method comprises the following steps: the testing equipment triggers an interface testing task with a task object as a target database, and the interface testing task is used for testing whether an interface of the target database meets a preset interface requirement; the test equipment acquires an interface drive packet of a target database, wherein the interface drive packet comprises an interface program of the target database; the test equipment loads an interface drive package and runs an interface program in the running environment of a target database specified by the interface test task; the test equipment detects whether the interface program meets the interface requirement; the test equipment outputs an interface test result of the target database based on a detection result of whether the interface program meets the interface requirement.

Description

Database interface conformance testing method and device
Technical Field
The present application relates to the field of testing, and in particular, to a method and an apparatus for testing database interface conformance.
Background
And the database performance testing tool is used for performing performance testing on the database and quantifying the performance of the database through a series of index parameters.
In the database performance test, the normal working state of the database is restored by operating the database, and the response result of the database to the database performance test is collected to form the performance test result of the database.
However, in the existing database performance testing tool, no matter what performance of the database is tested, the whole database needs to be run, and the workload involved in copying, installing, starting and running the files of the whole database obviously requires a small hardware cost and a small time cost for the testing tool.
Disclosure of Invention
The application provides a method and a device for testing the conformance of a database interface, which are used for simplifying the interface test of a database and reducing the hardware cost and the time cost required by the test.
In a first aspect, the present application provides a method for testing database interface compliance, the method including:
the testing equipment triggers an interface testing task with a task object as a target database, and the interface testing task is used for testing whether an interface of the target database meets a preset interface requirement;
the test equipment acquires an interface drive packet of a target database, wherein the interface drive packet comprises an interface program of the target database;
the test equipment loads an interface drive package and runs an interface program in the running environment of a target database specified by the interface test task;
the test equipment detects whether the interface program meets the interface requirement;
the test equipment outputs an interface test result of the target database based on a detection result of whether the interface program meets the interface requirement.
Optionally, the obtaining, by the testing device, the interface driver package of the target database includes:
the test equipment receives an interface drive packet uploaded or imported by a user; alternatively, the first and second electrodes may be,
the test equipment reads the database identification of the target database from the task information of the interface test task;
the test equipment obtains the interface drive package corresponding to the database identification from the test platform through the obtaining request, and the test platform is used for storing the corresponding relations among different interface drive packages, different interface drive packages and different database identifications uploaded by different users.
Optionally, the running environment is a JDK compilation environment, and the method further includes:
the test equipment configures connection information and JDK version information corresponding to the target database according to the task information of the interface test task;
and the test equipment configures the JDK compiling environment according to the connection information and the IDK version information.
Optionally, the interface driver package is a DataBase connection (JDBC) driver package, and the loading the interface driver package and running the interface program by the testing device in the running environment of the target DataBase specified by the interface test task includes:
the method comprises the steps that test equipment loads a JDBC driver package in a JDK compiling environment;
the test equipment searches an interface drive file of the JDBC drive packet according to a preset path;
the test equipment traverses the interface driving file and determines an interface function corresponding to the test task;
in JDK compiling environment, the test equipment dynamically loads the class of the interface function through a reflection mechanism to instantiate different interface objects.
Optionally, the detecting, by the testing device, whether the interface program meets the interface requirement includes:
the test equipment detects whether the execution process of the interface function is abnormal or not; alternatively, the first and second electrodes may be,
detecting whether the output result of the interface function is not null or not by the detection equipment; alternatively, the first and second electrodes may be,
detecting whether the data type of the output result of the interface function is correct or not by the detection equipment; alternatively, the first and second electrodes may be,
the detection device detects whether the content of the output result of the interface function is correct.
In a second aspect, the present application provides a database interface conformance testing device, comprising:
the triggering unit is used for triggering an interface test task with a task object as a target database, and the interface test task is used for testing whether an interface of the target database meets a preset interface requirement;
the system comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for acquiring an interface driving package of a target database, and the interface driving package comprises an interface program of the target database;
the loading unit is used for loading the interface driving package and running the interface program in the running environment of the target database specified by the interface testing task;
the detection unit is used for detecting whether the interface program meets the interface requirement;
and the output unit is used for outputting the interface test result of the target database based on the detection result of whether the interface program meets the interface requirement.
Optionally, the obtaining unit is specifically configured to:
receiving an interface driving package uploaded or imported by a user; alternatively, the first and second electrodes may be,
reading a database identifier of a target database from task information of an interface test task;
and acquiring an interface driving package corresponding to the database identifier from a test platform through the acquisition request, wherein the test platform is used for storing different interface driving packages uploaded by different users, different interface driving packages and corresponding relations among different database identifiers.
Optionally, the running environment is a JDK compilation environment, and the apparatus further includes a configuration unit, configured to:
configuring connection information and JDK version information corresponding to a target database according to task information of an interface test task;
and configuring the JDK compiling environment according to the connection information and the IDK version information.
Optionally, the interface driver package is a JDBC driver package, and the loading unit is specifically configured to:
loading a JDBC driver package in a JDK compiling environment;
searching an interface drive file of the JDBC drive packet according to a preset path;
traversing the interface driving file, and determining an interface function corresponding to the test task;
in the JDK compilation environment, the class of the interface function is dynamically loaded through a reflection mechanism to instantiate different interface objects.
Optionally, the detection unit is specifically configured to:
detecting whether the execution process of the interface function is abnormal or not; alternatively, the first and second electrodes may be,
detecting whether an output result of the interface function is not null; alternatively, the first and second electrodes may be,
detecting whether the data type of the output result of the interface function is correct or not; alternatively, the first and second electrodes may be,
and detecting whether the content of the output result of the interface function is correct.
In a third aspect, the present application provides a database interface conformance testing device comprising a processor for implementing any of the steps of the first aspect described above when executing a computer program stored in a memory.
In a fourth aspect, the present application provides a readable storage medium having stored thereon a computer program which, when executed by a processor, performs any of the steps of the first aspect as described above.
According to the technical scheme, the method has the following advantages:
different from the prior art that the whole target database needs to be operated, the method for testing the database interface provided by the application only needs to acquire the interface driving packet of the target database according to the triggering of the interface testing task, and operates the interface program in the interface driving packet alone to perform the interface testing, so that the interface testing of the database is simplified, the hardware cost and the time cost required for operating the whole target database can be effectively reduced, and particularly, when the interface performance of the target database under different operating environments needs to be tested, the processing of packaging application and restarting the target database can be greatly reduced, so that the interface testing of the database can be conveniently completed.
Drawings
FIG. 1 is a schematic flow chart of a database interface conformance testing method provided in the present application;
FIG. 2 is a schematic flow chart illustrating a database interface compliance testing method provided in the present application;
FIG. 3 is a schematic flow chart illustrating a database interface compliance testing method provided herein;
FIG. 4 is a schematic flow chart illustrating a database interface compliance testing method provided herein;
FIG. 5 is a schematic structural diagram of a database interface compliance testing device according to the present application;
fig. 6 is a schematic structural diagram of a database interface conformance testing apparatus according to the present application.
Detailed Description
The application provides a method and a device for testing the conformance of a database interface, which are used for simplifying the interface test of a database and reducing the hardware cost and the time cost required by the test.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," and the like in the description and in the claims of the present application and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Moreover, the terms "comprises," "comprising," and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not expressly listed or inherent to such process, method, article, or apparatus. The naming or numbering of the steps appearing in the present application does not mean that the steps in the method flow have to be executed in the chronological/logical order indicated by the naming or numbering, and the named or numbered process steps may be executed in a modified order depending on the technical purpose to be achieved, as long as the same or similar technical effects are achieved.
The division of the modules presented in this application is a logical division, and in practical applications, there may be another division, for example, multiple modules may be combined or integrated into another system, or some features may be omitted, or not executed, and in addition, the shown or discussed coupling or direct coupling or communication connection between each other may be through some interfaces, and the indirect coupling or communication connection between the modules may be in an electrical or other similar form, which is not limited in this application. The modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed in a plurality of circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present disclosure.
First, before the present application is described, a test apparatus related to the present application is described.
In the application, the test equipment is hardware equipment with data processing capacity, such as server equipment or host equipment, and is used for deploying a test tool of a database interface, and the test tool is used for operating the database interface conformance test method provided by the application, so that in the test of the database interface, an interface drive packet of the database is directly acquired without operating the whole database, and the interface performance of the database is tested based on the interface drive packet, thereby simplifying the interface test of the database, and reducing the hardware cost and time cost required by the test.
The database referred in the present application may be specifically an Oracle database, a MySQL database, a dreams database, a treasury database, or other types of databases, and is not limited herein.
Next, the details of the present application will be described based on the above background.
Example one
Referring to fig. 1, fig. 1 shows a schematic flow chart of the method for testing the compliance of the database interface of the present application, and specifically, the method for testing the compliance of the database interface of the present application may specifically include the following steps:
step S101, a test device triggers an interface test task with a task object as a target database;
the interface testing task is used for testing whether an interface of the target database meets a preset interface requirement.
When the interface performance test requirement of the database is met, a User can send an interface test request of a target database to test Equipment through User Equipment (UE) and trigger a task object to be an interface test task of the target database;
or, the user can manually trigger the interface test task with the task object as the target database locally on the test equipment.
The UE may be a smart watch, a smart bracelet, a smart phone, a tablet computer, a laptop computer, a desktop computer, an all-in-one computer, a Personal Digital Assistant (PDA), and other terminal devices, and has an interaction capability.
The interface test task can identify a target database of the task object through a carried database identifier, and the database identifier specifically can include information such as the address of the database, the database version number and the like.
Step S102, the test equipment obtains an interface driving packet of a target database;
wherein the interface driver package includes an interface program of the target database.
In the application, after the interface test task with the task object as the target database is triggered, the test equipment only needs to acquire the interface driver package of the target database for interface test, which is different from the prior art that the data file of the whole target database is acquired to normally operate the target database.
The interface driver package may include an interface program of the target database in a specific operation environment, or may also include an interface program of the target database in a different operation environment.
Step S103, the test equipment loads an interface drive package and runs an interface program in the running environment of a target database specified by the interface test task;
it can be understood that, after the interface package of the target database is obtained, the testing device may configure an operating environment for the interface program corresponding to the interface package, and in the operating environment, separately operate the interface program in the interface driver package, so that the interface program of the target database is stripped from the target database in the current interface test.
Step S104, the test equipment detects whether the interface program meets the interface requirement;
after the interface program of the target database is independently operated, the testing equipment can carry out interface detection, namely, whether the interface program meets the preset interface requirement is detected.
Step S105, the test equipment outputs the interface test result of the target database based on the detection result whether the interface program meets the interface requirement.
After step S104 is executed, the testing device may obtain a detection result of whether the interface program meets the preset interface requirement, based on the detection interface, the testing device may perform data summarization, analysis, format conversion, and other processing, generate an interface test result of the target database according to a preset output mode such as TXT, a report, or a chart, and output the interface test result.
It can be seen from the above that, unlike the prior art in which the whole target database needs to be run, the method for testing the database interface provided in the present application only needs to obtain the interface driver package of the target database according to the triggering of the interface test task, and separately runs the interface program in the interface driver package for interface test, thereby simplifying the interface test of the database, effectively reducing the hardware cost and time cost required for running the whole target database, and particularly when the interface performance of the target database under different running environments needs to be tested, greatly reducing the packaging application and the processing of the target database, thereby conveniently completing the interface test of the database.
Example two
In the foregoing description of the first embodiment, reference has been made to the obtaining process of the interface driver package of the target database in step S102, and in practical applications, the interface driver package may be uploaded or imported locally from the UE to the testing device by the user, so that the interface test of the target database may be performed on site more conveniently than by remote control.
Or, referring to fig. 2, fig. 2 shows another schematic flow chart of the database interface conformance testing method of the present application, and the obtaining process of the interface driver package may specifically include the following steps:
step S201, the test equipment reads a database identifier of a target database from task information of an interface test task;
the interface test task carries task information, and the task information can specifically carry a database identifier of the target database and is used for identifying the target database.
Therefore, when the interface driving package of the target database is obtained, the interface driving package of the target database can be searched through the database identification of the target database.
Step S202, the test equipment obtains the interface driver package corresponding to the database identification from the test platform through the obtaining request.
The test platform is used for storing corresponding relations among different interface drive packages uploaded by different users, different interface drive packages and different database identifications.
It can be understood that in the database interface test and even the database test scenario, a test platform may be provided to implement online management. The test platform can also be used for storing different interface drive packages, a user can upload the interface drive packages of different databases to the test platform in advance or in real time, and when the test equipment triggers an interface test task, the interface drive package required by the current interface test task can be obtained from the test platform, so that the test method of the database interface has higher flexibility in application, and meanwhile, the interface drive package can be downloaded/obtained more quickly by utilizing higher bandwidth of the test platform.
EXAMPLE III
In addition, as a program of Java programming language, the source code of the program needs to be compiled and passed, and then the program as a whole runs in a JDK compilation environment, and usually, all dependent class classes (source programs) need to be completed, and after the compilation is passed, the program can run normally.
Therefore, in the existing database performance test, if the target database is implemented based on the Java programming language and the whole target database is run, it means that the source code of the whole target database needs to be completely compiled and then can be implemented in the JDK compiling environment, which inevitably requires higher computational workload and time cost.
In the application, the interface driver package of the target database is acquired separately and loaded and run in the JDK compiling environment, so that less processing of compiling and packaging applications is needed, and the calculation workload and the time cost are greatly reduced.
When the running environment of the interface driver package of the target database is the JDK compilation environment, referring to another flowchart of the method for testing the compliance of the database interface of the present application shown in fig. 3, the method for testing the database interface of the present application may further include the following steps to configure the JDK compilation environment:
step S301, configuring connection information and JDK version information corresponding to a target database by the test equipment according to the task information of the interface test task;
firstly, the test equipment can also configure the connection information and the JDK version information corresponding to the target database on the basis of the task information of the interface test task.
Step S302, the test device configures the JDK compilation environment according to the connection information and the IDK version information.
After the connection information and the JDK version information corresponding to the target database are obtained, the test equipment can build or switch the JDK compiling environment to complete the configuration of the JDK compiling environment.
Example four
Meanwhile, when the target database is implemented based on Java programming language, the interface driver package may specifically be a JDBC driver package, referring to another flowchart of the method for testing the compliance of the database interface shown in fig. 4, the processing of the interface driver package in the first embodiment may specifically include the following steps:
step S401, the test equipment loads a JDBC driver package in a JDK compiling environment;
firstly, the test device loads the JDBC driver packet of the target database in the JDK compiling environment.
Step S402, the test equipment searches an interface drive file of the JDBC drive package according to a preset path;
secondly, the JDBC driver package comprises a plurality of files, and the test equipment searches according to a preset path and locates the interface driver file of the JDBC driver package.
Step S403, the test equipment traverses the interface drive file and determines an interface function corresponding to the test task;
and then, the test equipment traverses the interface driving file and determines the interface function corresponding to the test task from different interface functions.
Step S404, the test equipment dynamically loads the class of the interface function in the JDK compilation environment through a reflection mechanism to instantiate different interface objects.
After the interface function is obtained, the testing equipment can dynamically load the class where the interface function is located through a reflection mechanism, instantiate an interface object, so that the testing equipment can normally use the interface of the target database and automatically test various different database interfaces under the environment of not modifying codes and compiling and packaging.
Taking JDBC driver package of Oracle 12c database as an example, the test device searches the JDBC driver package to obtain an interface driver file ojdbc7.jar, traverses ojdbc7.jar to determine the file anyda.class of the interface function, and uses a tool jartools.class (which is mainly packaged according to Java reflection mechanism) to load and instantiate the class of the interface function, so that the class becomes a part of the main program directly related to the test device for use and interface test.
EXAMPLE five
The detection processing of whether the interface program meets the interface requirement in the first embodiment may specifically include the following steps:
the test equipment detects whether the execution process of the interface function is abnormal or not; alternatively, the first and second electrodes may be,
detecting whether the output result of the interface function is not null or not by the detection equipment; alternatively, the first and second electrodes may be,
detecting whether the data type of the output result of the interface function is correct or not by the detection equipment; alternatively, the first and second electrodes may be,
the detection device detects whether the content of the output result of the interface function is correct.
The above is an introduction of the database interface conformance testing method of the present application, and the following begins to introduce the database interface conformance testing apparatus of the present application.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a database interface conformance testing apparatus according to the present application, specifically, the database interface conformance testing apparatus may include the following structure:
the triggering unit 501 is configured to trigger an interface test task in which a task object is a target database, where the interface test task is used to test whether an interface of the target database meets a preset interface requirement;
an obtaining unit 502, configured to obtain an interface driver package of a target database, where the interface driver package includes an interface program of the target database;
a loading unit 503, configured to load the interface driver package and run the interface program in the running environment of the target database specified by the interface test task;
a detecting unit 504, configured to detect whether the interface program meets an interface requirement;
and an output unit 505, configured to output an interface test result of the target database based on a detection result of whether the interface program meets the interface requirement.
In a possible embodiment, the obtaining unit 502 is specifically configured to:
receiving an interface driving package uploaded or imported by a user; alternatively, the first and second electrodes may be,
reading a database identifier of a target database from task information of an interface test task;
and acquiring an interface driving package corresponding to the database identifier from a test platform through the acquisition request, wherein the test platform is used for storing different interface driving packages uploaded by different users, different interface driving packages and corresponding relations among different database identifiers.
In yet another possible embodiment, the execution environment is a JDK compilation environment, and the apparatus further comprises a configuration unit 506 for:
configuring connection information and JDK version information corresponding to a target database according to task information of an interface test task;
and configuring the JDK compiling environment according to the connection information and the IDK version information.
In another possible embodiment, the interface driver package is a JDBC driver package, and the loading unit 503 is specifically configured to:
loading a JDBC driver package in a JDK compiling environment;
searching an interface drive file of the JDBC drive packet according to a preset path;
traversing the interface driving file, and determining an interface function corresponding to the test task;
in the JDK compilation environment, the class of the interface function is dynamically loaded through a reflection mechanism to instantiate different interface objects.
In another possible embodiment, the detecting unit 504 is specifically configured to:
detecting whether the execution process of the interface function is abnormal or not; alternatively, the first and second electrodes may be,
detecting whether an output result of the interface function is not null; alternatively, the first and second electrodes may be,
detecting whether the data type of the output result of the interface function is correct or not; alternatively, the first and second electrodes may be,
and detecting whether the content of the output result of the interface function is correct.
With continuing reference to fig. 6, fig. 6 shows a schematic structural diagram of the database interface conformance testing apparatus provided in the present application, specifically, the database interface conformance testing apparatus provided in the present application includes a processor 601, where the processor 601 is configured to implement the steps of the database interface conformance testing method in any embodiment corresponding to fig. 1 to fig. 4 when executing the computer program stored in the memory 602; alternatively, the processor 601 is configured to implement the functions of the units in the corresponding embodiment of fig. 5 when executing the computer program stored in the memory 602.
Illustratively, a computer program may be partitioned into one or more modules/units, which are stored in the memory 602 and executed by the processor 601 to accomplish the present application. One or more modules/units may be a series of computer program instruction segments capable of performing certain functions, the instruction segments being used to describe the execution of a computer program in a computer device.
The database interface conformance testing apparatus can include, but is not limited to, a processor 601, a memory 602. Those skilled in the art will appreciate that the illustration is merely an example of the database interface compliance testing device, and does not constitute a limitation of the database interface compliance testing device, and may include more or less components than those shown, or combine some components, or different components, for example, the database interface compliance testing device may further include an input-output device, a network access device, a bus, etc., and the processor 601, the memory 602, the input-output device, the network access device, etc., are connected through the bus.
The Processor 601 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, the processor is a control center of the database interface conformance testing apparatus, and various interfaces and lines are used to connect various parts of the entire database interface conformance testing apparatus.
The memory 602 may be used for storing computer programs and/or modules, and the processor 601 may implement various functions of the computer apparatus by executing or executing the computer programs and/or modules stored in the memory 602 and calling data stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, video data, etc.) created from use of the database interface conformance test apparatus, and the like. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The present application also provides a readable storage medium, on which a computer program is stored, which, when executed by a processor, implements a database interface conformance testing method as in any of the embodiments corresponding to fig. 1 to 4.
It will be appreciated that the integrated unit, if implemented as a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the database interface conformance testing apparatus, the device and the corresponding units thereof described above may refer to the descriptions of the database interface conformance testing method in the embodiments corresponding to fig. 1 to fig. 4, and are not described herein again in detail.
In summary, the method, apparatus, device, and computer storage medium for testing the compliance of a database interface provided by the present application are different from the prior art in that the whole target database needs to be run, and according to the method for testing a database interface provided by the present application, only an interface driver package of the target database needs to be obtained according to the triggering of an interface test task, and an interface program in the interface driver package is separately run for interface testing, so that the interface testing of the database is simplified, the hardware cost and the time cost required for running the whole target database can be effectively reduced, and particularly when the interface performance of the target database under different running environments needs to be tested, the processing of packaging application and restarting the target database can be greatly reduced, thereby conveniently completing the interface testing of the database.
In the embodiments provided in the present application, it should be understood that the disclosed database interface conformance testing apparatus, device and corresponding units thereof can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (8)

1. A method for testing the compliance of a database interface, the method comprising:
the method comprises the following steps that a test device triggers an interface test task with a task object as a target database, the interface test task is used for testing whether an interface of the target database meets a preset interface requirement, and the target database is realized based on a Java programming language;
the test equipment acquires an interface drive packet of the target database, wherein the interface drive packet comprises an interface program of the target database;
the step of loading the interface driver package and running the interface program by the test equipment in the running environment of the target database specified by the interface test task comprises the following steps: the running environment is a JDK compiling environment, and the interface driver packet is a JDBC driver packet; the test equipment loads the JDBC driver packet in the JDK compiling environment; the test equipment searches an interface drive file of the JDBC drive packet according to a preset path; the test equipment traverses the interface driving file and determines an interface function corresponding to the test task; the test equipment dynamically loads the class of the interface function in the JDK compiling environment through a reflection mechanism so as to instantiate different interface objects;
the test equipment detects whether the interface program meets the interface requirement;
and the test equipment outputs an interface test result of the target database based on a detection result of whether the interface program meets the interface requirement.
2. The method of claim 1, wherein the test device obtaining the interface driver package for the target database comprises:
the test equipment receives the interface driving package uploaded or imported by a user; alternatively, the first and second electrodes may be,
the test equipment reads the database identification of the target database from the task information of the interface test task;
the test equipment obtains the interface drive package corresponding to the database identification from a test platform through an obtaining request, and the test platform is used for storing different interface drive packages uploaded by different users, different interface drive packages and corresponding relations among different database identifications.
3. The method of claim 2, further comprising:
the test equipment configures connection information and JDK version information corresponding to the target database according to the task information of the interface test task;
and the test equipment configures the JDK compiling environment according to the connection information and the J DK version information.
4. The method of claim 3, wherein the testing device detecting whether the interface program meets the interface requirements comprises:
the test equipment detects whether the execution process of the interface function is abnormal or not; alternatively, the first and second electrodes may be,
the test equipment detects whether the output result of the interface function is not null; alternatively, the first and second electrodes may be,
the test equipment detects whether the data type of the output result of the interface function is correct or not; alternatively, the first and second electrodes may be,
the test equipment detects whether the content of the output result of the interface function is correct.
5. A database interface compliance testing device, the device comprising:
the system comprises a triggering unit, a data processing unit and a data processing unit, wherein the triggering unit is used for triggering an interface test task with a task object as a target database, the interface test task is used for testing whether an interface of the target database meets a preset interface requirement, and the target database is realized based on a Java programming language;
an obtaining unit, configured to obtain an interface driver package of the target database, where the interface driver package includes an interface program of the target database;
a loading unit, configured to load the interface driver package and run the interface program in an operating environment of the target database specified by the interface test task, where the loading unit is configured to: the running environment is a JDK compiling environment, and the interface driver packet is a JDBC driver packet; the test equipment loads the JDBC driver packet in the JDK compiling environment; the test equipment searches an interface drive file of the JDBC drive packet according to a preset path; the test equipment traverses the interface driving file and determines an interface function corresponding to the test task; the test equipment dynamically loads the class of the interface function in the JDK compiling environment through a reflection mechanism so as to instantiate different interface objects;
the detection unit is used for detecting whether the interface program meets the interface requirement;
and the output unit is used for outputting the interface test result of the target database based on the detection result of whether the interface program meets the interface requirement.
6. The apparatus according to claim 5, wherein the obtaining unit is specifically configured to:
receiving the interface driving package uploaded or imported by a user; alternatively, the first and second electrodes may be,
reading a database identifier of the target database from task information of the interface test task;
and acquiring the interface driving package corresponding to the database identification from a test platform through an acquisition request, wherein the test platform is used for storing different interface driving packages uploaded by different users, different interface driving packages and corresponding relations among different database identifications.
7. The apparatus according to claim 6, characterized in that the apparatus further comprises a configuration unit for:
configuring connection information and JDK version information corresponding to the target database according to the task information of the interface test task;
and configuring the JDK compiling environment according to the connection information and the J DK version information.
8. The apparatus according to claim 7, wherein the detection unit is specifically configured to:
detecting whether the execution process of the interface function is abnormal or not; alternatively, the first and second electrodes may be,
detecting whether the output result of the interface function is not null; alternatively, the first and second electrodes may be,
detecting whether the data type of the output result of the interface function is correct or not; alternatively, the first and second electrodes may be,
and detecting whether the content of the output result of the interface function is correct or not.
CN201910840662.2A 2019-09-06 2019-09-06 Database interface conformance testing method and device Active CN110764997B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910840662.2A CN110764997B (en) 2019-09-06 2019-09-06 Database interface conformance testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910840662.2A CN110764997B (en) 2019-09-06 2019-09-06 Database interface conformance testing method and device

Publications (2)

Publication Number Publication Date
CN110764997A CN110764997A (en) 2020-02-07
CN110764997B true CN110764997B (en) 2021-07-23

Family

ID=69330187

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910840662.2A Active CN110764997B (en) 2019-09-06 2019-09-06 Database interface conformance testing method and device

Country Status (1)

Country Link
CN (1) CN110764997B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5664173A (en) * 1995-11-27 1997-09-02 Microsoft Corporation Method and apparatus for generating database queries from a meta-query pattern
CN101833498A (en) * 2009-07-31 2010-09-15 北京伟晨豪嘉科技有限责任公司 Automatic detection system of embedded type system based on testing script technique
CN109614426A (en) * 2018-10-26 2019-04-12 深圳壹账通智能科技有限公司 Switching method, device and electronic equipment between multiple database
CN110109817A (en) * 2019-03-13 2019-08-09 深圳壹账通智能科技有限公司 Automatic interface testing method, device, equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5664173A (en) * 1995-11-27 1997-09-02 Microsoft Corporation Method and apparatus for generating database queries from a meta-query pattern
CN101833498A (en) * 2009-07-31 2010-09-15 北京伟晨豪嘉科技有限责任公司 Automatic detection system of embedded type system based on testing script technique
CN109614426A (en) * 2018-10-26 2019-04-12 深圳壹账通智能科技有限公司 Switching method, device and electronic equipment between multiple database
CN110109817A (en) * 2019-03-13 2019-08-09 深圳壹账通智能科技有限公司 Automatic interface testing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN110764997A (en) 2020-02-07

Similar Documents

Publication Publication Date Title
CN108459962B (en) Code normalization detection method and device, terminal equipment and storage medium
CN108845930B (en) Interface operation test method and device, storage medium and electronic device
CN108459964B (en) Test case selection method, device, equipment and computer readable storage medium
CN108920370B (en) Compatibility problem detection method, device and equipment
CN107632827B (en) Method and device for generating installation package of application
CN107133165B (en) Browser compatibility detection method and device
CN110795353B (en) Quick application debugging method, device, equipment and storage medium
CN111124872A (en) Branch detection method and device based on difference code analysis and storage medium
CN109902027B (en) TPC-DS testing method and system convenient to implement
CN114116505A (en) Code testing method and device
CN110764997B (en) Database interface conformance testing method and device
CN110134583B (en) Software testing and data processing method and device
CN116303099A (en) Cross-platform rapid deployment method, device, medium and equipment for automatic test environment
CN110704307A (en) Application product testing method and device, user equipment and computer storage medium
CN115237889A (en) Database switching method and device, storage medium and computer equipment
CN110704301B (en) TPC-E automatic test method and TPC-E test system
CN114840400A (en) Abnormal component identification method, device, equipment, storage medium and program product
CN114978360A (en) Automatic testing method and device for communication equipment, electronic equipment and storage medium
CN110968507B (en) Coverage rate statistics method and coverage rate statistics device
CN110928779B (en) File processing method, application program operation fault positioning method and equipment
CN110457187B (en) TPC-E test method and test server capable of conveniently running based on backup test data
CN110908701B (en) Firmware version switching method and device, storage medium and electronic equipment
CN111078550A (en) Software testing method and device, computer device and storage medium
CN112463596A (en) Test case data processing method, device and equipment and processing equipment
CN112631894A (en) Code detection method, device, storage medium and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant