Test bundle injection should happen before main(), not after (Duplicate of rdar://22101460)
| Originator: | john.foulkes | ||
| Number: | rdar://22608212 | Date Originated: | 08-Sep-2015 10:57 AM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | |
| Classification: | Reproducible: |
Summary:
As described in http://qualitycoding.org/app-delegate-for-tests/, I have main() test for the presence of a test-specific application delegate. This is important for bypassing the regular app delegate during testing. This technique fails in Xcode 7 beta 4, presumably because the test bundle is being injected too late.
Steps to Reproduce:
1. Create new project for iOS application.
2. Add a TestingAppDelegate to the test target.
3. Change main to:
int main(int argc, char *argv[])
{
@autoreleasepool {
Class appDelegateClass = NSClassFromString(@"TestingAppDelegate");
if (!appDelegateClass)
appDelegateClass = [AppDelegate class];
return UIApplicationMain(argc, argv, nil, NSStringFromClass(appDelegateClass));
}
}
Expected Results:
Expect appDelegateClass to be AppDelegate during normal runs, TestingAppDelegate during unit testing.
Actual Results:
In Xcode 7 beta 6, appDelegateClass is always AppDelegate, even during testing.
Version:
Xcode 7 beta 6, running on Yosemite 10.10.4
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!