isUnitTesting
You can find out if code is running inside a XCTest/OCUnit test or not?
Installation
isUnitTesting is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "isUnitTesting"
Usage
This library provide a function for unit testing.
// @return YES if is running test
BOOL isUnitTesting()
You can use this following :
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if (isUnitTesting()) {
return YES;
}
// Some initialize rootViewController
return YES;
}
That's all!
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
License
MIT