Unit Testing Model Classes that inherits from NSManagedObject

Posted by Matt Baker on Stack Overflow See other posts from Stack Overflow or by Matt Baker
Published on 2010-05-16T01:05:25Z Indexed on 2010/05/16 1:50 UTC
Read the original article Hit count: 254

So...I'm trying to get unit tests set up in my iPhone App but I'm having some issues. I'm trying to test my model classes but they inherit directly from NSManagedObject. I'm sure this is a problem but I don't know how to get around it.

Everything is building and running as expected but I get this error when calling any method on the class I'm testing:

Unknown.m:0:0 unrecognized selector sent to instance 0xc2b120

If I follow this structure (http://chanson.livejournal.com/115621.html) to create my object in my tests I end up with another error entirely but it still doesn't help me.

Basically my question is this: how can I test a class that inherits from NSManagedObject?

© Stack Overflow or respective owner

Related posts about unit-testing

Related posts about objective-c