在Core Data中插入测试数据 [英] Insert test data in Core Data
本文介绍了在Core Data中插入测试数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在使用核心数据(Xcode 5)在项目中编写一些单元测试。为了测试目的,我需要在 setUp 中的核心数据模型中插入一组数据。
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.
是最简单的方法吗?例如,如果我可以写一个XML文件并将其填充到我的核心数据中将是有帮助的。
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.
推荐答案
我最终在测试设置中以编程方式插入测试数据。
I end up inserting the test data programatically in the test setup.
这篇关于在Core Data中插入测试数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文