CN117093471A - Method, device, equipment and storage medium for testing database storage process - Google Patents

Method, device, equipment and storage medium for testing database storage process Download PDF

Info

Publication number
CN117093471A
CN117093471A CN202310807701.5A CN202310807701A CN117093471A CN 117093471 A CN117093471 A CN 117093471A CN 202310807701 A CN202310807701 A CN 202310807701A CN 117093471 A CN117093471 A CN 117093471A
Authority
CN
China
Prior art keywords
database
storage process
data
converted
inconsistent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310807701.5A
Other languages
Chinese (zh)
Inventor
柯晓杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310807701.5A priority Critical patent/CN117093471A/en
Publication of CN117093471A publication Critical patent/CN117093471A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a method, a device, equipment and a storage medium for testing a database storage process, and relates to the technical field of big data. The method comprises the following steps: screening out a target storage process meeting calling conditions from the initial storage process of an original database corresponding to the converted database; reading out the current test case from a to-be-verified queue formed by the test cases related to the target storage process, and executing the current test case in the two databases respectively to obtain data execution results of the two databases; recording and rolling back the two databases under the condition that the execution results of the two data are inconsistent; and reading the next test case from the queue to be verified, taking the next test case as a new current test case, and jumping to the step of executing the current test case in the two databases respectively to obtain the data execution results of the two databases until the queue to be verified is empty to obtain the test result. By adopting the method, the testing efficiency of the double-database storage process can be improved.

Description

Method, device, equipment and storage medium for testing database storage process
Technical Field
The present application relates to the field of big data technology, and in particular, to a method, an apparatus, a computer device, a storage medium, and a computer program product for testing a database storage process.
Background
With the increasing demands of current financial enterprises for informatization transformation, more and more financial enterprises begin to change from using Oracle databases (a relational database) to using Oracle-compatible domestic Gauss databases (a distributed relational database). In addition to converting objects such as tables, indexes, sequences, views, etc., it is necessary to convert and verify stored procedure objects when performing database conversion. Because the code of the storage process is complex and numerous, the workload of manually performing conversion verification is extremely large and difficult. Therefore, the checksum automatic test device for the storage process after database conversion is lacking.
In the prior art, by automatically testing the storage process of a single database, the object for performing verification comparison test is the test result and the expected result of the single database.
However, the current test mode for the double-database storage process mainly passes the manual verification test, and the process is complicated, so that the test efficiency is low.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for testing a database storage procedure that enables dual database automatic testing and improves testing efficiency.
In a first aspect, the present application provides a method for testing a database storage process. The method comprises the following steps:
screening out a target storage process meeting calling conditions from the initial storage process of an original database corresponding to the converted database; the converted database is consistent with the testing environment of the original database;
reading a current test case from a to-be-verified queue formed by test cases related to the target storage process, and executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database;
recording inconsistent data execution results under the condition that the data execution results of the original database and the converted database are inconsistent, and performing rollback operation on the original database and the converted database;
Reading a next test case of the current test case from the queue to be verified, taking the next test case as a new current test case, and jumping to the step of executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database until the queue to be verified is empty;
and obtaining a test result according to the inconsistent data execution result recorded each time.
In one embodiment, before screening the target storage process that meets the call condition from the initial storage process of the original database corresponding to the converted database, the method further includes:
before screening out the target storage process meeting the calling condition from the initial storage process of the original database corresponding to the converted database, the method further comprises the following steps:
inquiring a non-system storage process from the original database through a corresponding data inquiry statement;
screening out a storage process matched with the test request from the non-system storage process, and taking the storage process as the initial storage process.
In one embodiment, the screening the target storage process that meets the call condition from the initial storage process of the original database corresponding to the converted database includes:
carrying out smoking test on each storage process in the initial storage process to obtain smoking test results of each storage process;
screening a storage process which can be called by the converted database from the initial storage process according to the smoking test result, and taking the storage process as a target storage process meeting a calling condition;
after screening out the target storage process meeting the call condition from the initial storage process of the original database corresponding to the converted database, the method further comprises the following steps:
and rolling back the storage process after the smoking test is completed.
In one embodiment, before the current test case is read out from the to-be-verified queue formed by the test cases associated with the target storage process, the method further includes:
acquiring a test case associated with the target storage process; the test case comprises parameter entering parameters and an initialization data manipulation statement of the target storage process;
and combining the test cases related to the target storage process according to the screening sequence of the target storage process to obtain the queue to be verified.
In one embodiment, the executing the current test case in the original database and the converted database respectively, to obtain a data execution result of the original database and a data execution result of the converted database, includes:
executing an initialization data manipulation statement in the current test case in the original database and the converted database respectively to obtain current parameter entering parameters of the original database and the converted database;
based on the current parameter, respectively calling the storage processes corresponding to the current test case in the original database and the converted database, and performing table data modification operation or file data generation operation to obtain table data or file data related to the original database and table data or file data related to the converted database;
and taking the table data or the file data related to the original database as a data execution result of the original database, and taking the table data or the file data related to the converted database as a data execution result of the converted database.
In one embodiment, when the data execution result of the original database and the data execution result of the converted database are inconsistent, before recording the inconsistent data execution result, the method further includes:
when the table data related to the original database is inconsistent with the table data related to the converted database, confirming that the data execution result of the original database is inconsistent with the data execution result of the converted database;
or if the file data related to the original database is inconsistent with the file data related to the converted database, confirming that the data execution result of the original database is inconsistent with the data execution result of the converted database.
In one embodiment, after the test result is obtained according to the inconsistent data execution result recorded each time, the method further comprises:
screening records with inconsistent table data and records with inconsistent file data from the test results;
generating a list of inconsistent table data according to the record of inconsistent table data, and generating a list of inconsistent file data according to the record of inconsistent file data;
And generating a test report according to the list of inconsistent table data and the list of inconsistent file data.
In a second aspect, the application further provides a testing device for the database storage process. The device comprises:
the process screening module is used for screening out a target storage process meeting the calling condition from the initial storage process of the original database corresponding to the converted database; the converted database is consistent with the testing environment of the original database;
the case execution module is used for reading a current test case from a to-be-verified queue formed by test cases related to the target storage process, and executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database;
the result recording module is used for recording inconsistent data execution results and performing rollback operation on the original database and the converted database under the condition that the data execution results of the original database and the converted database are inconsistent;
the loop execution module is used for reading a next test case of the current test case from the queue to be verified, taking the next test case as a new current test case, and jumping to the step of executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database until the queue to be verified is empty;
And the result determining module is used for executing the result according to the inconsistent data recorded each time to obtain a test result.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
screening out a target storage process meeting calling conditions from the initial storage process of an original database corresponding to the converted database; the converted database is consistent with the testing environment of the original database;
reading a current test case from a to-be-verified queue formed by test cases related to the target storage process, and executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database;
recording inconsistent data execution results under the condition that the data execution results of the original database and the converted database are inconsistent, and performing rollback operation on the original database and the converted database;
Reading a next test case of the current test case from the queue to be verified, taking the next test case as a new current test case, and jumping to the step of executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database until the queue to be verified is empty;
and obtaining a test result according to the inconsistent data execution result recorded each time.
In a fourth aspect, the present application also provides a computer-readable storage medium. A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
screening out a target storage process meeting calling conditions from the initial storage process of an original database corresponding to the converted database; the converted database is consistent with the testing environment of the original database;
reading a current test case from a to-be-verified queue formed by test cases related to the target storage process, and executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database;
Recording inconsistent data execution results under the condition that the data execution results of the original database and the converted database are inconsistent, and performing rollback operation on the original database and the converted database;
reading a next test case of the current test case from the queue to be verified, taking the next test case as a new current test case, and jumping to the step of executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database until the queue to be verified is empty;
and obtaining a test result according to the inconsistent data execution result recorded each time.
In a fifth aspect, the present application also provides a computer program product. Computer program product comprising a computer program which, when executed by a processor, realizes the steps of:
screening out a target storage process meeting calling conditions from the initial storage process of an original database corresponding to the converted database; the converted database is consistent with the testing environment of the original database;
Reading a current test case from a to-be-verified queue formed by test cases related to the target storage process, and executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database;
recording inconsistent data execution results under the condition that the data execution results of the original database and the converted database are inconsistent, and performing rollback operation on the original database and the converted database;
reading a next test case of the current test case from the queue to be verified, taking the next test case as a new current test case, and jumping to the step of executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database until the queue to be verified is empty;
and obtaining a test result according to the inconsistent data execution result recorded each time.
According to the method, the device, the computer equipment, the storage medium and the computer program product for testing the database storage process, the screened test cases related to the target storage process are respectively executed in the converted database and the original database to obtain the data execution result, then the data execution result is compared and checked, rollback recording is carried out on the condition that the data execution result is inconsistent, and manual checking is not needed in the whole process, so that the automatic test purpose of the storage process of the double databases is realized, and the test efficiency is further improved.
Drawings
FIG. 1 is an application environment diagram of a test method for a database storage process in one embodiment;
FIG. 2 is a flow diagram of a method of testing a database storage process in one embodiment;
FIG. 3 is a flow diagram that illustrates the steps of a screening target storage process in one embodiment;
FIG. 4 is a flow chart of a method of testing a database storage process in another embodiment;
FIG. 5 is a block diagram of a test setup for a database storage process in one embodiment;
fig. 6 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The method for testing the database storage process provided by the embodiment of the application can be applied to an application environment shown in fig. 1. The server 102 screens out a target storage process meeting the calling condition from the initial storage process of the original database; and reading the current test case from the to-be-verified queue formed by the test cases associated with the target storage process, executing the current test case in the original database 104 and the converted database 106 respectively, and obtaining a data execution result. Then, the server 102 obtains the data execution result of the original database 104 and the data execution result of the converted database 106, compares the execution results of the original database 104 and the converted database 106, records the inconsistent data execution result if the execution results are inconsistent, and performs rollback operation on the original database 104 and the converted database 106. The server 102 reads the next test case of the current test case from the queue to be verified, takes the next test case as a new current test case, and jumps to the step of executing the current test case in the original database and the converted database respectively to obtain the data execution result of the original database 104 and the data execution result of the converted database 106 until the queue to be verified is empty. And the server obtains a test result according to the recorded inconsistent data execution result. The server 102 may be implemented as a stand-alone server or a server cluster including a plurality of servers.
In one embodiment, as shown in fig. 2, a method for testing a database storage process is provided, and the method is applied to the server in fig. 1 for illustration, and includes the following steps:
step S202, screening out a target storage process meeting the calling condition from the initial storage process of an original database corresponding to the converted database; the converted database is consistent with the testing environment of the original database. The converted database refers to a new database compatible with the original database used by enterprises. For example, financial enterprises have moved from using Oracle databases (a type of relational database) to using Oracle-compatible domestic Gauss databases (a type of distributed relational database). The initial storage process refers to the acquisition of a full-volume object list to be tested, namely, a full-volume storage process. The definition of the call condition is that the condition normally executed in the converted database can be satisfied. The test environment agreement specifically includes setting the table data of the two databases to be identical with the import file.
Optionally, the server screens out a storage process which can be normally executed in the converted database from the total storage process of the original database corresponding to the converted database as a target storage process, and synchronizes the table data related in the storage process of the converted database to be consistent with the original database through data synchronization. Wherein the data synchronization tool may use a data replication service synchronization tool. After initializing the table data, scanning whether file loading is involved in the storage process of the original database, if so, synchronizing the server files of the original database to the converted database server, and synchronously backing up the initialized files.
Step S204, reading out the current test case from the to-be-verified queue formed by the test cases related to the target storage process, and executing the current test case in the original database and the converted database respectively to obtain the data execution result of the original database and the data execution result of the converted database.
Wherein, the test cases associated with the target storage process refer to a plurality of test cases included in each target storage process. The target storage process A includes test cases A1, A2, etc. The execution result includes table data or file data involved in the database storage process.
Optionally, the server reads the current first test case from a to-be-verified queue formed by a plurality of test cases in the target storage process according to the arrangement sequence, executes the current first test case in the original database and the converted database respectively, and obtains data execution results of the original database and the converted database.
In step S206, when the data execution result of the original database and the data execution result of the converted database are inconsistent, the inconsistent data execution result is recorded, and the rollback operation is performed on the original database and the converted database.
The inconsistent execution result refers to the situation that the table data or the file data related in the storage process of the two databases are inconsistent after comparison. Rollback is defined as the act of restoring data to the most recent correct version when the data is in error.
Optionally, if the data execution result of the original database and the converted data execution result are inconsistent after comparison, the server reads the modification logs of the two databases and rolls back all the operations of the test, and rolls back the files of the two database servers in a mode of backing up the files and restoring the original files.
Step S208, reading the next test case of the current test case from the queue to be verified, taking the next test case as a new current test case, and jumping to the step of executing the current test case in the original database and the converted database respectively to obtain the data execution result of the original database and the data execution result of the converted database until the queue to be verified is empty.
After the execution result of the current test case is recorded, the execution result is removed from the queue to be verified.
Optionally, the server sequentially reads the next test case of the test case of which the current test is completed from the queue to be verified, takes the read next test case as a new current test case, jumps to the current test case of which the current test case is executed in the original database and the converted database respectively, and obtains the data execution result of the original database and the data execution result of the converted database, and circularly executes the steps from the reading of the test case to the obtaining of the execution result until all the test cases in the queue to be verified are tested.
Step S210, according to the inconsistent data execution result recorded each time, a test result is obtained.
Wherein the test results include data execution results for each test case, such as: and comparing the data execution result with the data execution result which is consistent with the check result and the data execution result which is inconsistent with the check result.
Optionally, the server determines the final test result according to the inconsistent data execution result recorded each time and the consistent data execution result.
According to the method for testing the database storage process, the test cases related to the screened target storage process are executed in the converted database and the original database respectively to obtain the data execution result, then the data execution result is subjected to comparison and verification, rollback recording is carried out on the condition that the data execution result is inconsistent, and manual verification is not needed in the whole process, so that the automatic test purpose of the storage process of the double databases is achieved, and the test efficiency is improved.
In one embodiment, the step S202, before screening the target storage procedure that meets the call condition from the initial storage procedure of the original database corresponding to the converted database, further includes:
And step 1, inquiring a non-system storage process from an original database through a corresponding data inquiry statement.
The data query statement is used for querying data in the database, namely the most commonly used select statement (basic query statement). Non-system stored procedures refer to mass stored procedure objects that are customized by a database user.
Optionally, the server queries the original database for the non-system full-scale stored procedure object by the data query statement.
And step 2, screening a storage process matched with the test request from a non-system storage process, and taking the storage process as an initial storage process.
The storage process matched with the test request can be a full-scale storage process under a non-system condition, or can be a storage process specified according to the test requirement of a tester, for example, only the storage process related under the current month edition is tested, the storage process which is already online is not specified, and the like.
Optionally, the server acquires the list of the objects to be tested from a storage process under a non-system, and the default storage process is a plurality of automatic tests, or the default storage process can be specified under the list by a tester according to the test requirement.
In this embodiment, the on-demand test is implemented by querying the full-scale storage process of the original database and screening the objects of the storage process to be tested according to the test requirements therefrom, thereby reducing unnecessary test workload.
In one embodiment, as shown in fig. 3, the step S202 is to screen out a target storage process that meets the call condition from the initial storage process of the original database corresponding to the converted database, and specifically includes the following steps:
step S302, carrying out smoking test on each storage process in the initial storage process to obtain smoking test results of each storage process.
The initial storage process of the original database comprises a plurality of storage processes. The definition of smoke test is a basic test in software tests, also called build verification test, which is usually used to confirm whether a new version of software can be subjected to basic functional tests or can be started normally. Its main purpose is to verify quickly before the software release whether the key functions of the system can function properly.
Optionally, the server performs a smoke test on each storage procedure in the initial storage of the original database, where the smoke test specifically includes: and carrying out unilateral call on each storage process at the converted database side, and obtaining a smoking test result of each storage process after the call is completed, wherein the storage process can be normally called, the storage process call process is overtime, errors are reported in the storage process call process, such as the storage process is not existed, the database password error and the parameter entering quantity are inconsistent, and the like.
Step S304, screening the storage process which can be called by the converted database from the initial storage process according to the smoking test result, and taking the storage process as the target storage process which meets the calling condition.
The condition that the calling condition is met means that the storage process meets the condition that the database side can be normally called after conversion, and the calling process is not overtime and is not wrong.
Optionally, the server excludes the storage process with overtime and error reporting as the smoking test result from the initial storage process according to the smoking test result of each storage process, and the rest storage processes are used as target storage processes meeting the calling condition after the storage process is excluded.
Step S306, performing rollback operation on the storage process after the smoking test is completed.
The rollback operation refers to recovering the data involved in the storage process passing the smoking test to the data before the test.
Optionally, the server performs a data rollback operation on the stored procedure that passed the smoke test, keeping the data consistent with that before the smoke test.
In this embodiment, the effect of eliminating the interference factors such as the definition problem of the database storage process, the database environmental problem, and the network problem after conversion is achieved by screening the target storage process meeting the call condition from the original database through the smoke test and performing the rollback operation on the target storage process.
In one embodiment, the step S204 further includes the following before the current test case is read from the to-be-verified queue formed by the test cases associated with the target storage procedure:
step 1, obtaining a test case related to a target storage process; the test cases include the parameters of the target storage process and the initialization data manipulation statements.
The parameter input refers to input parameters, such as input date, name, etc. The purpose of initializing the data manipulation statement is to modify a configuration table, parameters, to control the storage process into various branches.
Optionally, in the multiple test cases under the target storage process acquired by the server, each test case is composed of two parts, one part is a parameter of the storage process, and the other part controls the input of the storage process; another part is to initialize a data manipulation statement that is executed in the original database, and subsequently synchronize the modification to the transformed database to stay consistent.
And step 2, combining the test cases related to the target storage process according to the screening sequence of the target storage process to obtain a queue to be verified.
The target storage process passes through the screening sequence, namely the sequence that each storage process passes through the smoking test under the initial storage process.
The initial storage process comprises a storage process A, a storage process B and a storage process C, the server sequentially performs smoking test on the three storage processes, and if the storage process A passes the smoking test, a test case A1 and a test case A2 in the storage process A are inserted into a queue to be verified; the smoking failure in the storage process B is not inserted into the queue to be verified; the storage process C inserts the test cases C1 and C2 in the storage process C into a queue to be verified through smoking test to form the queue to be verified: test case A1, test case A2, test case C1, test case C2.
In the embodiment, the input of the control storage process is realized by limiting the test case composition related to the target test and setting the parameter entry, and the initialization data manipulation statement ensures that the two database test environments are identical; by limiting the combination rule of the queue to be verified, the accurate and orderly test is ensured.
In one embodiment, the step S204 is executed to execute the current test case in the original database and the converted database, to obtain the data execution result of the original database and the data execution result of the converted database, and specifically includes the following contents:
Step 1, executing an initialized data manipulation statement in a current test case in an original database and a converted database respectively to obtain current parameter entering parameters of the original database and the converted database;
the current parameter is the parameter corresponding to the current test case, and the same parameter is used in the calling process.
Optionally, the server executes the initialized data manipulation statement in the current test case in the original database and the converted database respectively to obtain the current parameter of the original data and the converted database.
And 2, respectively calling the storage processes corresponding to the current test cases in the original database and the converted database based on the current parameter, and performing table data modification operation or file data generation operation to obtain table data or file data related to the original database and table data or file data related to the converted database.
The storage process corresponding to the current test case is generated after the database executes the test case.
Optionally, according to the obtained parameter, the same name storage process corresponding to the current test case in the original database and the converted database is respectively called, the table data modification or the file data generation operation is performed in the storage process, the table data or the file data related in the storage process of the original database is recorded, and the table data or the file data related in the storage process of the converted database is recorded.
And 3, taking the table data or the file data related to the original database as a data execution result of the original database, and taking the table data or the file data related to the converted database as a data execution result of the converted database.
Wherein the execution results include modified table data or generated files involved in the storing of the calls to execute the test cases.
Optionally, the server triggers and calls the homonymous storage process corresponding to the current test case in the original database and the converted database, records the table data related to the storage process, and the running start time and the running end time of the table data; storing the operation result and the modified table data into a backup table with the same table structure after the operation is finished, storing files generated in the storage process, and recording the operation time.
In this embodiment, by executing the test script to execute the same test case in the two databases and recording the execution result, the process of converting, verifying and testing the stored process object can be simplified, and the test efficiency is improved.
In one embodiment, the step S206 further includes the following steps before recording the inconsistent data execution result if the data execution result of the original database and the data execution result of the converted database are inconsistent:
Under the condition that the table data related to the original database is inconsistent with the table data related to the converted database, confirming that the data execution result of the original database is inconsistent with the data execution result of the converted database; or when the file data related to the original database is inconsistent with the file data related to the converted database, confirming that the data execution result of the original database is inconsistent with the data execution result of the converted database.
The condition of inconsistent table data is whether the modified table data are consistent or not after the two databases run and store processes are compared; the case of inconsistent document data is related to whether there is a difference in document contents by a document comparing tool such as a Beyond computer (a professional text document comparing tool).
Optionally, the server compares the table data related in the corresponding storage process of the original database and the converted database execution test cases respectively, and if the table data are inconsistent, the data execution result of the original database and the data execution result of the converted database are inconsistent; and comparing the file data generated in the storage process corresponding to the execution test cases of the original database and the converted database respectively, and if the file data are inconsistent, determining that the data execution result of the original database is inconsistent with the data execution result after conversion.
In this embodiment, by comparing the table data and the file related to the recorded test cases executed by the two databases, the situation that whether the data execution results of the two databases are consistent is determined according to the two situations, so that the effect of making the test process more rigorous is achieved.
In one embodiment, step S210 in the foregoing embodiment further includes, after performing the result according to each recorded inconsistent data, obtaining a test result:
and step 1, screening out records with inconsistent table data and records with inconsistent file data from the test results.
The test result is to execute the current test case in the original database and the converted database respectively, call the corresponding storage process, and record the table data and the file data related to the storage process.
Optionally, the server queries whether the result table data of the original database and the converted database are consistent with each other by using a stream from the test result, compares whether the file data are consistent with each other by using a file comparison tool, and screens out records inconsistent with the table data and records inconsistent with the file data.
And 2, generating a table data inconsistent list according to the record of the table data inconsistent, and generating a file data inconsistent list according to the record of the file data inconsistent.
The list comprises test case items corresponding to inconsistent table data or inconsistent file data in the data execution result.
Optionally, the server generates a list of entries of inconsistent table data for inconsistent table data in the test case corresponding data execution result, and generates a list of inconsistent file data entries of inconsistent file data in the test case corresponding data execution result.
And step 3, generating a test report according to the table data inconsistent list and the file data inconsistent list.
The test report comprises data execution results of all test cases, including a list of test case items with consistent data execution results and inconsistent data execution results.
Optionally, the server adds the test case comparison result to a test report, the test report containing a list of inconsistent table data entries, the file generating a list of inconsistent entries.
In this embodiment, the recorded data execution results are screened out to generate an entry list, and the entry list is added into a test report, so as to achieve the effect of facilitating the problem analysis of developers.
In one embodiment, as shown in fig. 4, another method for testing a database storage process is provided, which specifically includes the following steps:
Step S402, inquiring a non-system storage process from an original database through a corresponding data inquiry statement; screening out the storage process matched with the test request from the non-system storage process, and taking the storage process as an initial storage process.
Specifically, the server queries a full-quantity storage process object under the non-system in the original database through the data query statement, acquires a list of objects to be tested from the storage process under the non-system, and performs automatic test on a plurality of default storage processes in full quantity or can be specified under the list by a tester according to the test requirement.
Step S404, initializing the original database and the converted database, and ensuring the consistency of the test environments of the two databases.
Specifically, the server synchronizes the table data involved in the storing process of the converted database to be consistent with the original database through data synchronization. Wherein the data synchronization tool may use a data replication service synchronization tool. After initializing the table data, scanning whether file loading is involved in the storage process of the original database, if so, synchronizing the server files of the original database to the converted database server, and synchronously backing up the initialized files.
Step S406, each storage process in the initial storage process performs a smoking test to obtain a smoking test result of each storage process; screening a storage process which can be called by the converted database from the initial storage process according to the smoking test result, and taking the storage process as a target storage process meeting the calling condition; acquiring a test case associated with a target storage process; the test case comprises parameter entering parameters of a target storage process and an initialized data manipulation statement; and combining the test cases related to the target storage process according to the screening sequence of the target storage process to obtain a queue to be verified.
Specifically, the server performs a smoke test on each storage process in the initial storage of the original database, where the smoke test specifically includes: and carrying out unilateral call on each storage process at the converted database side, and obtaining a smoking test result of each storage process after the call is completed, wherein the storage process can be normally called, the storage process call process is overtime, errors are reported in the storage process call process, such as the storage process is not existed, the database password error and the parameter entering quantity are inconsistent, and the like. And according to the smoking test result of each storage process, eliminating the storage process with overtime and error reporting as the smoking test result from the initial storage process, and eliminating the rest storage processes as target storage processes meeting the calling condition. And carrying out data rollback operation on the storage process passing the smoking test, and keeping the data consistent with the data before the smoking test. In the acquired multiple test cases under the target storage process, each test case is composed of two parts, one part is the parameter entering of the storage process, and the other part controls the input of the storage process; another part is to initialize a data manipulation statement that is executed in the original database, and subsequently synchronize the modification to the transformed database to stay consistent. The initial storage process comprises a storage process A, a storage process B and a storage process C, wherein the three storage processes are subjected to smoking test in sequence, and if the storage process A passes the smoking test, a test case A1 and a test case A2 in the storage process A are inserted into a queue to be verified; the smoking failure in the storage process B is not inserted into the queue to be verified; the storage process C inserts the test cases C1 and C2 in the storage process C into a queue to be verified through smoking test to form the queue to be verified: test case A1, test case A2, test case C1, test case C2.
Step S408, executing the initialized data manipulation statement in the current test case in the original database and the converted database respectively to obtain the current parameter of the original database and the converted database; based on the current parameter, respectively calling the storage processes corresponding to the current test cases in the original database and the converted database, and performing table data modification operation or file data generation operation to obtain table data or file data related to the original database and table data or file data related to the converted database; the table data or the file data related to the original database is used as the data execution result of the original database, and the table data or the file data related to the converted database is used as the data execution result of the converted database.
Specifically, the server executes an initialized data manipulation statement in a current test case in an original database and a converted database respectively to obtain current parameter entering parameters of the original database and the converted database, invokes homonymous storage processes corresponding to the current test case in the original database and the converted database respectively according to the obtained parameter entering parameters, carries out table data modification or file data generation operation in the storage process, and records table data or file data related in the storage process of the original database and table data or file data related in the storage process of the converted database. Triggering and calling the homonymous storage process corresponding to the current test case in the original database and the converted database, and recording the table data related to the storage process, and the running start time and the running end time of the table data; storing the operation result and the modified table data into a backup table with the same table structure after the operation is finished, storing files generated in the storage process, and recording the operation time.
Step S410, when the table data related to the original database is inconsistent with the table data related to the converted database, confirming that the data execution result of the original database is inconsistent with the data execution result of the converted database; or when the file data related to the original database is inconsistent with the file data related to the converted database, confirming that the data execution result of the original database is inconsistent with the data execution result of the converted database.
Specifically, the server compares the table data related in the corresponding storage process of the original database and the converted database execution test cases respectively, and if the table data are inconsistent, the data execution result of the original database and the data execution result of the converted database are inconsistent; and comparing the file data generated in the storage process corresponding to the execution test cases of the original database and the converted database respectively, and if the file data are inconsistent, determining that the data execution result of the original database is inconsistent with the data execution result after conversion. If the data execution results are consistent, rolling back is not performed, and if the data execution results are inconsistent, rolling back the inconsistent data.
Step S412, screening out records with inconsistent table data and records with inconsistent file data from the test results; generating a list of inconsistent table data according to the record of inconsistent table data, and generating a list of inconsistent file data according to the record of inconsistent file data; and generating a test report according to the list of inconsistent table data and the list of inconsistent file data.
Specifically, the server queries whether the result table data of the original database and the converted database are consistent or not by using a stream from the test result, compares whether the file data are consistent or not by using a file comparison tool, and screens out records inconsistent with the table data and records inconsistent with the file data. And generating a list of entries of inconsistent table data, which is inconsistent with table data, in the execution result of the corresponding data of the test case, and generating a list of inconsistent entries of file data, which is inconsistent with file data, in the execution result of the corresponding data of the test case. And adding the test case comparison result into a test report, wherein the test report comprises an inconsistent table data item list, and the file generates an inconsistent item list.
Step S414, repeating steps S408-S412 until the queue to be verified is empty.
Specifically, the server sequentially reads the next test case of the test case of which the current test is completed from the queue to be verified, takes the read next test case as a new current test case, jumps to the current test case of which the current test case is executed in the original database and the converted database respectively, and obtains the data execution result of the original database and the data execution result of the converted database, and circularly executes the steps from the reading of the test case to the obtaining of the data execution result until all the test cases in the queue to be verified are tested.
In this embodiment, the test cases related to the screened target storage process are executed in the converted database and the original database respectively to obtain the data execution result, then the data execution result is compared and checked, the rollback record is performed on the condition that the data execution result is inconsistent, and the whole process does not need manual check, so that the automatic test purpose of the storage process of the double databases is realized, and the test efficiency is improved.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a testing device for the database storage process, which is used for realizing the testing method of the database storage process. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of the test device for one or more database storage processes provided below may be referred to the limitation of the test method for the database storage process hereinabove, and will not be repeated herein.
In one embodiment, as shown in FIG. 5, there is provided a test apparatus 500 for a database storage process, comprising: a process screening module 502, a case execution module 504, a result logging module 506, a loop execution module 508, and a result determination module 510, wherein:
the process screening module 502 is configured to screen a target storage process that meets the call condition from an initial storage process of an original database corresponding to the converted database; the converted database is consistent with the testing environment of the original database.
The case execution module 504 is configured to read a current test case from a to-be-verified queue formed by test cases associated with a target storage process, and execute the current test case in the original database and the converted database respectively, so as to obtain a data execution result of the original database and a data execution result of the converted database.
And a result recording module 506, configured to record, when the data execution result of the original database and the data execution result of the converted database are inconsistent, the inconsistent data execution result, and perform a rollback operation on the original database and the converted database.
The loop execution module 508 is configured to read a next test case of the current test case from the queue to be verified, take the next test case as a new current test case, and jump to a step of executing the current test case in the original database and the converted database respectively, so as to obtain a data execution result of the original database and a data execution result of the converted database, until the queue to be verified is empty.
The result determining module 510 is configured to perform a result according to the inconsistent data recorded each time, and obtain a test result.
In one embodiment, the testing apparatus 500 for database storage processes further includes an initial screening module, configured to query the original database for non-system storage processes through corresponding data query statements; screening out the storage process matched with the test request from the non-system storage process, and taking the storage process as an initial storage process.
In one embodiment, the process screening module 502 is further configured to perform a smoke test on each storage process in the initial storage process, to obtain a smoke test result of each storage process; and screening the storage process which can be called by the converted database from the initial storage process according to the smoking test result, and taking the storage process as a target storage process meeting the calling condition.
The database storage process testing device 500 further includes a rollback operation module, configured to perform a rollback operation on the storage process after the smoking test is completed.
In one embodiment, the test apparatus 500 of the database storage process further includes a queue determination module for obtaining test cases associated with the target storage process; the test case comprises parameter entering parameters of a target storage process and an initialized data manipulation statement; and combining the test cases related to the target storage process according to the screening sequence of the target storage process to obtain a queue to be verified.
In one embodiment, the case execution module 504 is further configured to execute the initialized data manipulation statement in the current test case in the original database and the converted database, respectively, to obtain current parameter entering parameters of the original database and the converted database; based on the current parameter, respectively calling the storage processes corresponding to the current test cases in the original database and the converted database, and performing table data modification operation or file data generation operation to obtain table data or file data related to the original database and table data or file data related to the converted database; the table data or the file data related to the original database is used as the data execution result of the original database, and the table data or the file data related to the converted database is used as the data execution result of the converted database.
In one embodiment, the test device 500 for database storage process further includes a result comparison module, configured to confirm that the data execution result of the original database and the data execution result of the converted database are inconsistent in the case that the table data related to the original database is inconsistent with the table data related to the converted database; or when the file data related to the original database is inconsistent with the file data related to the converted database, confirming that the data execution result of the original database is inconsistent with the data execution result of the converted database.
In one embodiment, the test device 500 of the database storage process further includes a report generating module, configured to filter out records inconsistent with table data and records inconsistent with file data from the test results; generating a list of inconsistent table data according to the record of inconsistent table data, and generating a list of inconsistent file data according to the record of inconsistent file data; and generating a test report according to the list of inconsistent table data and the list of inconsistent file data.
The various modules in the database storage process testing apparatus described above may be implemented in whole or in part in software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing table data and file data related in the corresponding storage process and relevant data of the comparison condition of the data execution result when the original database and the converted database execute test cases respectively. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method of testing a database storage process.
It will be appreciated by those skilled in the art that the structure shown in FIG. 6 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (11)

1. A method for testing a database storage process, the method comprising:
screening out a target storage process meeting calling conditions from the initial storage process of an original database corresponding to the converted database; the converted database is consistent with the testing environment of the original database;
reading a current test case from a to-be-verified queue formed by test cases related to the target storage process, and executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database;
Recording inconsistent data execution results under the condition that the data execution results of the original database and the converted database are inconsistent, and performing rollback operation on the original database and the converted database;
reading a next test case of the current test case from the queue to be verified, taking the next test case as a new current test case, and jumping to the step of executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database until the queue to be verified is empty;
and obtaining a test result according to the inconsistent data execution result recorded each time.
2. The method according to claim 1, further comprising, before screening out a target storage procedure satisfying the call condition from an initial storage procedure of an original database corresponding to the converted database:
inquiring a non-system storage process from the original database through a corresponding data inquiry statement;
screening out a storage process matched with the test request from the non-system storage process, and taking the storage process as the initial storage process.
3. The method according to claim 1, wherein the screening out the target storage procedure satisfying the call condition from the initial storage procedure of the original database corresponding to the converted database comprises:
carrying out smoking test on each storage process in the initial storage process to obtain smoking test results of each storage process;
screening a storage process which can be called by the converted database from the initial storage process according to the smoking test result, and taking the storage process as a target storage process meeting a calling condition;
after screening out the target storage process meeting the call condition from the initial storage process of the original database corresponding to the converted database, the method further comprises the following steps:
and rolling back the storage process after the smoking test is completed.
4. The method of claim 1, further comprising, prior to reading a current test case from a to-be-validated queue of test cases associated with the target stored procedure:
acquiring a test case associated with the target storage process; the test case comprises parameter entering parameters and an initialization data manipulation statement of the target storage process;
And combining the test cases related to the target storage process according to the screening sequence of the target storage process to obtain the queue to be verified.
5. The method of claim 1, wherein the executing the current test case in the original database and the converted database, respectively, results in a data execution result for the original database and a data execution result for the converted database, comprising:
executing an initialization data manipulation statement in the current test case in the original database and the converted database respectively to obtain current parameter entering parameters of the original database and the converted database;
based on the current parameter, respectively calling the storage processes corresponding to the current test case in the original database and the converted database, and performing table data modification operation or file data generation operation to obtain table data or file data related to the original database and table data or file data related to the converted database;
and taking the table data or the file data related to the original database as a data execution result of the original database, and taking the table data or the file data related to the converted database as a data execution result of the converted database.
6. The method according to claim 5, wherein, in the case where the data execution result of the original database and the data execution result of the converted database are inconsistent, before recording the inconsistent data execution result, further comprising:
when the table data related to the original database is inconsistent with the table data related to the converted database, confirming that the data execution result of the original database is inconsistent with the data execution result of the converted database;
or if the file data related to the original database is inconsistent with the file data related to the converted database, confirming that the data execution result of the original database is inconsistent with the data execution result of the converted database.
7. The method of claim 6, further comprising, after performing the result based on each recorded inconsistent data, after obtaining the test result:
screening records with inconsistent table data and records with inconsistent file data from the test results;
generating a list of inconsistent table data according to the record of inconsistent table data, and generating a list of inconsistent file data according to the record of inconsistent file data;
And generating a test report according to the list of inconsistent table data and the list of inconsistent file data.
8. A device for testing a database stored procedure, the device comprising:
the process screening module is used for screening out a target storage process meeting the calling condition from the initial storage process of the original database corresponding to the converted database; the converted database is consistent with the testing environment of the original database;
the case execution module is used for reading a current test case from a to-be-verified queue formed by test cases related to the target storage process, and executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database;
the result recording module is used for recording inconsistent data execution results and performing rollback operation on the original database and the converted database under the condition that the data execution results of the original database and the converted database are inconsistent;
the loop execution module is used for reading a next test case of the current test case from the queue to be verified, taking the next test case as a new current test case, and jumping to the step of executing the current test case in the original database and the converted database respectively to obtain a data execution result of the original database and a data execution result of the converted database until the queue to be verified is empty;
And the result determining module is used for executing the result according to the inconsistent data recorded each time to obtain a test result.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202310807701.5A 2023-07-03 2023-07-03 Method, device, equipment and storage medium for testing database storage process Pending CN117093471A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310807701.5A CN117093471A (en) 2023-07-03 2023-07-03 Method, device, equipment and storage medium for testing database storage process

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310807701.5A CN117093471A (en) 2023-07-03 2023-07-03 Method, device, equipment and storage medium for testing database storage process

Publications (1)

Publication Number Publication Date
CN117093471A true CN117093471A (en) 2023-11-21

Family

ID=88772466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310807701.5A Pending CN117093471A (en) 2023-07-03 2023-07-03 Method, device, equipment and storage medium for testing database storage process

Country Status (1)

Country Link
CN (1) CN117093471A (en)

Similar Documents

Publication Publication Date Title
US9773027B2 (en) Data loading tool
CN110022315B (en) Weight management method, device and equipment in block chain type account book
US7873598B2 (en) Slicing of relational databases
CN110781231A (en) Batch import method, device, equipment and storage medium based on database
CN109634846B (en) ETL software testing method and device
US20170004170A1 (en) Method And Apparatus For Reconstructing Cube In Multidimensional Online Analytical Processing System
CN106990974B (en) APP updating method and device and electronic equipment
CN114238085A (en) Interface testing method and device, computer equipment and storage medium
CN116561003A (en) Test data generation method, device, computer equipment and storage medium
CN115373889A (en) Method and device for data comparison verification and data repair in data synchronization
CN117093471A (en) Method, device, equipment and storage medium for testing database storage process
CN115827691A (en) Batch processing result verification method and device, computer equipment and storage medium
CN115129704A (en) Migration data verification method and system, electronic device and storage medium
CN109697161A (en) A kind of test method of storing process, storage medium and database server
CN111400243A (en) Research and development management system based on pipeline service and file storage method and device
CN117290415A (en) Data loading method, device, computer equipment and computer readable storage medium
CN115730016B (en) Data synchronization method, system, device, computer equipment and storage medium
US20230195609A1 (en) Automatic generation of summary report for validation tests of computing systems
CN117112305A (en) Test data recovery method, device, equipment, medium and product
CN116361149A (en) Batch processing automatic test method, device, computer equipment and storage medium
CN115509943A (en) Interface modification test method and device, storage medium and equipment
CN114880311A (en) Data processing method, data processing device, storage medium and computer equipment
CN118034947A (en) Data reporting method, device, computer equipment and storage medium
CN114996240A (en) Data table verification method, device, equipment, storage medium and program
CN116340430A (en) Data synchronization verification method and related equipment

Legal Events

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