Data migration test method and device, computer device and readable storage medium

By comparing automated tasks with preset migration tables and performing automated interface testing, the comprehensiveness and efficiency of data migration testing during the Oracle migration process were resolved, ensuring data consistency and availability and simplifying the testing process.

CN115905177BActive Publication Date: 2026-04-24PING AN BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PING AN BANK CO LTD
Filing Date
2022-12-05
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

During the process of migrating from Oracle, existing technologies are unable to fully cover data migration testing, resulting in incomplete data comparison, easy occurrence of system problems, long testing time, reliance on human experience, and low test reliability.

Method used

By comparing the data in the source database with the preset migration table using automated tasks, the migration scope is determined. Then, automated interface testing is performed using a flow switch to verify the correctness of the business logic and generate a test report.

Benefits of technology

It achieves comprehensiveness and efficiency in data migration testing, reduces manual intervention, improves the reliability and efficiency of testing, and ensures data consistency and availability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115905177B_ABST
    Figure CN115905177B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of data processing, and discloses a data migration test method and device, computer equipment and a readable storage medium. The method comprises the following steps: switching the data in a source database and a target database according to a migration range; comparing the data in the source database and the target database through an automatic task and a preset migration table to obtain a data migration test result; comparing the table structures of the source database and the target database through the automatic task to obtain a table structure change test result; performing automatic testing on the interfaces of the source database and the target database through a flow switch to obtain an application interface test result; obtaining a business logic test result according to the business logic correctness of each data in the source database and the target database; and generating a test report according to the data migration test result, the table structure change test result, the application interface test result and the business logic test result. The method guarantees the comprehensiveness, availability and high efficiency of data migration testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a data migration testing method, device, computer equipment, and readable storage medium. Background Technology

[0002] In the fintech sector, the information technology innovation industry is the foundation of data security and cybersecurity, and also...

[0003] A key component of "new infrastructure" will become a crucial driver of economic development. The transformation of application systems from Oracle to domestically sourced databases is a major project promoted by various enterprises. However, this process involves database type changes, necessitating data migration testing—migrating data from the source database to the target database. Therefore, efficiently implementing data migration testing is of paramount importance. The Oracle migration process involves the core database of the application system.

[0004] Ensuring data consistency, correctness, and availability during the Oracle migration process is fundamental to the successful completion of the Oracle migration task 5. Whether the upgraded application is fully compatible and whether the new database system can withstand the workload are key considerations. The Oracle migration process involves verifying existing and incremental data, as well as the application system. Currently, most tests are based on the business level, and data comparisons are randomized, which can lead to incomplete data comparisons and data synchronization issues during the Oracle system deployment.

[0005] To ensure a smooth and successful database migration to Oracle, current technologies typically use flow control to write traffic to either the Oracle application or the target application, or both. Testing often relies on functional testing and sampling of database data. However, this approach cannot fully cover the entire system, making it prone to system problems during application modification. Furthermore, this testing method is time-consuming and heavily reliant on the testers' experience, resulting in low reliability. Summary of the Invention

[0006] In view of this, the purpose of the present invention is to overcome the shortcomings of the prior art and provide a data migration testing method, apparatus, computer equipment and readable storage medium that can be applied to fields such as fintech or other technical fields.

[0007] This invention provides the following technical solution:

[0008] In a first aspect, this disclosure provides a data migration testing method, the method comprising:

[0009] Determine the data migration range, switch the data between the source database and the target database according to the migration range, and compare the data in the source database and the target database with the preset migration table through an automated task to obtain the data migration test results;

[0010] The table structure of the source database and the target database are compared by the automated task to obtain the test results of the table structure change.

[0011] The interface between the source database and the target database is automatically tested using a flow switch to obtain application interface test results.

[0012] Based on the data, test the correctness of the business logic of each piece of data in the source database and the target database, and obtain the business logic test results;

[0013] A test report is generated based on the data migration test results, the table structure change test results, the application interface test results, and the business logic test results.

[0014] Furthermore, determining the migration range of the data includes:

[0015] The source database and the target database are modularized or microservice-ized, and the migration range of the data to be tested is determined based on the corresponding modules or microservices.

[0016] Furthermore, the data includes incremental data and full data, and the step of comparing the data in the source database and the target database with a preset migration table through an automated task includes:

[0017] Determine whether the incremental data in the target database is written to the source database;

[0018] If not written, the incremental data of the target database will be synchronously written back to the source database in real time by the switching link, and the incremental data in the source database and the target database will be compared at regular intervals. If there is a write-back delay, the abnormal incremental data will be compared by the automated task.

[0019] If writing occurs, the incremental data in the source database and the target database are compared periodically. If the incremental data is inconsistent, the abnormal incremental data is compared through the automated task.

[0020] Furthermore, the step of comparing the data in the source database and the target database with a preset migration table through an automated task also includes:

[0021] Select a preset migration table to compare and verify the full data in the source database and the target database. The preset migration table includes at least one of the following: number of data tables, data table name, data table index name, and number of data table indexes.

[0022] Furthermore, the step of comparing the table structures of the source database and the target database through the automated task to obtain the table structure change test results includes:

[0023] Based on business requirements, the automated task determines the table structure to be compared, performs comparison and verification periodically, and outputs the test results of the table structure changes. The table structure includes at least one of the following: excessively long fields, null values, boundary values, and dates.

[0024] Furthermore, the automated testing of the interface between the source database and the target database using the flow switch to obtain application interface test results includes:

[0025] Obtain the automated test cases for the interfaces corresponding to the source database and the target database, respectively;

[0026] By controlling the flow switch, the interface automated test cases are sent to the interface between the source database and the target database for testing, and the interface execution results are obtained.

[0027] The execution result of the interface is dynamically judged by the preset result verification data, and the test result of the application interface is output.

[0028] Further, the step of testing the business logic correctness of each piece of data in the source database and the target database based on the data, and obtaining the business logic test results, includes:

[0029] Obtain the business logic corresponding to each piece of data in the source database and the target database;

[0030] Obtain the statistical function corresponding to the business logic, and trigger the statistical function to count the data to obtain the statistical results;

[0031] The correctness of the statistical results is verified according to the business logic, and the business logic test results corresponding to each of the data are output.

[0032] Secondly, this disclosure provides a data migration testing apparatus, the apparatus comprising:

[0033] The first result acquisition module is used to determine the migration range of data, switch the data in the source database and the target database, and compare the data in the source database and the target database with the preset migration table through an automated task to obtain the data migration test results;

[0034] The second result acquisition module is used to compare the table structures of the source database and the target database through the automated task to obtain the test results of table structure changes.

[0035] The third result acquisition module is used to automatically test the interface between the source database and the target database through a flow switch to obtain the application interface test results.

[0036] The fourth result acquisition module is used to test the business logic correctness of each piece of data in the source database and the target database based on the data, and obtain the business logic test results;

[0037] The test report generation module is used to generate a test report based on the data migration test results, the table structure change test results, the application interface test results, and the business logic test results.

[0038] Thirdly, this disclosure provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the data migration test method described in the first aspect.

[0039] Fourthly, this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the data migration test method described in the first aspect.

[0040] The embodiments of this application have the following advantages:

[0041] The data migration testing method provided in this application includes: determining the data migration scope; switching data between the source database and the target database according to the migration scope; comparing the data in the source database and the target database with a preset migration table through an automated task to obtain data migration test results; comparing the table structures of the source database and the target database through the automated task to obtain table structure change test results; performing automated testing on the interface between the source database and the target database through a flow switch to obtain application interface test results; testing the business logic correctness of each piece of data in the source database and the target database based on the data to obtain business logic test results; and generating a test report based on the data migration test results, the table structure change test results, the application interface test results, and the business logic test results. This method ensures the comprehensiveness, usability, and efficiency of data migration testing, simplifying the Oracle migration testing process.

[0042] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0043] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 A flowchart of a data migration testing method provided in an embodiment of this application is shown;

[0045] Figure 2 A flowchart of another data migration testing method provided in an embodiment of this application is shown;

[0046] Figure 3 A flowchart of another data migration testing method provided in an embodiment of this application is shown;

[0047] Figure 4 This paper shows a schematic diagram of the structure of a data migration testing device provided in an embodiment of this application;

[0048] Figure 5 A schematic diagram of the hardware architecture of a computer device provided in an embodiment of this application is shown. Detailed Implementation

[0049] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0050] It should be noted that when an element is said to be "fixed" to another element, it can be directly on the other element or there may be an intervening element. When an element is said to be "connected" to another element, it can be directly connected to the other element or there may be an intervening element. Conversely, when an element is said to be "directly" on another element, there is no intervening element. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.

[0051] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0052] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the template description is for the purpose of describing particular embodiments only and is not intended to limit the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0054] Example 1

[0055] like Figure 1 The diagram shown is a flowchart of a data migration testing method according to an embodiment of this application. The data migration testing method provided in this embodiment includes the following steps:

[0056] Step S110: Determine the data migration range, switch the data in the source database and the target database according to the migration range, and compare the data in the source database and the target database with the preset migration table through an automated task to obtain the data migration test results.

[0057] In this embodiment, the source database and the target database are modularized or microserviced. The modularized or microserviced modules or microservices are used as the objects of data migration, and the migration range of the data to be tested is determined based on the corresponding modules or microservices. Further, a locally preset traffic switch is activated, and the data in the source database and the target database is switched according to the migration range. During the switching process, the traffic switch can control whether data is written to the source database or the target database. The data includes incremental data and full data. Full data refers to copying all data from the current system to the target system within a certain period; incremental data refers to capturing data from a specific moment or checkpoint for migration, not random full data migration.

[0058] Specifically, it is determined whether incremental data in the target database has been written to the source database. If the incremental data in the target database has only been written to the target database and not to the source database, the switching link synchronously writes the incremental data in the target database back to the source database in real time. The incremental data in the target database and the source database are compared periodically. If a write-back delay occurs, an automated task can compare the abnormal incremental data in real time. If the incremental data in the target database has been written to the source database (i.e., the incremental data is written to both the target and source databases), the incremental data in the source and target databases are compared periodically. If issues such as incremental data rollback in the target system or writing to the source database cause inconsistencies in the incremental data, the automated task compares the abnormal incremental data. The automated task is used to input information from the target and source databases, determine the tables and field values ​​to be compared, and verify the number of rows in the tables and the content of each row and field in both the target and source databases. The automated task is implemented based on an automation platform.

[0059] Furthermore, a preset migration table is selected to compare and verify the full data in the source database and the target database. The preset migration table includes at least one of the following: number of data tables, data table names, data table index names, and number of data table indexes. This embodiment provides multiple implementation methods for the migration table, making the data comparison and verification process more flexible.

[0060] The automated task compares the data in the source database and the target database against a preset migration table until the module or microservice to be migrated is switched to the target database, at which point the comparison ends and the data migration test results are output periodically. This approach further improves testing efficiency and comprehensiveness, taking into account the specific characteristics of data migration function testing.

[0061] Step S120: The table structures of the source database and the target database are compared by the automated task to obtain the test results of the table structure change.

[0062] It is understandable that different databases have different table structure handling methods, and their handling of excessively long fields, null values, boundary values, dates, etc., varies. Therefore, based on business requirements, it is necessary to determine the table structures to be compared through the aforementioned automated tasks, and to perform comparison and verification regularly. That is, the automated platform performs tests on each input box in the target database and the source database for excessively long field input, null value handling, boundary value formatting, date formatting, etc., identifying special scenarios during testing, covering various boundary values, and finally outputting the test results of the table structure changes.

[0063] By comparing the table structures of the source database and the target database using the automated task, the testing efficiency for changes in database table structures can be greatly improved, and core functionalities can be fully covered while ensuring data accuracy.

[0064] Step S130: Automated testing of the interface between the source database and the target database is performed using a flow switch to obtain application interface test results.

[0065] Because data changes continuously during migration, automated interface testing allows for the timely regression of automated test cases, enabling early detection of issues. By using traffic switches and corresponding automated interface test cases, the interfaces between the source and target databases are tested to obtain application interface test results. In this embodiment, automated interface testing refers to maintaining and testing functions that have been developed and deployed by developers. Firstly, it maintains the availability of existing functions; secondly, it detects whether newly developed interfaces, after deployment, affect existing functions, causing them to become unusable. Simultaneously, due to the short response time of interfaces, developers can quickly locate the malfunctioning interface, thereby rapidly fixing the anomaly and accelerating the version iteration cycle.

[0066] In this embodiment, as Figure 2 As shown, step S130 above includes:

[0067] Step S131: Obtain the interface automated test cases corresponding to the interfaces of the source database and the target database respectively;

[0068] Step S132: By controlling the flow switch, the interface automated test cases are sent to the interface between the source database and the target database for testing, and the interface execution results are obtained.

[0069] Step S133: Dynamically judge the execution result of the interface using preset result verification data, and output the test result of the application interface.

[0070] Specifically, automated test cases for the interfaces of the source database and the target database, stored locally, are obtained respectively. The interfaces to be tested, i.e., the interfaces of the source database and the target database, are invoked. Specifically, automated test cases can be executed using the TestNG test suite, Ant scripts, or Jenkins tools, with a traffic switch enabled. By controlling the traffic switch, the automated test cases are sent to the interfaces of the source database and the target database for automated testing, and the interface execution results are obtained. By sequentially executing the execution scripts corresponding to the interfaces to be tested in the automated test cases, the application interface test results of the interfaces of the source database and the target database are obtained. If the test results are consistent with the preset results, it indicates that the interface of the source database and the target database corresponding to the test can run normally; if the test results are inconsistent with the preset results, it indicates that the interface of the source database and the target database corresponding to the test has functional defects and cannot run normally, requiring improvement and maintenance.

[0071] By automating the testing of the interface between the source database and the target database, the cost of manual data entry and maintenance is reduced. It also solves the technical problem of test machine resource contention when multiple interfaces are tested simultaneously, thereby improving the efficiency of application interface testing and the user experience.

[0072] Step S140: Test the business logic correctness of each data in the source database and the target database based on the data, and obtain the business logic test results.

[0073] In this embodiment, the business logic testing device can be pre-configured in the local terminal. To ensure smooth data switching, the business logic of each piece of data in the source database and the target database needs to be tested to avoid errors during data switching. System-wide business logic testing can be broadly divided into different scenarios, such as full-data transaction testing, incremental data transaction testing, and full-data incremental transaction testing. In short, it's a compatibility test between old and new data, which requires system-wide business logic testing. The correctness of the business logic of each piece of data in the source database and the target database is tested based on the data to obtain the business logic test results.

[0074] In this embodiment, as Figure 3 As shown, step S140 above includes:

[0075] Step S141: Obtain the business logic corresponding to each piece of data in the source database and the target database;

[0076] Step S142: Obtain the statistical function corresponding to the business logic, and trigger the statistical function to count the data to obtain the statistical results;

[0077] Step S143: Verify the correctness of the statistical results according to the business logic, and output the business logic test results corresponding to each of the data.

[0078] For example, a business logic might state that the total number of bank card applicants on October 1, 2022, should equal the sum of bank card applicant data from all regions and all channels on that day. However, if these three figures are not equal, the business logic test for the number of bank card applicants fails. Because the statistical algorithms for each dimension are executed independently, after verifying the success of the statistical algorithm for a single dimension, it is also necessary to verify the horizontal correlation of the statistical algorithms for each dimension through business logic to ensure that there are no errors in the business logic.

[0079] Just like the number of bank card applicants in a single day, whether the total number of bank card applicants is calculated by region or by channel, the total number of bank card applicants must be the same. For example, if bank card applicants are located in Shenzhen and Changsha today, with 30 people applying for bank cards in Shenzhen and 15 people applying for bank cards in Changsha, then the total number of bank card applicants calculated from the regional perspective is 45. If the total number of bank card applicants is calculated from the channel perspective, assuming that the bank card applicants come from online and offline channels, then the total number of bank card applicants calculated from the channel perspective should also be 45.

[0080] The above method can prevent obvious problems in the business logic of statistical data from going unnoticed when verifying the correctness of individual statistical algorithms, thereby improving the accuracy of testing statistical functions.

[0081] Step S150: Generate a test report based on the data migration test results, the table structure change test results, the application interface test results, and the business logic test results.

[0082] The tests in the above four dimensions are performed sequentially to obtain data migration test results, table structure change test results, application interface test results, and business logic test results, respectively. A test report is generated based on the data migration test results, the table structure change test results, the application interface test results, and the business logic test results.

[0083] By conducting data migration tests at the database level, application interface level, and business logic level, it is ensured that a single test case design can be applied to different systems and different stages of testing, effectively guaranteeing data consistency, integrity, and availability. This also saves a significant amount of testing costs and time, freeing up more testing resources.

[0084] The data migration testing method provided in this application determines the data migration scope, switches data between the source and target databases according to the migration scope, and compares the data in the source and target databases with a preset migration table through an automated task to obtain data migration test results. It also compares the table structures of the source and target databases through the automated task to obtain table structure change test results; performs automated testing on the interfaces between the source and target databases using a flow switch to obtain application interface test results; tests the business logic correctness of each piece of data in the source and target databases based on the data to obtain business logic test results; and generates a test report based on the data migration test results, table structure change test results, application interface test results, and business logic test results. This method ensures the comprehensiveness, usability, and efficiency of data migration testing, simplifying the Oracle migration testing process.

[0085] Example 2

[0086] like Figure 4 The diagram shown is a structural schematic of a data migration testing device 400 according to an embodiment of this application. The device includes:

[0087] The first result acquisition module 410 is used to determine the migration range of data, switch the data in the source database and the target database, and compare the data in the source database and the target database with the preset migration table through an automated task to obtain the data migration test results;

[0088] The second result acquisition module 420 is used to compare the table structures of the source database and the target database through the automated task to obtain the table structure change test results.

[0089] The third result acquisition module 430 is used to automatically test the interface between the source database and the target database through a flow switch to obtain the application interface test results.

[0090] The fourth result acquisition module 440 is used to test the business logic correctness of each piece of data in the source database and the target database based on the data, and obtain the business logic test result;

[0091] The test report generation module 450 is used to generate a test report based on the data migration test results, the table structure change test results, the application interface test results, and the business logic test results.

[0092] Optionally, the data migration testing apparatus described above may further include:

[0093] The determination module is used to modularize or microservice the source database and the target database, and determine the migration range of the data to be tested based on the corresponding modules or microservices.

[0094] Optionally, the above-mentioned data migration testing apparatus may further include:

[0095] The judgment module is used to determine whether incremental data in the target database has been written to the source database;

[0096] The first comparison module is used to synchronously write back the incremental data of the target database to the source database in real time by switching links if no data is written, and to compare the incremental data in the source database and the target database at regular intervals. If a write-back delay occurs, the automated task will compare the abnormal incremental data.

[0097] The second comparison module is used to periodically compare the incremental data in the source database and the target database if writing occurs. If the incremental data is inconsistent, the abnormal incremental data is compared through the automated task.

[0098] Optionally, the above-mentioned data migration testing apparatus may further include:

[0099] The third comparison module is used to select a preset migration table to compare and verify the full data in the source database and the target database. The preset migration table includes at least one of the following: number of data tables, data table name, data table index name, and number of data table indexes.

[0100] Optionally, the data migration testing apparatus described above may further include:

[0101] The fourth comparison module is used to determine the table structure to be compared according to business needs through the automated task, perform comparison verification at regular intervals, and output the test results of the table structure change. The table structure includes at least one of the following: excessively long fields, null values, boundary values, and dates.

[0102] Optionally, the data migration testing apparatus described above may further include:

[0103] The first acquisition module is used to acquire the interface automated test cases corresponding to the interfaces of the source database and the target database, respectively.

[0104] The testing module is used to control the flow switch to send the interface automated test cases to the interface between the source database and the target database for testing, and to obtain the interface execution results.

[0105] The dynamic judgment module is used to dynamically judge the execution result of the interface based on preset result verification data, and output the test result of the application interface.

[0106] Optionally, the data migration testing apparatus described above may further include:

[0107] The second acquisition module is used to acquire the business logic corresponding to each of the data in the source database and the target database;

[0108] The third acquisition module is used to acquire the statistical function corresponding to the business logic, and trigger the statistical function to collect the data and obtain the statistical results;

[0109] The verification module is used to verify the correctness of the statistical results according to the business logic, and output the business logic test results corresponding to each of the data.

[0110] The data migration testing device provided in this application ensures the comprehensiveness, availability, and efficiency of data migration testing, simplifying the Oracle migration testing process.

[0111] Example 3

[0112] Figure 5 A schematic diagram of the hardware architecture of the computer device provided in this application is shown. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, it implements the steps of the data migration test method described in Embodiment 1.

[0113] In this embodiment, the computer device 500 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. For example, it can be a rack server, blade server, tower server, or cabinet server (including standalone servers or server clusters composed of multiple servers), etc. Figure 5 As shown, the computer device 500 includes, but is not limited to, at least: a memory 510, a processor 520, and a network interface 530 that can communicate and be linked to each other via a system bus. Wherein:

[0114] The memory 510 includes at least one type of computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 510 may be an internal storage module of the computer device 500, such as the hard disk or memory of the computer device 500. In other embodiments, the memory 510 may also be an external storage device of the computer device 500, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Of course, the memory 510 may include both the internal storage module and the external storage device of the computer device 500. In this embodiment, the memory 510 is typically used to store the operating system and various application software installed on the computer device 500, such as program code for video playback methods. In addition, the memory 510 can also be used to temporarily store various types of data that have been output or will be output.

[0115] In some embodiments, processor 520 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. This processor 520 is typically used to control the overall operation of computer device 500, such as performing control and processing related to data interaction or communication with computer device 500. In this embodiment, processor 520 is used to run program code stored in memory 510 or process data.

[0116] Network interface 530 may include a wireless network interface or a wired network interface, which is typically used to establish a communication link between computer device 500 and other computer devices. For example, network interface 530 is used to connect computer device 500 to an external terminal via a network, establishing a data transmission channel and communication link between computer device 500 and the external terminal. The network may be an intranet, the Internet, Global System for Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, or other wireless or wired networks.

[0117] It should be pointed out that, Figure 5 Only computer devices with components 510-530 are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0118] In this embodiment, the data migration test method stored in memory 510 can also be divided into one or more program modules and executed by one or more processors (processor 520 in this embodiment) to complete the present invention.

[0119] Example 4

[0120] This embodiment also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the data migration test method in this embodiment.

[0121] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device. Of course, the computer-readable storage medium can also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the computer-readable storage medium is typically used to store the operating system and various application software installed on the computer device. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or will be output.

[0122] In all examples shown and described herein, any specific values ​​should be interpreted as merely exemplary and not as limitations; therefore, other examples of exemplary embodiments may have different values.

[0123] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0124] The embodiments described above are merely examples of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.

Claims

1. A data migration testing method, characterized in that, The method includes: Determine the data migration range, switch the data between the source database and the target database according to the migration range, and compare the data in the source database and the target database with the preset migration table through an automated task to obtain the data migration test results; The table structure of the source database and the target database are compared by the automated task to obtain the test results of the table structure change. The interface between the source database and the target database is automatically tested using a flow switch to obtain application interface test results. Based on the data, test the correctness of the business logic of each piece of data in the source database and the target database, and obtain the business logic test results; A test report is generated based on the data migration test results, the table structure change test results, the application interface test results, and the business logic test results. The data includes incremental data and full data. The step of comparing the data in the source database and the target database using an automated task and a preset migration table includes: Determine whether the incremental data in the target database is written to the source database; If not written, the incremental data of the target database will be synchronously written back to the source database in real time by the switching link, and the incremental data in the source database and the target database will be compared at regular intervals. If there is a write-back delay, the abnormal incremental data will be compared by the automated task. If writing occurs, the incremental data in the source database and the target database are compared periodically. If the incremental data is inconsistent, the abnormal incremental data is compared through the automated task.

2. The data migration testing method according to claim 1, characterized in that, Determining the migration range of the data includes: The source database and the target database are modularized or microservice-ized, and the migration range of the data to be tested is determined based on the corresponding modules or microservices.

3. The data migration testing method according to claim 1, characterized in that, The step of comparing the data in the source database and the target database with a preset migration table through an automated task also includes: Select a preset migration table to compare and verify the full data in the source database and the target database. The preset migration table includes at least one of the following: number of data tables, data table name, data table index name, and number of data table indexes.

4. The data migration testing method according to claim 1, characterized in that, The step of comparing the table structures of the source database and the target database through the automated task to obtain the table structure change test results includes: Based on business requirements, the automated task determines the table structure to be compared, performs comparison and verification periodically, and outputs the test results of the table structure changes. The table structure includes at least one of the following: excessively long fields, null values, boundary values, and dates.

5. The data migration testing method according to claim 1, characterized in that, The automated testing of the interface between the source database and the target database using the flow switch to obtain application interface test results includes: Obtain the automated test cases for the interfaces corresponding to the source database and the target database, respectively; By controlling the flow switch, the interface automated test cases are sent to the interface between the source database and the target database for testing, and the interface execution results are obtained. The execution result of the interface is dynamically judged by the preset result verification data, and the test result of the application interface is output.

6. The data migration testing method according to claim 1, characterized in that, The step of testing the business logic correctness of each piece of data in the source database and the target database based on the data, and obtaining the business logic test results, includes: Obtain the business logic corresponding to each piece of data in the source database and the target database; Obtain the statistical function corresponding to the business logic, and trigger the statistical function to count the data to obtain the statistical results; The correctness of the statistical results is verified according to the business logic, and the business logic test results corresponding to each of the data are output.

7. A data migration testing device, characterized in that, The device includes: The first result acquisition module is used to determine the migration range of data, switch the data in the source database and the target database, and compare the data in the source database and the target database with the preset migration table through an automated task to obtain the data migration test results; The second result acquisition module is used to compare the table structures of the source database and the target database through the automated task to obtain the test results of table structure changes. The third result acquisition module is used to automatically test the interface between the source database and the target database through a flow switch to obtain the application interface test results. The fourth result acquisition module is used to test the business logic correctness of each piece of data in the source database and the target database based on the data, and obtain the business logic test results; The test report generation module is used to generate a test report based on the data migration test results, the table structure change test results, the application interface test results, and the business logic test results. The data includes incremental data and full data. The step of comparing the data in the source database and the target database using an automated task and a preset migration table includes: Determine whether the incremental data in the target database is written to the source database; If not written, the incremental data of the target database will be synchronously written back to the source database in real time by the switching link, and the incremental data in the source database and the target database will be compared at regular intervals. If there is a write-back delay, the abnormal incremental data will be compared by the automated task. If writing occurs, the incremental data in the source database and the target database are compared periodically. If the incremental data is inconsistent, the abnormal incremental data is compared through the automated task.

8. A computer device, characterized in that, It includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the data migration test method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the data migration test method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Business data testing method, device and equipment

    CN113515445A

  • Data migration detection method and device

    CN115017135A