title: Generate Data of Previous Version of xcdatamodel for Core Data Migration Testing
body: <p>In our existing app, we have many different version of <code>xcdatamodel</code>:</p>
  
  <pre><code>+ TheApp.xcdatamodel
     TheApp.1.0.xcdatamodel
     TheApp.1.1.xcdatamodel
     TheApp.2.0.xcdatamodel
     ...
  </code></pre>
  
  <p>We know that the traditional way of doing database migration testing is what have been proposed in this question: <a href="https://stackoverflow.com/questions/6195739/how-to-test-core-data-migration-with-an-app-already-in-the-app-store">How to Test Core Data Migration With an App Already in the App Store?</a> In short, it works like the following: </p>
  
  <ol>
  <li>install a old version of the app;</li>
  <li>create some data in the old version of the app;</li>
  <li>install the new version on top it;</li>
  <li>see if everything is migrated properly. </li>
  </ol>
  
  <p>We have been using this migration testing method for all our previous version of the app. Our QAs will perform the above steps and then judge by themselves that whether migration is successful or not. </p>
  
  <p>However, in the most recent upgrade, we have changed a lot in our data model. It doesn't sound like such a good idea to ask the QAs to remember what have been created in the old version of the app and know what have been missing or not during migration. Therefore, we would like to see whether it is possible to write unit testing for the database migration by the developers ourself.  </p>
  
  <p>So one of the first step is to generate test data. Notice that we can see all the previous version of the <code>xcdatamodel</code> from within our Xcode project, it seems that it is possible. In a nutshell, the question: </p>
  
  <p><strong>Is it possible to generate test data of previous version of <code>xcdatamodel</code> programmatically from within our current version of the app?</strong> </p>
  
  <p>Please let me know what you think. Suggestions are also acceptable. </p>