Data Migration Test Method

Source: Internet
Author: User

For learning, the original from the Network: http://softtest.chinaitlab.com/qtjs/775532.html

Data migration is mainly used to switch between the old and new systems. There are two main types:

One is to migrate all the data of the old system to the new system. Only the new system is used for the business and the old system is no longer used.

In addition, some functions of the old system cannot be implemented in the new system for the time being, but the new system needs to be used in the business, the data generated in the new system needs to be imported to the old system to the database for special purposes.

 Migrate data from the old system to the new system

The main policies include:

1. Check whether the data in the old system is fully migrated to the new system.

To ensure seamless switching between the old and new systems, data correctness must be ensured. to migrate data from the old system to the new system, we must first ensure that the migrated data volume is consistent,When the data volume is consistentTestIf the data volume is inconsistent, it indicates that the migration method or script is incorrect and you need to find the cause.

2. view the table structure changes of the New and Old databases.

1) which new table fields do not have data in the old database and must be in the new database. If no new table fields exist, what values are assigned by default?

2) which data fields have data and some have no data? How to deal with the data that has been migrated to the new database?

3) What are the changes in the relationship between tables in the old database and those in the new database?

3. view the status changes of the same field in the new and old systems.

Because there are some differences between the new and old systems in the business representation, and the labels used to indicate the business status will also change, you must note that the new and old systems represent the differences in the same business status, generally, in this case, the corresponding ing is performed. Check whether the migrated data is correct based on the ing relationship.

4. Check whether fields in the new and old systems are correctly converted.

Before you perform a field check test, you need to prepare the test data. It is best to take each field into consideration in different situations before preparing the test data. You can use the matrix method, use the least data to overwrite the status. After preparing the data, you can check whether the fields are correctly migrated to the data according to the migration rules. Generally, there are the following types of migration rules.

1> direct migration: What is the original one? The original one cannot be copied. For such a rule, if the data source field and target fieldLength or accuracyDo not match, please pay special attention to whether you can directly map or do some simple operations, but also check whether the migration script has processed the length or accuracy. during testing, you also need to prepare inconsistent length and precision to test the data to check whether the data can be migrated correctly.

2> field calculation: The target field obtained by mathematical calculation of one or more fields in the data source. This rule is generally applicable to numeric fields.

3> for conversion by reference, one or more fields of the data source are usually used as keys to search for specific values in an associated array, and only unique values can be obtained. In general, this is mainly applicable to some fields similar to id

4> string processing: You can often obtain specific information from a string field of the data source, such as the ID card number. In addition, there are often numeric values in the form of strings. String operations include type conversion and string truncation. However, the randomness of character type fields also causes the risk of dirty data. Therefore, when testing this situation, you must consider exceptions.

5> null value determination. For the empty Value Field in the old system, you cannot simply think that it is still null after migration. You need to consider which field the field should be in the new database based on the actual situation, consider the case where this field is not empty in the old system.

6> for date conversion, the new and old systems need to consider different Representation Methods for date.

7> clustering calculation: for measurement fields in fact tables, they are usually obtained by using clustering functions for one or more fields of the data source. These aggregation functions are in the SQL standard, including sum, count, avg, min, max.

8> the predefined values. The difference between these rules and the preceding rules is that they do not depend on Data Source fields,

Obtain a fixed or system-dependent value for the target field.

5. Check whether the migrated data is correct in the business logic.

Use the data migrated from the old system to test the process in the business system. The function test ensures that the data is available after migration.
  

Migrate data from the old system to the new system

Migrating data from the new system to the old system is generally not all migrated. It may be that some tables have been migrated, this allows the old system to use the data in the new system for relevant statistics. The main migration method is batch migration, that is, to run a script within a certain period of time, migrate data from the new system to the old system. The main test policy is as follows:

1. Check that all data has been migrated during the time period.

Migration reflects the changed data in the new system over a certain period of time to the old system. Therefore, we need to test that all the changed data in the new system is correctly reflected in the old system during this time period. Generally, data migration, there will be a table specifically used to record the changes in the data in the new system. You can view the log table to obtain the changed data records, and then check the corresponding data in the new system.

2. Check whether the new data can be migrated.

Because it is batch migration, you need to ensure that the new data in the new system can be migrated to the old system. You can use the ID to uniquely identify the data generated in the new system to be migrated to the old system.

3. Check whether the modified data is actually reflected in the old system.

In the new system, it is inevitable that the data after the modification operation will be performed on the data. Correspondingly, the data in the old system also needs to be changed and needs to be tested, if the data in the new system is modified, whether the data in the old system will be modified after the script is executed.

4. Check whether the deleted data is correctly reflected in the old system.

Delete data in the new system. The data corresponding to the old system also needs to be deleted.

5. Check whether the fields after migration are correct

Check the fields in the same way as migrating from the old system to the new system.

6. Big Data Testing

Because batch migration may involve a large amount of data, if there are a large number of associated operations in the migration script, the migration may fail during the script execution period, as a result, the data for this migration is not completed. When the script is executed next time, a large amount of data cannot be migrated. In this case, the Migration script needs to be optimized, or increase the script clock time. To test the large data volume, you also need to check whether errors occur when the data volume is large.

7. Business Test

Because the structure and field representation of the database table of the new system may be inconsistent with that of the old system, Function Testing and process testing should be performed on the data migrated to the old system to ensure data availability.

8. Validation of fields not migrated

Because the structure and field representation of the database table of the new system may be inconsistent with that of the old system, some fields in the new system may not be found in the old system, so migration is not required, this part also needs to be verified to ensure that the field data that is not migrated will not be migrated to other fields.

9. Check for inconsistent field lengths

In the new system, the field length is inconsistent with the length of the field corresponding to the old system. You must either fail to migrate or intercept the field. If the field cannot be migrated, you must have an error log to determine which fields cannot be migrated, if yes, check whether the intercepted length is true. If yes, check whether it will affect the business.

For data migration testing, I personally think we need to pay attention to two aspects: one is to pay attention to business,

The migrated data should be available in the business process and will not affect the existing data to the business. The other is that the migrated data should be complete and correct, if the migration rules are incorrect, the migrated data is incorrect.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.