I'm having trouble setting up EarlGrey2 for white box testing. I can setup blackbox fine, but when my bundle is attached to my test target, whenever a test is run the simulator crashes.
Xcode 11.4.1 iOS Sim: 12 & 13
Steps:
Black box: (Can succesfully run tests)
- https://github.com/google/EarlGrey/blob/earlgrey2/docs/setup.md
- https://medium.com/assertqualityassurance/earlgrey-2-direct-project-copy-setup-guide-8643207729cc
White box: (Simulator crash on running test when bundle assigned to test target)
- https://github.com/google/EarlGrey/blob/earlgrey2/docs/white-boxing-setup-guide.md
- https://medium.com/assertqualityassurance/earlgrey2-setting-up-white-box-testing-capability-e90af19a3fee
- Create a new MAC bundle
- SDK - iOS
- Other Linker Flags: Add '-ObjC'
- Bundle loader: '$(TARGET_BUILD_DIR)/EarlGreyWhiteBoxTest.app/EarlGreyWhiteBoxTest'
- User Header Search Paths: 'EarlGrey' (Recursive)
- RunPath Search Paths: '@loader_path/Frameworks'
- Build Phase -> Add a Target Dependency on the Application Under Test
- Link Binary With Libraries -> Add a dependency on AppFramework.framework, set Status to Optional
At this point, both my bundle builds successfully, and I can still run EarlGrey black box tests
- Embed the Bundle into your application under test
- Destination: Absolute Path
- Path: $(TARGET_BUILD_DIR)/../..//EarlGreyHelperBundles
- Uncheck Copy only when installing
- Code sign on copy
Crash
Simulator - iOS 13.4/usr/include/dispatch/once.h (dispatch_once()) - Line 84:
Thread 1: Exception: "An error: Error Domain=NSCocoaErrorDomain Code=4 \"The bundle “EG2Bundle” couldn’t be loaded because its executable couldn’t be located.\" UserInfo={NSLocalizedFailureReason=The bundle’s executable couldn’t be located., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSBundlePath=/Users/myuser/Library/Developer/CoreSimulator/Devices/91EDC677-10D4-443D-A651-5775031EFBA0/data/Containers/Bundle/Application/E2429B71-0C8E-4D84-81CE-1C4A39BDF291/EarlGreyWhiteBoxTest.app/EarlGreyHelperBundles/EG2Bundle.bundle, NSLocalizedDescription=The bundle “EG2Bundle” couldn’t be loaded because its executable couldn’t be located.} was seen when loading the distant object categories bundle"
If I look manually, the bundle at the NSBundlePath does exist, so I assume i'm missing something because I'm not sure why this doesn't run.
Any help would be really appreciated!