 		let existingStoreVersionHashes = existingStoreMetadata[NSStoreModelVersionHashesKey] as! [String: AnyObject]!
 		XCTAssertNotNil(existingStoreVersionHashes, "Could not retrieve version hashes from \(storeURL).")
 		
+		let operationExpectation = expectationWithDescription("Migration operation succeeded")
 		let operationQueue = NSOperationQueue()
 		operationQueue.name = "Core Data Migration Test"
 		let migrationOperation = MigrationOperation()

		let existingStoreMetadata: [String: AnyObject]
		do {
			existingStoreMetadata = try NSPersistentStoreCoordinator.metadataForPersistentStoreOfType(storeType, URL: storeURL)
		} catch {
			XCTFail("Could not retrieve store metadata: \(error)")
			existingStoreMetadata = [:]
		}
		do {
			let _ = try MigrationPlan(storeMetadata: existingStoreMetadata, destinationModel: latestModel, bundles: [testBundle])
		} catch {
			XCTFail("Could not devise migration plan for \(storeURL): \(error)")
		}
	}
}

		migrationOperation.destinationStoreType = storeType
		migrationOperation.destinationModel = latestModel
		migrationOperation.bundles = [testBundle]
		migrationOperation.completionBlock = {
			XCTAssertNil(migrationOperation.error, "Migration operation failed: \(migrationOperation.error)")
			operationExpectation.fulfill()
		}
		operationQueue.addOperation(migrationOperation)
		waitForExpectationsWithTimeout(10) { error in
			if error != nil {
				return
			}
			let persistentStoreCoordinator = NSPersistentStoreCoordinator(managedObjectModel: latestModel)
			do {
				try persistentStoreCoordinator.addPersistentStoreWithType(self.storeType, configuration: nil, URL: storeURL, options: nil)
			} catch {
				XCTFail("Could not load persistent store after migration: \(error)")
				return
			}
		}
	}
	
