Last active
December 18, 2015 07:00
-
-
Save mbinna/5743674 to your computer and use it in GitHub Desktop.
Detect if the app was launched in the iOS Simulator to execute the unit tests. Source: http://www.objc.io/issue-1/testing-view-controllers.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static BOOL isRunningTests(void) { | |
NSDictionary *environment = [[NSProcessInfo processInfo] environment]; | |
NSString *injectBundle = environment[@"XCInjectBundle"]; | |
return [[injectBundle pathExtension] isEqualToString:@"octest"]; | |
} |
Well, replace @"octest"
by @"xctest
and rulez
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This fails if it is running xctest.