Database testing method and device and program product

Through the technical means of second-party packages and database agents, the problem of low testing efficiency of multi-language databases is solved, efficient testing of multi-language and multi-databases is realized, and testing efficiency and automation are improved.

CN118585458AInactive Publication Date: 2024-09-03HUNDSUN TECH

Patent Information

Application Number
CN202411066943.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-09-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When testing multi-lingual databases in the existing technology, multiple sets of test environments need to be deployed separately, resulting in a greatly reduced testing efficiency. There is also a lack of a universal method to solve the problem of testing efficiency of databases in the information and innovation field in multiple languages.

Method used

Use second-party packages and database agents to complete language conversion between different test instructions, and use the database agent to parse and execute test instructions in different languages ​​to realize multiple test processes, compare test results from multiple databases, and improve test efficiency.

Benefits of technology

Through the combination of second-party packages and database agents, the efficiency of multi-language and multi-database testing is improved, the complexity and time of manual testing are reduced, and the degree of test automation is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118585458A
    Figure CN118585458A
Patent Text Reader

Abstract

According to the database testing method and device and the program product, language family conversion between different testing instructions is completed through a two-party package, then the testing instructions of different language families are analyzed through a database agent, and the database agent initiates a multi-sending testing process for multiple databases. And the test result of at least one target database is compared with the test result of the source database to obtain a comparison result, so that the efficiency of multi-language multi-database test is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to database technology, and in particular to a database testing method, device and program product. Background Art

[0002] Due to the complexity of the financial industry, the databases used for analysis and calculation are built based on different languages. For example, Oracle language, MySQL language, PostgreSQL language, etc. During the product development and testing phase, whether it is unit testing, integration testing, or system testing, it is necessary to consider building multiple test environments for different database languages ​​to implement functional testing.

[0003] In the prior art, for multiple different databases, corresponding software systems need to be deployed for testing respectively, which greatly reduces the testing efficiency. Summary of the invention

[0004] The purpose of the present application is to provide a database testing method, device and program product, which are used to improve the testing efficiency for a multilingual database.

[0005] In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows: In a first aspect, an embodiment of the present application provides a method for testing a database, comprising: Configure a two-party package and a database agent; the two-party package is used to represent the test requirements of the source database and the test requirements of at least one target database; the data agent is used to maintain the interaction between the business system to be tested and the source database and at least one of the target databases; The business system to be tested determines the source test instructions of the source database and the target test instructions of the target database through the two-party package; The business system to be tested forms a test array with the source test instructions of the source database and the target test instructions of the target database; The database agent parses the test array to obtain a source test instruction of the source database and a target test instruction of at least one target database; The database agent executes the source test instruction and the target test instruction respectively to obtain a source test result and a target test result; The database agent compares the source test result with the target test result to obtain a comparison result.

[0006] Optionally, the step of configuring dependencies and database proxy includes: Configure the login information of the source database, the type of the source database, the type of the source test instruction, the login information of the target database, the type of the target database, and the type of the target test instruction in the second-party package; The port information used for testing the interaction is configured in the database proxy.

[0007] Optionally, the step of the business system to be tested determining the source test instructions of the source database and the target test instructions of the target database through the two-party package includes: In response to the test request, generate a request identifier corresponding to the test request; The business system to be tested calls the preset test code through the second-party package to obtain the source test instruction of the source database, the type of the source database, the target test instruction of the target database, and the type of the target database; The step of the business system to be tested forming a test array with the source test instructions of the source database and the target test instructions of the target database comprises: The request identifier, the type of the source database, the source test instruction, the type of the target database and the target test instruction constitute the test array.

[0008] Optionally, the step of the business system to be tested determining the source test instructions of the source database and the target test instructions of the target database through the two-party package includes: The business system to be tested obtains the source test instruction of the source database through a driver; The service system to be tested converts the source test instruction into a corresponding source abstract syntax tree through the conversion rule of the two-party package; The service system to be tested converts the source abstract syntax tree into a target abstract syntax tree according to the conversion rules of the two-party package; The service system to be tested converts the target abstract syntax tree into the target test instruction through the conversion rule of the two-party package; The step of the business system to be tested forming a test array with the source test instructions of the source database and the target test instructions of the target database comprises: The type of the source database, the source test instructions, the type of the target database, and the target test instructions constitute the test array.

[0009] Optionally, the database agent compares the source test result with the target test result to obtain a comparison result, comprising: The database agent compares the data volume of the source test result with the data volume of the target test result; If they are consistent, the source test result and the target test result are encoded and compared line by line to obtain the comparison result; If not consistent, the comparison result of the target test result is determined to be abnormal.

[0010] In a second aspect, an embodiment of the present application provides a database testing device, including: a configuration module, a processing module, a parsing module, and a testing module; The configuration module is used to configure the second-party package and the database agent; the second-party package is used to represent the test requirements of the source database and the test requirements of at least one target database; the data agent is used to maintain the interaction between the business system to be tested and the source database and at least one of the target databases; The processing module is used to determine the source test instructions of the source database and the target test instructions of the target database through the two-party package; and form a test array with the source test instructions of the source database and the target test instructions of the target database; The parsing module is used to parse the test array to obtain the source test instructions of the source database and at least one target test instruction of the target database; The test module is used to execute the source test instruction and the target test instruction respectively to obtain a source test result and a target test result; and compare the source test result with the target test result to obtain a comparison result.

[0011] Optionally, the processing module is specifically used to respond to a test request and generate a request identifier corresponding to the test request; call a preset test code through the second-party package to obtain a source test instruction of the source database, the type of the source database, a target test instruction of the target database, and the type of the target database; and form the test array with the request identifier, the type of the source database, the source test instruction, the type of the target database, and the target test instruction.

[0012] In a third aspect, an embodiment of the present application provides an electronic device, including: A memory for storing one or more programs; processor; When the one or more programs are executed by the processor, the method as described in any one of the first aspects above is implemented.

[0013] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in any one of the above-mentioned first aspects is implemented.

[0014] In a fifth aspect, an embodiment of the present application provides a program product, which, when executed by a processor, implements a method as described in any one of the above-mentioned first aspects.

[0015] Compared with the prior art, the database testing method, device and program product provided in the embodiment of the present application use a two-party package to complete the language conversion between different test instructions, and then parse the test instructions in different languages ​​through a database agent, and the database agent initiates multiple test processes for multiple databases. The test results of at least one target database are compared with the test results of the source database to obtain a comparison result, thereby improving the efficiency of multi-language and multi-database testing.

[0016] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 A schematic diagram of a multi-database testing architecture in the prior art; Figure 2 A schematic diagram of a flow chart of a database testing method provided by an embodiment of the present invention; Figure 3 A schematic diagram of a flow chart of another database testing method provided by an embodiment of the present invention; Figure 4 A schematic diagram of a flow chart of another database testing method provided by an embodiment of the present invention; Figure 5 A schematic diagram of a test architecture provided by an embodiment of the present invention; Figure 6 A schematic diagram of a flow chart of another database testing method provided by an embodiment of the present invention; Figure 7 A schematic diagram of another test architecture provided by an embodiment of the present invention; Figure 8 A schematic diagram of a flow chart of another database testing method provided by an embodiment of the present invention; Fig. 9 A schematic diagram of a flow chart of another database testing method provided by an embodiment of the present invention; Fig.10A schematic diagram of a database testing device provided by an embodiment of the present invention; Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0019] 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, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0020] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0021] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0022] It should be noted that, in this article, relational terms such as first and second, etc. 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.

[0023] Figure 1 FIG. 1 is a schematic diagram of a multi-database test architecture of the prior art. Figure 1 As shown in the figure, this architecture involves three databases: database A, database B, and database C. Since different databases involve different languages, different software systems are required, such as Figure 1As shown, software system 1 corresponds to database A, software system 2 corresponds to database B, and software system 3 corresponds to database C.

[0024] Furthermore, for any software system, a complete phase of testing from unit testing to integration testing to system testing takes n man-days. Therefore, when testing multiple databases, the efficiency of testing will be greatly reduced.

[0025] In summary, the technical problems of the existing technology are as follows: 1) It is impossible to solve the efficiency problem of unit testing that needs to cover databases in multiple languages.

[0026] 2) The industry can only achieve about 70% automated testing, especially for analytical systems based on Structured Query Language (SQL). That is, there is currently no universal method in the industry that can solve the human efficiency problem of testing databases in multiple languages ​​in the field of information technology.

[0027] In order to solve the above problems, the core idea of ​​the present invention is to introduce database agents and second-party packages. The second-party packages are used to complete the language conversion between different test instructions, and then the test instructions in different languages ​​are parsed through the database agent to complete the multi-test process. Thereby improving the test efficiency involving multiple languages ​​and multiple databases.

[0028] It should be noted that the second-party package refers to the dependency library within the software development company. For example, after a team completes the development of a functional module, the module can be packaged into a second-party package and deployed in the company's private warehouse for other teams and projects to introduce as a dependency through build tools, thus achieving code reuse and efficient project development.

[0029] The following provides possible implementations of the database testing method of the present invention. Specifically, Figure 2 A flowchart of a database testing method provided by an embodiment of the present invention is shown in FIG. Figure 2 , the method comprising: Step 200: Configure the second-party package and database proxy.

[0030] The two-party package is used to represent the test requirements of the source database and the test requirements of at least one target database; the data agent is used to maintain the interaction between the business system to be tested and the source database and at least one target database.

[0031] Optionally, for the configuration method, the interactive interface of the test tool used in the test process can be used to configure the relevant data, and the specific configuration method is not limited here.

[0032] Optionally, in the configuration of the second-party package, you can specify the source database and one or more target databases for this test. For example, if you need to test three databases, Oracle, Mysql, and PostgreSql, you can specify Oracle as the "Source" type to make Oracle the source database. Correspondingly, specify Mysql and PostgreSql as the "Target" type. The purpose of setting the source database and the target database is to compare the test results of the two in subsequent multiple tests, obtain the comparison results, and determine whether the target database is abnormal.

[0033] In addition, for this solution, since we no longer need to set up separate Figure 1 Therefore, for a business system to be tested, the information interaction between the business system to be tested and multiple databases of different languages, namely the source database and at least one target database mentioned above, is completed through the data agent.

[0034] Step 202: The business system to be tested determines the source test instructions of the source database and the target test instructions of the target database through the two-party package.

[0035] Specifically, after the business system to be tested integrates the second-party package, the source test instructions and the target test instructions can be obtained according to the test requirements of the source database and the test requirements of at least one target database contained in the second-party package. For the test instructions described in this article, in a possible implementation, they can be constructed through SQL.

[0036] Step 204: The business system to be tested forms a test array with the source test instructions of the source database and the target test instructions of the target database.

[0037] Step 206: The database agent parses the test array to obtain a source test instruction of the source database and a target test instruction of at least one target database.

[0038] Step 208: The database agent executes the source test instruction and the target test instruction respectively to obtain the source test result and the target test result.

[0039] Step 210: The database agent compares the source test result with the target test result to obtain a comparison result.

[0040] The database testing method provided by the embodiment of the present invention uses a two-party package to complete the language conversion between different test instructions, and then parses the test instructions in different languages ​​through a database agent, and the database agent initiates multiple test processes for multiple databases. The test results of at least one target database are compared with the test results of the source database to obtain a comparison result, thereby improving the efficiency of multi-language and multi-database testing.

[0041] Optionally, for how to configure the second-party package and database proxy, the following provides a possible implementation method. Figure 2 On the basis of Figure 3 A flowchart of another database testing method provided by an embodiment of the present invention is shown in FIG. Figure 3 , step 200 comprises: Step 200-1: configure the source database login information, source database type, source test instruction type, target database login information, target database type, and target test instruction type in the second-party package.

[0042] Specifically, for the second-party package, for the source database and the target database, you can configure the login information separately, such as UserName, Password, ClassType, etc., the type of database (DBtype), the type of test instruction, for example, the type of SQL.

[0043] Step 200-2: Configure the port information for testing interaction in the database proxy.

[0044] Specifically, for database proxies, such as Proxy, in order to ensure that the business system to be tested can interact normally with each database, the database access address, database proxy port, and Uniform Resource Locator (URL) are required so that the database proxy can subsequently send test instructions to the corresponding database based on the port information to execute the test process.

[0045] Optionally, for the above step 202, that is, how the service system to be tested determines the source test instruction and the target test instruction through the two-party package. The following provides a possible implementation method. Specifically, Figure 2 On the basis of Figure 4 A flowchart of another database testing method provided by an embodiment of the present invention is shown in FIG. Figure 4 , step 202 comprises: Step 202-1: Respond to the test request and generate a request identifier corresponding to the test request.

[0046] Optionally, when the tester triggers a test request through a test tool, a corresponding request identifier is generated corresponding to the test request. It should be noted that the test request may involve multiple tests of multiple databases, which may include one or more databases and one or more test instructions.

[0047] Step 202-2: The business system to be tested calls the preset test code through the second-party package to obtain the source test instruction of the source database, the type of the source database, the target test instruction of the target database, and the type of the target database.

[0048] Specifically, information related to the test, such as the source test instruction of the source database, the type of the source database, the target test instruction of the target database, and the type of the target database, can be configured as test code in advance and preset in the business system to be tested. Then, when the business system to be tested obtains the second-party package, the function of the second-party package, for example, "f_render_sql(String SQLID, String[] DBTypes, String[]SQLs)", can be used to obtain the above request identifier (SQLID), the type of the source database or target database (DBTypes) and the specific test instruction (SQLs).

[0049] Correspondingly, step 204 includes: Step 204-1: The request identifier, the type of the source database, the source test instruction, the type of the target database, and the target test instruction form a test array.

[0050] Specifically, Figure 5 A schematic diagram of a test architecture provided by an embodiment of the present invention, see Figure 5 , the architecture includes: the business system to be tested, the database agent, the Oracle database, the MySQL database and the PostgreSQL database.

[0051] When receiving a test request for the three databases from the tester, the business system to be tested generates a request identifier (SQLID), and then specifies the Oracle database as the source database, and the MySQL database and the PostgreSQL database as the target database, for example, in the manner of the above step 200.

[0052] The business system to be tested obtains the test instructions of Oracle database, MySQL database and PostgreSQL database by integrating the second-party package. The test instructions and other information such as the type of database are sent to the database agent through the port information. After parsing, the database agent obtains the corresponding source test instructions and target test instructions, and sends them to the corresponding database for the test process.

[0053] Optionally, for the above step 202, that is, how the service system to be tested determines the source test instruction and the target test instruction through the two-party package. Another possible implementation is provided below. Specifically, Figure 2 On the basis of Figure 6 A flowchart of another database testing method provided by an embodiment of the present invention is shown in FIG. Figure 6 , step 202 comprises: Step 202 - 3 : The business system to be tested obtains the source test instruction of the source database through the driver.

[0054] Specifically, Figure 7 Another test architecture diagram provided by the embodiment of the present invention is shown in Figure 7 In this example, the core logic is to use the second-party package to build a "conversion agent" in the business system to be tested. The role of this conversion agent is to convert the source test instructions into the target test instructions. Therefore, Figure 7 In the architecture shown, the business system to be tested further includes a conversion agent and a driver. The conversion agent can be composed of two-party packages. The driver is used to parse and obtain the source test instructions of the source database.

[0055] Step 202 - 4 : The business system to be tested converts the source test instruction into a corresponding source abstract syntax tree according to the conversion rules of the second-party package.

[0056] Specifically, when the driver obtains the source test instruction, for example, if the source database is an Oracle database, the source test instruction is Oracle SQL. At this time, the second-party package converts Oracle SQL into an Oracle Abstract Syntax Tree (Abstract SyntaxTree, abbreviated as: AST).

[0057] Step 202 - 5 : The business system to be tested converts the source abstract syntax tree into a target abstract syntax tree using the conversion rules of the second-party package.

[0058] Continuing with the above example, the source abstract syntax tree, Oracle AST, is converted into MySQL AST.

[0059] Step 202-6: The business system to be tested converts the target abstract syntax tree into target test instructions according to the conversion rules of the second-party package.

[0060] Continue with the above example to convert MySQL AST into MySQL SQL.

[0061] Correspondingly, step 204 includes: Step 204-2: The source database type, source test instructions, target database type and target test instructions form a test array.

[0062] It should be noted that for the above Figure 4 and Figure 6 Steps 204-1 and 204-2 shown, after forming the test array, are used for subsequent multiple tests for the database agent. The above test group can be assembled in a specific format. For example, it can be assembled in the format of [{"SQLID":" ID1" "DBType":"Oracle" "SQL":"xx"}]. Regardless of executing "commit" or "execute", the business system to be tested will submit the data format to the configured database agent.

[0063] Optionally, for the above step 206, after the database agent obtains the data format shown in the above example, it can parse the json string to obtain the Map<String, String> , Key is DBType, Value is SQL.

[0064] For example, the protocol format in the above step 204-2 is changed to a key-Value pair, such as Key: SQLID, Value: ID1; Key: DBType, value: Oracle; Key: SQL, Key: Select * from t_table.

[0065] Furthermore, for the above step 208, the database agent can use the port "PreparedStatement" to inject and execute the source test instructions and the target test instructions to obtain the corresponding original test results and the target test results. In combination with the above example, the database agent uses the port "PreparedStatement" to send Oracle SQL to the Oracle database and send MySQL SQL to the MySQL database.

[0066] In order to further reduce the amount of calculation in the test process, a possible implementation method for comparing the test results is provided below. Specifically, Figure 2 On the basis of Figure 8 A flowchart of another database testing method provided by an embodiment of the present invention is shown in FIG. Figure 8 , step 210 comprises: Step 210-1: The database agent compares the data volume of the source test result with the data volume of the target test result. If they are consistent, step 210-2 is executed; if they are inconsistent, step 210-3 is executed.

[0067] Step 210 - 2 : After encoding the source test result and the target test result, perform a line-by-line comparison to obtain a comparison result.

[0068] Step 210 - 3 : Determine that the comparison result of the target test result is abnormal.

[0069] Optionally, for the above step 210, after the database agent obtains the source test results and the target test results respectively, it can classify them based on the type of database, ie DBType, and then classify the source test results and the target test results into query type and change type according to the statements.

[0070] Among them, query operations mainly refer to those operations that will not change the state of data in the database, and they are mainly used to retrieve data. Query operations include but are not limited to: retrieving data from the database (SELECT); displaying information about the database, table, column, etc. (SHOW); obtaining information about the table structure (DESCRIBE). Change operations refer to those operations that will change the state of data in the database, and they are responsible for inserting, updating, and deleting data. Change operations include but are not limited to: inserting new data records into the database (INSERT); modifying existing data records in the database (UPDATE); deleting data records from the database (DELETE); modifying the structure of the database, such as changing the table structure (ALTER).

[0071] Furthermore, in the above step 210-1, for the test results of the query class, the data volume of the source test result and the target test result are compared, such as the Count number. If the Count numbers are consistent, based on step 210-2, the source test result and the target test result are encoded, for example, by using the Message-Digest Algorithm 5 (MD5 for short). Then, a line-by-line comparison is performed. In this way, it is possible to avoid directly performing a line-by-line comparison, which would cause excessive performance loss.

[0072] Finally, the above comparison results are recorded in the result table for subsequent analysis. If the results are inconsistent, it indicates that there may be a problem with the function point and manual testing is required.

[0073] Combined with the above examples, the following takes the test instruction as SQL as an example, and divides the technical solution provided by this application into four stages: parameter configuration, SQL submission, multiple tests, and result comparison, and fully introduces each stage. Specifically, Fig. 9 A flowchart of another database testing method provided by an embodiment of the present invention is shown in FIG. Fig. 9 , the method comprising: 300. Configure second-party packages and database agents.

[0074] Specifically, for the configuration of the second-party package and the data proxy, please refer to the previous example. Its core purpose is to build communication connections for databases corresponding to multiple languages, and to configure information related to the test requirements, such as the source database, target database, test port, and source SQL and target SQL.

[0075] 301. Integrate second-party packages.

[0076] Specifically, in the SQL submission phase, the business system to be tested needs to integrate the second-party package, so that the corresponding SQL can be obtained using the second-party package.

[0077] 302. Obtain source SQL and target SQL.

[0078] Specifically, see above, the business system to be tested can obtain the source SQL and target SQL required for the test through the second-party package.

[0079] 303. Send the SQL array to the database agent.

[0080] Specifically, the source SQL and target SQL of the business system to be tested constitute a test array in a specific format.

[0081] 304. Parsing of source SQL and target SQL.

[0082] Specifically, after the database agent obtains the test data, it obtains the source SQL and the target SQL through parsing.

[0083] 305. Send SQL to the corresponding database for testing.

[0084] 306. Obtain source test results and target test results.

[0085] 307. Compare the results.

[0086] The present application also provides a database testing device, which is used to execute each of the above-mentioned steps to achieve the corresponding technical effects. The following is a possible implementation method, specifically, Fig.10 A schematic diagram of a database testing device provided by an embodiment of the present invention, see Fig.10 The device 40 includes: a configuration module 400, a processing module 401, a parsing module 402 and a testing module 403.

[0087] Configuration module 400, used to configure a two-party package and a database agent; the two-party package is used to represent the test requirements of the source database and the test requirements of at least one target database; the data agent is used to maintain the interaction between the business system to be tested and the source database and at least one target database; The processing module 401 is used to determine the source test instructions of the source database and the target test instructions of the target database through the two-party package; the source test instructions of the source database and the target test instructions of the target database form a test array; A parsing module 402 is used to parse the test array to obtain a source test instruction of a source database and a target test instruction of at least one target database; The test module 403 is used to execute the source test instruction and the target test instruction respectively to obtain the source test result and the target test result; and compare the source test result with the target test result to obtain the comparison result.

[0088] The embodiment of the present invention further provides an electronic device, which can execute all the steps of the above examples of the embodiment of the present invention to achieve the corresponding technical effects. Specifically, Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, see Fig.11 , the electronic device 50, comprises: a memory 501, a processor 500; Memory 501, used to store one or more programs; Processor 500; When one or more programs are executed by the processor, when the electronic device 50 is used to execute the steps shown in the above-mentioned method examples, it can achieve each step and corresponding technical effects.

[0089] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0090] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0091] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a computer-readable storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

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

[0093] It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above, and that the present application can be implemented in other specific forms without departing from the spirit or essential features of the present application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims be included in the present application. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.

Claims

1. A database testing method, It is characterized in that include: Configure second-party packages and database proxies; The two-party package is used to represent the test requirements of the source database and the test requirements of at least one target database; the data agent is used to maintain the interaction between the business system to be tested and the source database and at least one of the target databases; The business system to be tested determines the source test instructions of the source database and the target test instructions of the target database through the two-party package; The business system to be tested forms a test array with the source test instructions of the source database and the target test instructions of the target database; The database agent parses the test array to obtain a source test instruction of the source database and a target test instruction of at least one target database; The database agent executes the source test instruction and the target test instruction respectively to obtain a source test result and a target test result; The database agent compares the source test result with the target test result to obtain a comparison result.

2. The method according to claim 1, It is characterized in that The steps of configuring dependencies and database proxy include: Configure the login information of the source database, the type of the source database, the type of the source test instruction, the login information of the target database, the type of the target database, and the type of the target test instruction in the second-party package; The port information used for testing the interaction is configured in the database proxy.

3. The method according to claim 1, It is characterized in that The step of the business system to be tested determining the source test instructions of the source database and the target test instructions of the target database through the two-party package includes: In response to the test request, generate a request identifier corresponding to the test request; The business system to be tested calls the preset test code through the second-party package to obtain the source test instruction of the source database, the type of the source database, the target test instruction of the target database, and the type of the target database; The step of the business system to be tested forming a test array with the source test instructions of the source database and the target test instructions of the target database comprises: The request identifier, the type of the source database, the source test instruction, the type of the target database and the target test instruction constitute the test array.

4. The method according to claim 1, It is characterized in that The step of the business system to be tested determining the source test instructions of the source database and the target test instructions of the target database through the two-party package includes: The business system to be tested obtains the source test instruction of the source database through a driver; The service system to be tested converts the source test instruction into a corresponding source abstract syntax tree through the conversion rule of the two-party package; The service system to be tested converts the source abstract syntax tree into a target abstract syntax tree according to the conversion rules of the two-party package; The service system to be tested converts the target abstract syntax tree into the target test instruction through the conversion rule of the two-party package; The step of the business system to be tested forming a test array with the source test instructions of the source database and the target test instructions of the target database comprises: The type of the source database, the source test instructions, the type of the target database, and the target test instructions constitute the test array.

5. The method according to claim 1, It is characterized in that The step of the database agent comparing the source test result with the target test result to obtain a comparison result includes: The database agent compares the data volume of the source test result with the data volume of the target test result; If they are consistent, the source test result and the target test result are encoded and compared line by line to obtain the comparison result; If not consistent, the comparison result of the target test result is determined to be abnormal.

6. A database testing device, It is characterized in that include: Configuration module, processing module, parsing module and testing module; The configuration module is used to configure the second-party package and the database proxy; The two-party package is used to represent the test requirements of the source database and the test requirements of at least one target database; the data agent is used to maintain the interaction between the business system to be tested and the source database and at least one of the target databases; The processing module is used to determine the source test instructions of the source database and the target test instructions of the target database through the two-party package; and form a test array with the source test instructions of the source database and the target test instructions of the target database; The parsing module is used to parse the test array to obtain the source test instructions of the source database and at least one target test instruction of the target database; The test module is used to execute the source test instruction and the target test instruction respectively to obtain a source test result and a target test result; The source test result is compared with the target test result to obtain a comparison result.

7. The device according to claim 6, It is characterized in that The processing module is specifically used to respond to a test request and generate a request identifier corresponding to the test request; call a preset test code through the second-party package to obtain a source test instruction of the source database, a type of the source database, a target test instruction of the target database, and a type of the target database; and form the test array with the request identifier, the type of the source database, the source test instruction, the type of the target database, and the target test instruction.

8. An electronic device, It is characterized in that include: A memory for storing one or more programs; processor; When the one or more programs are executed by the processor, the method according to any one of claims 1 to 5 is implemented.

9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

10. A program product, It is characterized in that When the program product is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Database performance test method and device, medium, equipment and program product

    CN114896137A

  • Test method and device and related equipment

    CN118051426A

Cited By

  • Database change capture tool automatic test method, system, equipment and medium

    CN119848880A