Insert test data in Core Data

2019-06-08 02:06发布

I'm currently writing some unit tests in a project using Core Data (Xcode 5). For testing purpose I need to insert a bundle of data into my Core Data model in the setUp.

What is the easiest way doing that? For instance it would be helpful if I could write an XML file and populate this into my Core Data.

3条回答
放我归山
2楼-- · 2019-06-08 02:41

You can check this article for a guide for testing Core Data - to sum it up, they are using MagicalRecord: http://www.cimgf.com/2012/05/15/unit-testing-with-core-data/

查看更多
劫难
3楼-- · 2019-06-08 02:44

You can use Valentina studio to open Core Data Model(SQLite file) and insert values.

查看更多
该账号已被封号
4楼-- · 2019-06-08 02:53

I end up inserting the test data programatically in the test setup.

查看更多
登录 后发表回答