Saturday, 7 September 2013

How to use a static library (e.g. cocoapods library) on a XCTest?

How to use a static library (e.g. cocoapods library) on a XCTest?

I'm working with Core Data and, as I the model gets more complex, I need
to make sure that the new changes I introduce don't break my model
unexpectedly in other parts.
I can create unit tests and run them every time I change something on my
model. If something breaks, there might be something wrong with my model
or at least I know I have to modify some queries in the main code/tests.
I'm using MagicalRecord to have access to some convenience methods. I also
use cocoapods for the same reason, convenience. The problem is that
cocoapods creates a static library and links it against my target, but in
Xcode, new test targets are not automatically configured to link against
the same libraries/frameworks the target in question links against to.
How can I have a XCTest link against a static library?
This is not only helpful with MagicalRecord/Core Data, but when you're
using an external library it's a good idea to have tests to make sure that
updates on the library don't break your App.

No comments:

Post a Comment