Using Core Data with OCUnit
Using Core Data with OCUnit
- Subject: Using Core Data with OCUnit
- From: William Hunt <email@hidden>
- Date: Mon, 10 Mar 2008 02:36:48 -0700
Hey all,
I'm having a bit of trouble getting my Core Data NSManagedObjectModel
to load from within my unit tests. The code I'm using to load the
model (and context) is in my application code, not in my unit test;
but I do call it from my test class's setUp() method.
The strange part is that when I load my object model:
_mom = [[NSManagedObjectModel mergedModelFromBundles: nil]
retain];
This works just fine when I run my application, but when I run my
test cases, it returns an empty object model. A simple NSLog
following that initialization results in:
2008-03-10 02:34:19.854 otest[2063:80f] Model initialized:
(<NSManagedObjectModel: 0x136340>) isEditable 1, entities {
}, fetch request templates {
}
I've copied my xcdatamodel file to the Compile Sources section of my
OCUnit target, and the compiled .mom file appears in the same place in
the resulting bundle as it does in the application bundle. Further,
it is the same file.
I'm at a loss for how to proceed in debugging this problem. Any ideas?
Thanks,
Wil
--
Wil Hunt
"Life is the art of drawing sufficient conclusions from insufficient
premises."
-- Samuel Butler
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden