Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Test Core Data Migration With an App Already in the App Store?

We have an app that is currently in the app store. It uses Core Data as its persistence mechanism. We have a new version ready to go, and it has some schema changes. Specifically, we have added 1 new entity and added a new attribute to an existing entity. From my understanding and reading, this is one of the most simple migrations that can occur. There are no field deletions, and no relationships to change. The data model consists of 5 entities with no relationships at all.

We have versioned the data model, and created an .xcmappingmodel to handle the migration. We are handling the migration by adding the following options to the creation of the PersistentStoreCoordinator:

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                     [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, nil];

Currently, we have tested successfully with several members of the team using the following process:

  1. Delete all test versions of the app from the device and from iTunes
  2. Go to the app store and download the current version
  3. Make some changes to the app that will prove the migration was successful
  4. Drag the new binary (signed with the same bundle identifier) into iTunes and sync
  5. Load the new version on the device, verify that the changes made in the previous version are still present, and that the app does not crash

My question is this: Is there an easier/better way to test this? Our concern is that once the app goes out the door, there is no other way to ensure our users have the best experience possible.

like image 677
Mark Struzinski Avatar asked Jun 01 '11 02:06

Mark Struzinski


People also ask

What is application migration testing?

Application migration testing compares the migrated application with your legacy application to uncover discrepancies or errors. The goal is to ensure legacy data transfers over to the new application with minimal downtime or disruption with all essential data and functions intact.

How do I migrate to core data?

Migrations happen in three steps: First, Core Data copies over all the objects from one data store to the next. Next, Core Data connects and relates all the objects according to the relationship mapping. Finally, enforce any data validations in the destination model.

What is unit testing in data migration?

What is Migration Testing? Migration Testing is a verification process of migration of the legacy system to the new system with minimal disruption/downtime, with data integrity and no loss of data, while ensuring that all the specified functional and non-functional aspects of the application are met post-migration.


1 Answers

I've been using Core Data for my app and upgraded about 7 times, migrating from old models to new models.

Whenever, I am prepared to release the next version, I always test migration by using Model Mapping. As long as I made every entity and attribute of source model is matched against corresponding entity and attribute of destination model, I've experienced no problem.

Testing with your own project files are just as same as testing released ones that are distributed to the customers, so you don't have to worry if your test for migrating old model to new model is valid.

In other words, your project bundle's target, which is going to be archived and submitted, is same as what's being downloaded by the customer.

I'm pretty confident this is the case, since I've done testing with different versions of my app with no problem.

like image 166
petershine Avatar answered Sep 22 '22 07:09

petershine