Insert test data in Core Data

末鹿安然 提交于 2019-12-23 01:34:18

问题


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.


回答1:


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




回答2:


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




回答3:


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/



来源:https://stackoverflow.com/questions/19226703/insert-test-data-in-core-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!