I have differences about GHUnit results between run from simulator and run from command line.
How can I use UIApplicationDelegate in cli?
In my sample app – tags stackoverflow-6479906.
I want to transfer apple’s OCUnit example to GHUnit one.
Expect:
Both “appDelegate” is not nil.
Current:
Run from simulator works fine. However run from cli raises exception.https://gist.github.com/1046753
Refs: apple’s unittest example
Note: I read async NSURLConnection sample, but I do not find solution and adjust in my UIApplicationDelegate case.
I recommend you design your test case for your app delegate such that it instantiates an instance of it and calls methods and tests outputs from there.
Consider a structure such as this:
The GHUnit framework bypasses the UI framework that creates the UIApplicationDelegate in the CLI version. In fact, the GUI version of GHUnit is actually instantiating its own UIApplicationDelegate called GHUnitIPhoneAppDelegate.
Here is a snippet from GHUnitIOSMain.m showing how it sets up its own app delegate for the GUI version: