I just setup application tests with OCUnit for my iOS project and am trying to figure out what to do with authentication. My app has a forced login screen where the user is required to authenticate with Facebook prior to entering the main app. When the user decides to authenticate, it pops them into Safari, takes them through an authentication sequence that is managed by Facebook, and then brings them back into the app (with further registration steps if they are a new user).
What I'm trying to figure out is, how can I get an application test to get past the login screen?
One option I've considered is making a new build configuration (e.g. "Test") that adds a preprocessor macro (e.g. "TEST = 1") that I can detect in my code. Then, only for that test configuration, I could replace my regular login code with a FBTestSession that wouldn't require the app to pop out to Safari. However, it would be nice if there were a cleaner option...
Here's the FBTestSession documentation: https://developers.facebook.com/docs/reference/ios/3.0/class/FBTestSession/
Thanks in advance!