XCTest and Objection

212 views
Skip to first unread message

Matthew Morse

unread,
Oct 25, 2013, 11:36:01 AM10/25/13
to objection...@googlegroups.com
Hi, 

I'm having an issue with Objection when attempting to run some xcode unit tests (XCTest).  

I want to test a method on my AppDelegate class, this method grabs the default injector, resolves a class FIDNetworkManager, does some logic and sets some properties on that FIDNetworkManager object.
During the didFinishLaunchingWithOptions of my AppDelegate I am creating and setting the default injector with bindings defined in my MWCModule class.

So in my unit test, in the setUp method, I'm creating and setting the default injector,  I override the application:didFinishLaunchingWithOptions: on my AppDelegate, create an instance of my AppDelegate, call the method I want to test and try to resolve the FIDNetworkManager to verify that the properties were setting accordingly.

The issue is that it appears that default injector is different for the test and the application.  When I try to resolve the default injector from the app delegate that was set up in my unit test, it's nil.  It's like the injector was not set up in my application.

Can you please give me some advise as to what I'm doing incorrectly?

Thanks.

Justin DeWind

unread,
Oct 25, 2013, 11:37:33 AM10/25/13
to Matthew Morse, objection...@googlegroups.com
This tends to happen when you have Objection integrated into both your test and build target which results into two versions of Objection being linked in.

-- 
Justin DeWind | Maker
Atomic Object | http://atomicobject.com
[Ph] +1 616 776 6020 [Fx] +1 616 776 6015

--
You received this message because you are subscribed to the Google Groups "Objection iOS/OSX Dependency Injection Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objection-frame...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Matthew Morse

unread,
Oct 25, 2013, 1:16:16 PM10/25/13
to objection...@googlegroups.com, Matthew Morse
Thanks for the quick response.
Do you know of a good way for us to test our application then?
Because the tests can't be within the application if they both require linking objection, right?
To unsubscribe from this group and stop receiving emails from it, send an email to objection-framework+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages