Starting with the test of a LightWeight Migration

Let’s start with a simple CoreData model. We have a person that has a name, a surname, and the information of whether they’re a teacher (as a Bool).

Model 1

However, we soon realised that this model was not sufficient for our new purpose. The new model changed the variable names and is adding the variable “age”.

Model 2

Since this modification is done with a lightweight migration we have now finished creating the new model version. But we’ll feel a lot better if we test the migration with the help of XCUnitTests!

Here’s the code to perform this: