DBMigrationTestKit
Testing CoreData migration library
- Main purpose is testing migration used by
NSEntityMigrationPolicy
.
Installation
pod 'DBMigrationTestKit'
Usage
- Copy SQLite file of previous version to your test target.
- Put
.sqlite
,.sqlite-shm
,.sqlite-wal
in same directory
- Put
setUp
(automatically migration)- tests
tearDown
is cleanup SQLite files.
@interface DBMigrationTestKitTests : XCTestCase
@end
@implementation DBMigrationTestKitTests {
DBMigrationTestKit *migrationTestKit;
}
- (void)setUp {
[super setUp];
migrationTestKit = [[DBMigrationTestKit alloc] init];
[migrationTestKit setupCoreDataStackWithAutoMigratingSQLiteName:@"DBMigrationTestKit.sqlite" momdName:@"DBMigrationTestKit"];
}
- (void)tearDown {
[migrationTestKit cleanup];
[super tearDown];
}
- (void)testMigration {
// assert migration results
}
@end
Known Issue
- Can't migrate between specific version(1.0 -> 2.0).
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
License
MIT