Test method and device for database analysis product, equipment, medium and product

By constructing and executing SQL test statements, combining the comparison of message queues and preset analysis reports, the problem of poor test accuracy of database analysis products is solved, and the accuracy and efficiency of tests are improved.

CN119690830APending Publication Date: 2025-03-25AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411752195.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The current database analysis product cannot accurately evaluate the effectiveness of database analysis capabilities, resulting in the database analysis products corresponding to database products facing testing vulnerabilities and poor analysis capabilities or analysis functions.

Method used

Provide a test method, by responding to user's test instructions, obtaining the attribute information of the database, building SQL statements as test statements, and cache these statements into the message queue, executing the test statements, obtaining the test results, and comparing them with the preset analysis report to obtain the comparison results.

Benefits of technology

It improves the accuracy and convenience of functional testing of database analysis products, ensures the accuracy and efficiency of test results, and helps discover and fill vulnerabilities in database analysis products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690830A_ABST
    Figure CN119690830A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a testing method and device for database analysis products, equipment, a medium and a product. The method comprises the steps of obtaining attribute information of a database in response to a test instruction of a user on the database; constructing a test statement of the database according to the attribute information of the database; wherein the test statement is in the form of a structured query language (SQL) statement; caching the test statement into a message queue, obtaining the test statement from the message queue, and executing the test statement to obtain a test result of the test statement; obtaining a comparison result according to the test result of the test statement and a preset analysis report; wherein the preset analysis report is database information obtained by analyzing a database by a preset database analysis product, and the comparison result represents the consistency of the test result and the database information. The method is used for improving the accuracy and convenience of the function test of the database analysis product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the increase of database products, the functions of databases become more and more complete, and the functions of database analysis products corresponding to database products are also different.

[0003] However, the effectiveness of the database analysis capabilities of current database analysis products cannot be accurately evaluated, resulting in many testing vulnerabilities in the database analysis products corresponding to the database products, that is, the analysis capabilities or analysis functions of the database analysis products are poor.

[0004] Therefore, the testing of database analysis products (also called functional testing) faces the problem of poor testing accuracy. Summary of the invention

[0005] The embodiments of the present application provide a method, device, equipment, medium and product for testing a database analysis product, so as to achieve the effect of improving the accuracy and convenience of functional testing of the database analysis product.

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

[0007] In response to a user's test instruction on the database, acquiring attribute information of the database;

[0008] Constructing a test statement of the database according to the attribute information of the database; wherein the test statement is in the form of a structured query language SQL statement;

[0009] Cache the test statement in a message queue, obtain the test statement from the message queue, execute the test statement, and obtain the test result of the test statement;

[0010] A comparison result is obtained based on the test result of the test statement and a preset analysis report; wherein the preset analysis report is database information obtained by analyzing the database with a preset database analysis product, and the comparison result represents the consistency between the test result and the database information.

[0011] In a second aspect, an embodiment of the present application provides a testing device for a database analysis product, including:

[0012] An acquisition unit, used for acquiring attribute information of a database in response to a user's test instruction on the database;

[0013] A construction unit, used to construct a test statement of the database according to the attribute information of the database; wherein the test statement is in the form of a structured query language SQL statement;

[0014] The execution unit caches the test statement into the message queue, obtains the test statement from the message queue, executes the test statement, and obtains the test result of the test statement;

[0015] The comparison unit is used to obtain a comparison result based on the test result of the test statement and a preset analysis report; wherein the preset analysis report is the database information obtained by analyzing the database with a preset database analysis product, and the comparison result represents the consistency between the test result and the database information.

[0016] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;

[0017] Memory stores computer-executable instructions;

[0018] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0020] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0021] The present application provides a method for testing a database analysis product, which obtains the attribute information of the database by responding to the user's test instruction on the database, and then constructs a test statement of the database according to the attribute information of the database, and further caches the test statement in a message queue, so as to obtain the test statement from the message queue, execute the test statement, obtain the test result of the test statement, and obtain the comparison result according to the test result of the test statement and the preset analysis report; wherein the preset analysis report is the database information obtained by the preset database analysis product for analyzing the database, and the comparison result represents the consistency between the test result and the database information. wherein the test statement is in the form of a structured query language SQL statement. The present application provides a method for testing a database analysis product, which is used to improve the accuracy and convenience of functional testing of database analysis products. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0023] Figure 1 A flowchart of a method for testing a database analysis product provided in this application;

[0024] Figure 2 Message queue diagram provided for this application;

[0025] Figure 3 A flowchart of another method for testing a database analysis product provided in the present application;

[0026] Figure 4 A flowchart of another method for testing a database analysis product provided in the present application;

[0027] Figure 5 A schematic diagram of the test framework for the database provided for this application;

[0028] Figure 6 A schematic diagram of the structure of a test device for a database analysis product provided in this application;

[0029] Figure 7 A schematic diagram of the structure of another test device for a database analysis product provided by the present application;

[0030] Figure 8 A schematic diagram of the structure of the electronic device provided in this application.

[0031] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0032] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0033] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0034] With the increase of database products, the functions of databases become more and more complete, and the functions of database analysis products corresponding to database products are also different.

[0035] However, the effectiveness of the database analysis capabilities of current database analysis products cannot be accurately evaluated, resulting in many testing vulnerabilities in the database analysis products corresponding to the database products, that is, the analysis capabilities or analysis functions of the database analysis products are poor.

[0036] Therefore, the testing of database analysis products faces the problem of poor accuracy of functional testing.

[0037] The present application provides a method for testing a database analysis product, which obtains the attribute information of the database by responding to the user's test instruction for the database, and then constructs the test statement of the database according to the attribute information of the database, and further caches the test statement in the message queue, so that the test statement is obtained from the message queue, the test statement is executed, and the test result of the test statement is obtained. Among them, the test statement is in the form of a structured query language SQL statement. In addition to being a general test statement, the test statement can also be an abnormal test statement and a custom test statement, covering a variety of test statements, ensuring the accuracy of the test of the database. At the same time, by caching the test statement in the message queue, it can be ensured that multiple test statements can be tested in parallel to improve the efficiency of the test of the database. In addition, by comparing the test results obtained by multiple test statements with the preset analysis report, a comparison result is obtained; wherein, the preset analysis report is the database information obtained by the preset database analysis product for database analysis, and the comparison result characterizes the consistency of the test result with the database information. The present application provides a method for testing a database analysis product, which is used to improve the accuracy and convenience of the functional testing of the database analysis product.

[0038] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0039] Figure 1This is a flow chart of a method for testing a database analysis product provided by the present application. The execution subject of the method can be a server, a host or other device, such as Figure 1 As shown, the method may include:

[0040] S101. In response to a user's test instruction on a database, obtain attribute information of the database.

[0041] The test instruction may refer to an instruction issued by a user who wants to test a database. The test instruction may include attribute information of the database. The attribute information may refer to metadata information of the database, such as table structure, view, field type, index, constraint, etc.

[0042] It can be understood that in response to a user's test instruction on a database, the attribute information of the database can be obtained.

[0043] Exemplarily, the attribute information of the database may include: {database name: mydatabase, database version: MySQL 8.0, database character set: utf8, table name: users, table type: InnoDB, number of rows in the table: 200, column names: id, username, date, column data types: INT, VARCHAR, DATETIME, maximum length of the column: INT(32), VARCHAR(255), DATETIME('1000-01-01 00:00:00' to '9999-12-3123:59:59'), user authority: admin}, etc.

[0044] In one possible implementation, the forms in which the user issues test instructions to the database may include but are not limited to: the user issues instructions by clicking a button, filling out a form, or selecting a menu item in a graphical user interface (GUI); the user enters a specific command or script in a command-line interface (CLI) to trigger a test; the user uses an application programming interface (API) to send test instructions.

[0045] S102: Construct a test statement of the database according to the attribute information of the database; wherein the test statement is in the form of a structured query language SQL statement.

[0046] The test statement may be in the form of a SQL (Structured Query Language) statement. It can be understood that SQL is a standard language for interacting with a database and can implement various operations on the database.

[0047] Exemplarily, there may be various contents of an SQL statement, such as a SELECT statement, an INSERT statement, an UPDATE statement, a DELETE statement, a CREATE statement, an ALTER statement, a DROP statement, a TRUNCATE statement, and the like.

[0048] Among them, the SELECT statement can be used for data retrieval to verify whether the database can correctly return the query results, test the query performance, and ensure the accuracy and completeness of the query results;

[0049] The INSERT statement can be used to insert data to verify that the database can correctly store new data, test the performance of the insert operation, and ensure that data integrity and constraints (such as primary keys, foreign keys, and unique constraints) are correctly implemented;

[0050] The UPDATE statement can be used to update data to verify whether the database can correctly update existing data and test the performance of the update operation;

[0051] The DELETE statement can be used to delete data to verify whether the database can delete data correctly and test the performance of the deletion operation;

[0052] The CREATE statement can be used to create database objects (such as tables, views, indexes, triggers, etc.) to verify that the database can correctly create new database objects, test the performance of the creation operation, and ensure that the newly created objects meet the expected structure and properties;

[0053] The ALTER statement can be used to modify the structure or properties of database objects, verify that the database can correctly modify the structure or properties of existing database objects, test the performance of modification operations, and ensure that the modified objects meet expectations;

[0054] The DROP statement can be used to delete database objects, verify whether the database can correctly delete database objects, test the performance of the deletion operation, and ensure that related dependencies and data integrity are properly handled after the deletion operation;

[0055] The TRUNCATE statement can be used to quickly delete all data in a table, verify whether the database can quickly clear table data, test the performance of the operation, and ensure that the table structure and indexes remain unchanged.

[0056] In a possible implementation, the test statement of the database may be an SQL statement or a transaction statement.

[0057] It can be understood that the test may include the test of a single operation on the database, or the test of a series of operations as a whole (i.e., a transaction). Among them, the SQL statement can be used to test a single operation on the database, and the transaction statement can be used to test a series of operations on the database as a whole. That is, the transaction statement can also be in the form of SQL, and can be composed of multiple SQLs.

[0058] In a possible implementation, constructing a test statement for the database according to the attribute information of the database may include:

[0059] Determine the variable information of the preset database test statement template; and update the variable information of the database test statement template to the database attribute information according to the association relationship between the preset variable information of the database test statement template and the database attribute information.

[0060] For example, the test statement template of the database can be expressed as SELECT{column_name}from{table_name}, where column_name represents the variable information corresponding to the column name, and table_name represents the variable information corresponding to the table name. The attribute information of the database includes at least: {database name: mydatabase, database version: MySQL 8.0, database character set: utf8, table name: table1, number of rows in the table: 200, column name: column1}, etc.

[0061] Exemplarily, based on the attribute information of the database, the test statement of the constructed database can be expressed as SELECT column1 from table1, which is an SQL statement, wherein column1 and table1 are the attribute information corresponding to the database, and the test statement indicates querying the row information of column column1 from table table1 in the database.

[0062] Alternatively, according to the attribute information of the database, the test statement of the constructed database can be expressed as BEGIN TRANSACTION; INSERT INTO table1(column1,column2) VALUES("123","234"); UPDATE table2 set column3 = "678" WHERE column3 = "123"; COMMIT, which is a transaction statement, wherein BEGIN TRANSACTION marks the beginning of a new transaction. Before the new transaction starts, it is ensured that there are no other unfinished transactions so that the new transaction can be executed in a clean environment. COMMIT marks the end of the transaction. table1, table2, column1, column2, column3 are the attribute information corresponding to the database. INSERT INTO table1(column1,column2) VALUES("123","234") means inserting a new data value "123" into column column1 of table table1 and a new data value "234" into column column2. UPDATE table2 set column3="678"WHERE column3="123" means updating the data with the value "123" in column3 of table2 to "678".

[0063] In an optional implementation, step S102 may include:

[0064] According to the attribute information of the database, an initial test statement is constructed, and according to a preset random algorithm, label information corresponding to the initial test statement is generated; according to the initial test statement and the label information, a test statement of the database is obtained.

[0065] The initial test statement may refer to a test statement that does not include label information, and the test statement in the database may refer to a test statement that includes label information.

[0066] Exemplarily, according to the attribute information of the database, the initial test statement constructed can be expressed as the above-mentioned SELECT column1 from table1.

[0067] The tag information may refer to identification information used to identify and classify test statements to facilitate management and execution of the test statements.

[0068] In some possible implementations, the label information may be a random string, a type label of a test statement, or the like.

[0069] The preset random algorithm may refer to a pre-set random algorithm. In this embodiment, the preset random algorithm is not specifically limited.

[0070] It can be understood that a random string, namely, label information, can be obtained through calculation of a random algorithm.

[0071] Exemplarily, the label information corresponding to the initial test statement is generated according to a preset random algorithm, which may be:

[0072] Determine a character set of the random string and the length of the random string; randomly extract characters from the character set, and concatenate the randomly extracted characters in a certain order to obtain a random string of corresponding length.

[0073] The character set may refer to a set of characters such as uppercase letters, lowercase letters, and numbers, and the length of the random character string may be set to 8.

[0074] Randomly extracting a character from a character set may include: numbering the position of the character in the character set, using a random number generator to generate a corresponding random number, the random number corresponding to the position of the character in the character set, ie extracting the character.

[0075] It should be noted that after generating the label information corresponding to the initial test sentence according to the preset random algorithm, the following steps may also be included:

[0076] It is determined whether the label information corresponding to the initial test statement exists in the preset label set. If yes, the label information corresponding to the initial test statement is regenerated.

[0077] Among them, the preset tag set may refer to a pre-set tag set, and the tag set may refer to a container for storing tag information. It can be understood that after each tag information corresponding to an initial test statement is generated, the tag information corresponding to the generated initial test statement is synchronously stored in the tag set.

[0078] The above method can ensure the uniqueness of the label information corresponding to each test statement, so that the test statement of the label information can be located according to the label information.

[0079] Exemplarily, the initial test statement is the above-mentioned SELECT column1 from table1, and the label information corresponding to the initial test statement can be expressed as AbCd1234. According to the initial test statement and the label information, the obtained database test statement can be expressed as / *labelkey1=AbCd1234* / SELECT column1 from table1, wherein labelkey1 represents the variable name of the label information, AbCd1234 represents the label information, and / ** / is a comment symbol, wherein the content between * and * is the comment content, which is used to store the label information.

[0080] The beneficial effect of such a setting is that a preset random algorithm is used to generate unique label information for each test statement, which can improve the management and execution efficiency of the test statements and ensure the traceability of the test.

[0081] In an optional implementation, constructing an initial test statement according to the attribute information of the database may include:

[0082] A statement template of a general statement is obtained from a preset test statement library; variable information in the statement template is adjusted according to attribute information of the database to obtain an initial test statement.

[0083] The preset test statement library may be a pre-set test statement library, and the test statement library may refer to a storage unit for storing a series of pre-defined test statement templates.

[0084] The statement template of a general statement may refer to a statement template corresponding to the more frequent and commonly used operation steps when operating a database. For example, statements related to general operations on a database such as adding, modifying, deleting, and querying may be general statements.

[0085] In a possible implementation manner, statement templates of common statements may be obtained from a Sysbench test tool and a TPC-C test tool.

[0086] In a possible implementation, the test statement template includes variable information. The variable information in the statement template is adjusted according to the attribute information of the database to obtain an initial test statement.

[0087] Variable information may refer to information to be adjusted in a template.

[0088] Adjustment may refer to replacing variable information in a statement template with attribute information of a database to obtain an initial test statement.

[0089] Exemplarily, the statement template of the general statement can be expressed as INSERT INTO{table_name}{column_name}VALUES{value_text}, wherein the variable information in the statement template is table_name, column_name, and value_text, representing the table name, column name, and insert content, respectively. The statement template is used to insert a data into a column of a table in a database.

[0090] The attribute information of a database can be expressed as {database name: mydatabase, table name: users, number of rows in the table: 200, column names: id, username, date, column data types: INT, VARCHAR, DATETIME}, etc.

[0091] It can be seen that the database attribute information corresponding to the variable information table_name is users, the database attribute information corresponding to the variable information table_name is id or username or date, and the database attribute information corresponding to the variable information value_text can be randomly generated text in at least one type of column data type INT or VARCHAR or DATETIME.

[0092] Exemplarily, the initial test statement may be INSERT INTO {users} {id} VALUES {123}; INSERT INTO {users} {username} VALUES {123}; INSERT INTO {users} {date} VALUES {123}.

[0093] It can be understood that if the attribute information of the database includes multiple contents, such as multiple tables, or a table has multiple columns, the number of corresponding initial test statements may be greater than or equal to 1.

[0094] The beneficial effect of such a setting is that, by utilizing a preset test statement library and general statement templates, combined with the specific attribute information of the database, rapid generation of test statements is achieved, the efficiency and flexibility of test statement creation are improved, and the consistency of test statements with the database structure is ensured, thereby making the test of the database more comprehensive, accurate and efficient.

[0095] In an optional implementation, the test statement of the database is an abnormal statement, and the abnormal statement represents a test statement that tests a preset test type, and the preset test type includes at least one of a deadlock type and a slow query type.

[0096] The abnormal statement may refer to a test statement for testing the capability of the database under abnormal circumstances. The abnormal statement represents a test statement for testing a preset test type. The preset test type is a test type of the database under abnormal circumstances.

[0097] The preset test type may be a pre-set test type, for example, the preset test type may include at least one of a deadlock type, a slow query type, a large transaction type, a long transaction type, and an index failure type.

[0098] Deadlock type test statements may refer to test statements that simulate deadlock situations caused by multiple transactions competing for resources in a database. The purpose is to verify how the database management system detects and resolves deadlocks to ensure the smooth execution of transactions and the stability of the database.

[0099] Slow query type test statements can refer to test statements of database query operations that take a long time to execute. The purpose is to identify and analyze query performance bottlenecks, and then optimize SQL statements and database structures to improve the response speed and overall performance of the database.

[0100] A large transaction type test statement may refer to a test statement that modifies too many rows in a database table.

[0101] A long transaction type test statement may refer to a test statement that takes too long to execute a transaction statement.

[0102] Index failure type test statements may refer to SQL statements that are executed without using indexes, resulting in slow execution, full table scans, and other consequences.

[0103] In a possible implementation, the test type of the test statement may also include a hardware resource limitation type, an integrity constraint conflict type, and the like.

[0104] Among them, test statements of the hardware resource limitation type may refer to test statements for performing general database operations when hardware resources (such as CPU, memory, disk) are insufficient or improperly configured, so as to understand the performance and stability of the database in a resource-constrained environment; test statements of the integrity constraint conflict type may refer to test statements for detecting operations of the database when it attempts to violate data integrity constraints (such as uniqueness constraints, primary key constraints, foreign key constraints), so as to test whether the database can correctly reject such operations and report an error (i.e., report the cause of the error).

[0105] The above steps obtain the test statements of the database based on the initial test statements and label information, which may include:

[0106] Determine the test type corresponding to the initial test statement, and determine the type identifier associated with the test type corresponding to the initial test statement; obtain the test statement of the database according to the initial test statement, label information, and type identifier.

[0107] The type identifier associated with the test type may refer to an identifier of the test type used to identify a test statement of the database under abnormal circumstances.

[0108] In a possible implementation, the type identifier may also include but is not limited to an uncommitted transaction type, which is not limited here.

[0109] The uncommitted transaction type may refer to the type of a transaction that is executed for a long time and is closed. For example, the type identifiers of the deadlock type, slow query type, large transaction type, long transaction type, uncommitted transaction type, index ineffective type, etc. may be represented as deadlock, slow_query, large_transaction, long_transaction, uncommitted_transaction, index_ineffective, etc., respectively.

[0110] It can be understood that if the test statement of the database is an abnormal statement, the test statement of the database includes an initial test statement, label information, and a type identifier.

[0111] Exemplarily, the initial test statement can be expressed as START TRANSACTION; SELECT * FROM table1 WHERE column1 = 1 FOR UPDATE; DO SLEEP (5); SELECT * FROM table1 WHERE column1 = 2 FOR UPDATE; COMMIT. This test statement is a deadlock type test statement with a type identifier of deadlock, which is used to indicate a transaction statement related to testing deadlock.

[0112] START TRANSACTION marks the beginning of the transaction, and COMMIT marks the end of the transaction. SELECT*FROM table1 WHERE column1=1FOR UPDATE indicates that a query is executed on table1, that is, all rows whose value under column1 is equal to 1 are selected, and the FOR UPDATE clause is used. FOR UPDATE indicates that the rows obtained by the statement query will be locked, and other transactions cannot modify these rows until the current transaction ends. DO SLEEP(5) indicates that the current transaction is paused for 5 seconds. SELECT*FROM table1 WHERE column1=2FOR UPDATE indicates that after the current transaction is paused for 5 seconds, an attempt is made to lock all rows whose value under column1 in table1 is equal to 2. It can be seen that if other transactions have locked these rows, the current transaction needs to wait until those rows are not locked before it can perform the operation.

[0113] The test statement to obtain the database can be expressed as / *labelkey1=Aaaa4321,labelkey2=deadlock* / START TRANSACTION; SELECT*FROM table1 WHERE column1=1FOR UPDATE; DOSLEEP(5); SELECT*FROM table1 WHERE column1=2FOR UPDATE; COMMIT.

[0114] Among them, labelkey1 represents the variable name of the label information, Aaaa4321 represents the label information, labelkey2 represents the variable name of the type identifier, deadlock represents the type identifier, / ** / is a comment symbol, and the content between * and * is the comment content, which is used to store the label information and type identifier. The initial test statement is START TRANSACTION; SELECT * FROM table1 WHERE column1 = 1 FOR UPDATE; DO SLEEP (5); SELECT * FROM table1 WHERE column1 = 2 FOR UPDATE; COMMIT.

[0115] The beneficial effect of such a setting is that by adding exception statements to database test statements, especially exception statements for preset test types such as deadlock and slow query, the behavior and performance of the database under abnormal conditions can be effectively simulated and evaluated, thereby enhancing the comprehensiveness of the database test and making the classification and analysis of the test results more accurate and efficient.

[0116] In an optional implementation, the test statement of the database is a custom statement, and the custom statement represents a custom test statement.

[0117] The custom statement may refer to a test statement that is customized by a user.

[0118] A custom statement may refer to a test statement written by a user to meet a specific test purpose.

[0119] For example, the database is used to store commodity transaction data, and multiple tables in the database need to be queried, such as multi-table joins, subqueries, etc. Then the general test statements cannot meet the business needs, so customized statements are required to meet the business needs.

[0120] The above steps construct the initial test statement based on the attribute information of the database, which may include:

[0121] According to the basic information of the database, based on the user's SQL statement editing instructions, build the initial test statement.

[0122] The SQL statement editing instruction may refer to an instruction edited by a user for generating a custom statement.

[0123] Exemplarily, the user's SQL statement editing instruction can be expressed as various customized SQL statements. For example, the user's SQL statement editing instruction is expressed as SELECT*FROM orders WHERE amount>1000, which is used to query the order information with an order amount exceeding 1,000 yuan in the orders table.

[0124] In an optional implementation, if the user's SQL statement editing instruction does not satisfy a corresponding matching relationship with the basic information of the database, the user is prompted to regenerate the SQL statement editing instruction to construct an initial test statement.

[0125] For example, if the user's SQL statement editing instruction is the above-mentioned SELECT*FROM orders WHEREamount>1000, and the table orders does not exist in the basic information of the database, the user is prompted to regenerate the SQL statement editing instruction to construct an initial test statement.

[0126] The beneficial effect of such a setting is that the consistency between the custom test statement and the database structure is ensured, thereby improving the accuracy and efficiency of the test.

[0127] S103: Cache the test statement in a message queue, obtain the test statement from the message queue, execute the test statement, and obtain a test result of the test statement.

[0128] Herein, a message queue may refer to a container for temporarily storing messages until the messages are processed.

[0129] In the present application, a message in a message queue may be a test statement, and the test statement may be an SQL statement or a transaction statement.

[0130] Exemplarily, the message queue may be Kafka, which is a high-throughput distributed publish-subscribe messaging system that can process stream data, ie, messages.

[0131] In an optional implementation, caching the test statement in a message queue may include:

[0132] The user identification information is obtained from the test instruction, and a message queue corresponding to the user identification information is determined; and the test statement is cached in the message queue corresponding to the user identification information.

[0133] When a user submits a test instruction, the instruction may include user identification information.

[0134] The user identification information may be a user ID, user name, or other unique identifier, etc., which is used to distinguish different users.

[0135] In a possible implementation, the number of message queues is preset by a staff member, and there is a corresponding relationship between the message queues and the users, that is, the message queue corresponding to the user identification information can be determined according to the user identification information.

[0136] After the message queue corresponding to the user identification information is determined, the test statement can be cached in the message queue in the form of a message.

[0137] The beneficial effect of this setting is that each user has an independent message queue, which helps to achieve the isolation of test instructions from different users, prevents test statements from different users from interfering with each other, and ensures the independence and security of the test environment.

[0138] In an optional implementation, obtaining a test statement from a message queue, executing the test statement, and completing the test on the database may include:

[0139] In response to the execution test statement instructions of n users, determining n message queues corresponding to the n users;

[0140] Create n threads; there is a one-to-one correspondence between n threads and n message queues;

[0141] For each thread, the test statements are executed in the order of processing the test statements that enter the message queue first, thus completing the test of the database.

[0142] A thread is the smallest unit in a computer program that can run independently and can be considered as an independent path for program execution. In a multithreaded environment, each thread can execute different tasks in parallel without interfering with the execution of other threads.

[0143] The beneficial effect of such a setting is that by allocating an independent message queue and thread to each user, parallel processing of test statements and corresponding sequential execution are achieved, thereby improving test efficiency and resource utilization.

[0144] In order to better describe the use of message queues to cache test statements, obtain test statements from message queues, execute test statements, and complete the test of the database, Figure 2 The message queue diagram provided for this application is as follows: Figure 2 As shown, there are N message queues, and multiple messages are cached in each message queue.

[0145] Exemplarily, the message represents a test statement, and the test statement may include but is not limited to the above-mentioned general statements, abnormal statements, and custom statements, wherein a test statement may also include an SQL statement or a transaction statement.

[0146] Exemplarily, message queue 1 can serve user A's execution test statement instruction, and the messages in the message queue are general SQL statements, general transaction statements, etc. in the order of being cached in the message queue; message queue 2 can serve user B's execution test statement instruction, and the messages in the message queue are abnormal SQL statements, custom transaction statements, general SQL statements, etc. in the order of being cached in the message queue; message queue 3 can serve user C's execution test statement instruction, and the messages in the message queue are abnormal transaction statements, general SQL statements, custom SQL statements, etc. in the order of being cached in the message queue; message queue N can serve user N's ​​execution test statement instruction, and the messages in the message queue are abnormal SQL statements, general SQL statements, general transaction statements, etc. in the order of being cached in the message queue.

[0147] Furthermore, for each thread corresponding to the message queue, the test statements are executed in the order of processing the test statements that enter the message queue first, and the test of the database is completed. Each thread can be carried out in parallel and synchronously, which improves the efficiency of the test of the database.

[0148] The test result may refer to the test result obtained by executing the test statement.

[0149] In a possible implementation, the test result includes a conclusion of executing the test statement and information corresponding to the conclusion, and the conclusion may represent whether the execution of the test statement is successful or failed.

[0150] If the conclusion is success, the information corresponding to the conclusion is the expected result of executing the test statement; if the conclusion is failure, the information corresponding to the conclusion is the corresponding error information of the failure to execute the test statement.

[0151] For example, the test statement may be SELECT * FROM customers WHERE country = 'China', which is used to query the row information whose content is 'China' under the country column in the customers table;

[0152] The test result corresponding to the test statement may be "success; customer ID, customer name, China", where success indicates that the test statement is successfully executed, and customer ID, customer name, China indicate the row information of the country column in the customers table obtained by the query, which contains 'China'.

[0153] The test result corresponding to the test statement may also be "failure; column name error", where failure indicates the conclusion that the execution of the test statement is a failure, and column name error indicates the reason for the failure to execute the test statement.

[0154] Exemplarily, the test statement may also be SELECT * FROM large_table, which is used to query all data under the large table large_table. The test result corresponding to the test statement may be at least "successful, time consumption: 0.45 seconds, CPU usage: 75%".

[0155] S104. Obtain a comparison result based on the test result of the test statement and a preset analysis report; wherein the preset analysis report is database information obtained by analyzing the database with a preset database analysis product, and the comparison result represents the consistency between the test result and the database information.

[0156] The preset analysis report may refer to a pre-set analysis report, and the analysis report is database information obtained by analyzing a database using a preset database analysis product.

[0157] The preset database analysis product may refer to a pre-set database analysis product, which can analyze a database to obtain analyzed database information.

[0158] In a possible implementation, the database analysis product is connected to the database via an interface, so that the database analysis product can obtain database information through the interface. The database information may include attribute information, log information, etc. of the database.

[0159] The database analysis product analyzes and processes the acquired database information to obtain the analyzed database information, i.e., the analysis report. The analysis process may include but is not limited to averaging, summing, and aggregation calculation, which are not limited here.

[0160] Exemplarily, the acquired database information can be expressed as {"SQL statement": SELECT*FROM large_table; "Execution time": 2024-12-31 12:00:00; "Time taken": 0.1 second}, {"SQL statement": SELECT*FROMlarge_table; "Execution time": 2024-12-31 12:01:00; "Time taken": 0.3 second}, {"SQL statement": SELECT*FROM large_table; "Execution time": 2024-12-31 12:02:00; "Time taken": 0.14 second}.

[0161] The acquired database information may be averaged to average the time taken to execute the same SQL statement in the acquired database information. For example, the database information obtained after averaging may be {"SQL statement": SELECT*FROM large_table; "average time taken": 0.18 seconds}, which is the content of the analysis report.

[0162] According to the test results of the test statement and the preset analysis report, the comparison results can be:

[0163] The consistency between the test result of the test statement and the database information of the preset analysis report is compared to obtain the comparison result.

[0164] For example, if the test statement includes SELECT*FROM large_table, and the test result of the test statement is "time taken: 0.2 seconds", the test result of the test statement 0.2 seconds is compared with the content of the analysis report 0.18 seconds. That is, for the same SQL statement, the difference between the test result of 0.2 seconds and the content of the analysis report of 0.18 seconds is within the preset threshold, that is, within 5 seconds, and the comparison result can be consistent.

[0165] For example, if there is a test vulnerability in the database analysis product and there is a calculation error in the averaging process, for example, the database information obtained above is averaged, and the averaged database information obtained is represented as {"SQL statement": SELECT*FROM large_table; "Average time": 7.18 seconds}, the test result of the test statement, 0.2 seconds, is compared with the content of the analysis report, 7.18 seconds. That is, for the same SQL statement, the difference between the test result, 0.2 seconds, and the content of the analysis report, 7.18 seconds, is not within the preset threshold, that is, not within 5 seconds, and the comparison result may be poor consistency.

[0166] In a possible implementation, the comparison result includes label information of the test statement. After the comparison result is obtained according to the test result of the test statement and a preset analysis report, it may include:

[0167] If the comparison result is poor consistency, obtain the label information with poor consistency, and determine the test statement corresponding to the label information, so that the staff can fill the gaps in the database analysis product according to the test statement.

[0168] The present application provides a testing method for a database analysis product, which constructs general test statements, abnormal test statements, and custom test statements, wherein the test statements can be SQL statements and transaction statements, and the constructed test statements are cached in a message queue in a certain order and correspondence. The diversity of test statements improves the coverage of database tests and ensures the accuracy of database tests. The message queue is used to execute test statements in parallel, which improves the efficiency of database tests. At the same time, a comparison result is obtained based on the test results corresponding to the test statements with large coverage and the preset analysis report. The comparison result represents the consistency between the test result and the database information, which can help the staff to fill the loopholes of the database analysis product according to the comparison result, thereby improving the accuracy and convenience of functional testing of the database analysis product.

[0169] Figure 3 A flowchart of another method for testing a database analysis product provided by the present application is provided. The execution subject of the method may be a server, a host or other device, such as Figure 3 As shown, the method may include:

[0170] S301. Obtain the test result corresponding to the test statement.

[0171] See the test result in the above step S103, which will not be described again here.

[0172] S302: Display the test results and label information of the test statements on a visual interface so that the user can analyze the capabilities of the database.

[0173] Among them, the visualization interface may refer to an interface through which users can perform data processing. The visualization interface includes the execution results of the test statements and the label information of the test statements. The execution results of the test statements and the label information of the test statements may be presented in a graphical form, such as a chart, a line chart, a pie chart, a bar chart, a table, etc.

[0174] In an optional embodiment, the visualization interface allows the user to perform operations such as filtering, sorting, zooming, etc. to analyze the test results from different angles and further analyze the capabilities of the database.

[0175] At the same time, tag information can be used to classify and filter test statements, quickly find specific types of test statements or trace the content of test statements.

[0176] Another method for testing a database analysis product provided by the present application integrates the execution results of the test statements and their label information and displays them on a visual interface, so that users can intuitively and efficiently analyze and evaluate the performance and stability of the database, that is, the capacity of the database, so as to make more accurate optimization decisions and improve the efficiency and effectiveness of database management. At the same time, the accuracy of the database test is also enhanced, and then the test results of the database can be compared with the analysis report of the database analysis product to obtain the comparison results, which characterize the consistency between the test results and the database information. Another method for testing a database analysis product provided by the present application improves the accuracy and convenience of the functional testing of the database analysis product.

[0177] Figure 4 This is a flowchart of another method for testing a database analysis product provided by the present application. The execution subject of the method can be a server, a host or other device, such as Figure 4 As shown, the method may include:

[0178] S401. In response to a user's test instruction for a database, a statement template of a common statement is obtained from a preset test statement library, which is a template statement; the template statement is in the form of a structured query language SQL statement.

[0179] Exemplarily, the template statement may be expressed as SELECT{column_name}from{table_name}, wherein column_name represents variable information corresponding to the column name, and table_name represents variable information corresponding to the table name.

[0180] S402: Obtain a statement to be tested according to a template statement and a preset tag, and cache the statement to be tested in a message queue; the statement to be tested may include at least one of a general statement to be tested, an abnormal statement to be tested, and a custom statement to be tested.

[0181] For example, the statement to be tested may be expressed as / *labelkey1=AbCd1234* / SELECT{column_name}from{table_name};

[0182] Or the statement to be tested can be expressed as / *labelkey1=labelvalue2,labelkey2=deadlock* / START TRANSACTION;SELECT*FROM{table_name}WHERE{column_name}=1FOR UPDATE;DO SLEEP(5);SELECT*FROM{table_name}WHERE{column_name}=2FOR UPDATE;COMMIT;

[0183] Or the statement to be tested can be expressed as / *labelkey1=labelvalue6, labelkey2=000000* / SELECT{column_name}from{table_name}.

[0184] S403. According to the attribute information of the database, obtain the statement to be tested from the message queue, obtain the target test statement, execute the target test statement, and obtain the test result of the target test statement.

[0185] For example, the target test statement may be expressed as / *labelkey1=AbCd1234* / SELECTcolumn1from table1;

[0186] Or the statement to be tested can be expressed as / *labelkey1=labelvalue2,labelkey2=deadlock* / START TRANSACTION;SELECT*FROM table1 WHERE column1=1FOR UPDATE;DOSLEEP(5);SELECT*FROM table1 WHERE column1=2FOR UPDATE;COMMIT;

[0187] Or the statement to be tested can be expressed as / *labelkey1=labelvalue6, labelkey2=000000* / SELECT column2 from table2.

[0188] S404. Obtain a comparison result based on the test result of the target test statement and a preset analysis report; wherein the preset analysis report is database information obtained by analyzing the database with a preset database analysis product, and the comparison result represents the consistency between the test result and the database information.

[0189] This step refers to the above step S104 and will not be described in detail.

[0190] The present application provides a testing method for a database analysis product. By constructing common test statements, abnormal test statements, and custom test statements and caching them in a message queue, the diversity of test statements improves the coverage of database testing and ensures the accuracy of database testing. Message queues are used to execute test statements in parallel, thereby improving the efficiency of database testing. At the same time, comparison results are obtained based on the test results corresponding to test statements with large coverage and preset analysis reports. The comparison results represent the consistency between the test results and the database information, which can help staff to fill in the gaps in the database analysis product according to the comparison results, thereby improving the accuracy and convenience of functional testing of the database analysis product.

[0191] Figure 5 A schematic diagram of the test framework for the database provided for this application is shown in FIG. Figure 5 As shown, the test framework for the database may include: a builder, a message queue, and an executor.

[0192] Among them, the builder can be used to respond to the user's test instructions for the database, obtain the statement template of the general statement from the preset test statement library, which is a template statement; the template statement is in the form of a structured query language SQL statement; according to the template statement and the preset label, the statement to be tested is obtained, and the statement to be tested is cached in the message queue; the statement to be tested can include at least one of a general statement to be tested, an abnormal statement to be tested, and a custom statement to be tested.

[0193] The user may be user A, user B, user C, ..., user N, which correspond to message queue 1, message queue 2, message queue 3, ..., message queue N, respectively.

[0194] Message queues can be used to cache test statements, see Figure 3 The message queue in will not be described in detail.

[0195] The executor can be used to obtain the statement to be tested from the message queue according to the attribute information of the database, obtain the target test statement and execute the target test statement.

[0196] The database testing framework provided by the present application not only improves the efficiency of database testing, but also makes database testing more accurate and automated by integrating the builder, message queue and executor, and dividing the work between the builder and the executor.

[0197] Figure 6 A schematic diagram of the structure of a test device for a database analysis product provided in this application, such as Figure 6 As shown, the database testing device 60 includes: an acquisition unit 601 , a construction unit 602 , an execution unit 603 , and a comparison unit 604 .

[0198] The acquisition unit 601 is used to acquire the attribute information of the database in response to the user's test instruction on the database;

[0199] The construction unit 602 is used to construct a test statement of the database according to the attribute information of the database; wherein the test statement is in the form of a structured query language SQL statement;

[0200] The execution unit 603 is used to cache the test statement into the message queue, obtain the test statement from the message queue, execute the test statement, and obtain the test result of the test statement.

[0201] The comparison unit 604 is used to obtain a comparison result based on the test result of the test statement and a preset analysis report; wherein the preset analysis report is the database information obtained by analyzing the database with a preset database analysis product, and the comparison result represents the consistency between the test result and the database information.

[0202] Figure 7 A schematic diagram of the structure of another test device for a database analysis product provided by the present application, such as Figure 7 As shown, the database testing device 70 includes: an acquisition unit 701 , a construction unit 702 , an execution unit 703 , and a comparison unit 704 , wherein the construction unit 702 further includes a first processing module 7021 and a second processing module 7022 .

[0203] The first processing module 7021 is used to construct an initial test statement according to the attribute information of the database, and generate label information corresponding to the initial test statement according to a preset random algorithm.

[0204] The second processing module 7022 is used to obtain the test statement of the database according to the initial test statement and label information.

[0205] Exemplarily, the first processing module 7021 is further configured to obtain a statement template of a common statement from a preset test statement library; and adjust variable information in the statement template according to attribute information of the database to obtain an initial test statement.

[0206] Exemplarily, the test statement of the database is an abnormal statement, which represents a test statement that tests a preset test type, and the preset test type includes at least one of a deadlock type and a slow query type. The second processing module 7022 is also used to determine the test type corresponding to the initial test statement, and determine the type identifier associated with the test type corresponding to the initial test statement; obtain the test statement of the database according to the initial test statement, label information, and type identifier.

[0207] Exemplarily, the test statement of the database is a custom statement, which represents a custom test statement. The first processing module 7021 is further used to construct an initial test statement according to the basic information of the database and based on the user's SQL statement editing instruction.

[0208] Exemplarily, after executing the test statement, a display unit 705 is further included, which is used to obtain the test result corresponding to the test statement;

[0209] The test results and label information of the test statements are displayed on a visual interface so that users can analyze the capabilities of the database.

[0210] Exemplarily, the execution unit 703 is further configured to obtain user identification information from the test instruction and determine a message queue corresponding to the user identification information;

[0211] The test statement is cached in the message queue corresponding to the user identification information.

[0212] Figure 8 A schematic diagram of the structure of the electronic device provided in this application, such as Figure 8 As shown, the electronic device 80 provided in this embodiment includes: at least one processor 801 and a memory 802. Optionally, the device 80 also includes a communication component 803. The processor 801, the memory 802 and the communication component 803 are connected via a bus 804.

[0213] In a specific implementation process, at least one processor 801 executes the computer-executable instructions stored in the memory 802, so that at least one processor 801 executes the above method.

[0214] The specific implementation process of the processor 801 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0215] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0216] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0217] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0218] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0219] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0220] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0221] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0222] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0223] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

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

[0225] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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 storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. 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, etc. Various media that can store program codes.

[0226] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0227] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A method for testing a database analysis product, characterized in that: include: In response to a user's test instruction for a database, acquiring attribute information of the database; Constructing a test statement of the database according to the attribute information of the database; wherein the test statement is in the form of a structured query language SQL statement; Cache the test statement in a message queue, obtain the test statement from the message queue, execute the test statement, and obtain a test result of the test statement; A comparison result is obtained based on the test result of the test statement and a preset analysis report; wherein the preset analysis report is database information obtained by analyzing the database with a preset database analysis product, and the comparison result represents the consistency between the test result and the database information.

2. The method according to claim 1, characterized in that Constructing a test statement for the database according to the attribute information of the database, including: Constructing an initial test statement according to the attribute information of the database, and generating label information corresponding to the initial test statement according to a preset random algorithm; A test statement of the database is obtained according to the initial test statement and the label information.

3. The method according to claim 2, characterized in that According to the attribute information of the database, an initial test statement is constructed, including: Get statement templates of common statements from the preset test statement library; According to the attribute information of the database, the variable information in the statement template is adjusted to obtain the initial test statement.

4. The method according to claim 3, characterized in that The test statement of the database is an abnormal statement, and the abnormal statement represents a test statement for testing a preset test type, and the preset test type includes at least one of a deadlock type, a slow query type, a large transaction type, a long transaction type, and an index failure type; Obtaining a test statement of the database according to the initial test statement and the label information includes: Determining a test type corresponding to the initial test statement, and determining a type identifier associated with the test type corresponding to the initial test statement; A test statement of the database is obtained according to the initial test statement, the label information, and the type identifier.

5. The method according to claim 4, characterized in that The test statement of the database is a custom statement, and the custom statement represents a custom test statement; constructing an initial test statement according to the attribute information of the database includes: The initial test statement is constructed according to the basic information of the database and based on the SQL statement editing instruction of the user.

6. The method according to claim 5, characterized in that After executing the test statement, it also includes: Obtaining a test result corresponding to the test statement; The test results of the test statements and the tag information are displayed on a visual interface so that the user can analyze the capabilities of the database.

7. The method according to any one of claims 1 to 6, characterized in that Caching the test statement in a message queue includes: Acquire user identification information from the test instruction, and determine a message queue corresponding to the user identification information; The test statement is cached in a message queue corresponding to the user identification information.

8. A testing device for a database analysis product, characterized in that: include: An acquisition unit, configured to acquire attribute information of the database in response to a user's test instruction on the database; A construction unit, configured to construct a test statement of the database according to the attribute information of the database; wherein the test statement is in the form of a structured query language SQL statement; An execution unit, which caches the test statement into a message queue, obtains the test statement from the message queue, executes the test statement, and obtains a test result of the test statement; A comparison unit is used to obtain a comparison result based on the test result of the test statement and a preset analysis report; wherein the preset analysis report is database information obtained by analyzing the database with a preset database analysis product, and the comparison result represents the consistency between the test result and the database information.

9. An electronic device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.