I'm trying to run unit tests without the simulator using xctool. I set the 'Host Application' to None in the test target's General tab, following the directions from this comment .
When I run xctool -project MyProject.xcodeproj/ -scheme MyProject test
I get this error.
<unknown>:0: failed: caught "NSInvalidArgumentException",
"Could not find a storyboard named 'Main' in bundle NSBundle
</Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/
Developer/SDKs/iPhoneSimulator9.2.sdk/Developer/usr/bin> (loaded)"
I made sure that Main.storyboard is a member of the test target. Why is this happening and how can I fix it?
Figured this out, this post helped.
My test case set up method initialized the storyboard like this
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:DEVMainStoryboardName
bundle:nil];
Problem was passing nil to the bundle parameter, that uses the main bundle which is not what is used in the test target -- so you have to specify that you want to use the test bundle by writing
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:DEVMainStoryboardName
bundle:[NSBundle bundleForClass:[self class]]];
Then don't forget to include the storyboard as a member of the target.