Xcode UI Testing on device not working

Hi,


I've been trying to run UI tests on a real device and after fixing all the Code Sign issues and Run the tests, the Build is fine but the tests are not run even thouhg i got the "Test succeded" message.


I am using Xcode 7.0.1 and an iPhone 6 with iOS 9.0.2.


On the simulator the tests run perfectly. There are no logs about any errors or anything so it is really hard to find out what is wrong.


Regards,

Javier

Replies

I'm running into the same issue. UI Test is running via a Bot. It works fine on simulators, on a physical iOS simulator through Xcode, but not on a physical iOS devices plugged into the computer using a Bot.


Xcode 7.0.1, iPhone 6 with iOS 9.0.2, Xcode Server 5.0.4, using a Bot.


Bot Issue for MyBot Bot (error)
Integration #80 of MyBot Bot
Open in Xcode: xcbot://(null)/botID/e7f117d90d5259fe86a059a24a005a30/integrationID/02a785e2fc7352a91083f18f3e1abcba
Assertion: Test target UITests encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
File: (null):(null)


While the bot is running the test, I can see it install the "OurAppUITests" app, and "OurApp". Then it launches "OurAppUITest", quits, and then doesn't do anything else. In the simulator, it does the same, but launches "OurApp" and runs the UI Tests successfully.

Here's some context in the raw logs regarding the bootstrapping message when running the tests via a Bot through Xcode Server 5.0.4 with Xcode 7.0.1 on a physical iPhone 6 with iOS 9.0.2. The Bot is set to clean before running:


2015-10-09 12:16:21.379 xcodebuild[85849:748981]  iPhoneConnect: app uninstall set - {(
)}
2015-10-09 12:16:21.380 xcodebuild[85849:748981]  iPhoneConnect: app install set - {(
    <DVTFilePath:0x7fa01832f9a0:'/Library/Developer/XcodeServer/Integrations/Caches/e7f117d90d5259fe86a059a24a005a30/DerivedData/Build/Products/Debug-iphoneos/OurAppUITests-Runner.app'>
)}
writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/zg/gcbrsb6d78zbhwmygd4mpy_8000087/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/2d31311b3cedc959af091a1e4087af0c/143c6ee4fb418d86fb9510ee6cacd19ec26e8a87/ManifestCache.plist
2015-10-09 12:16:23.687 xcodebuild[85849:754947]  iPhoneConnect: remoteExecutable setInstalledPath:/private/var/mobile/Containers/Bundle/Application/A1A1D4AA-3F6A-4AC7-97A8-30D3E0705C4C/OurAppUITests-Runner.app
2015-10-09 12:16:23.687 xcodebuild[85849:754947]  iPhoneConnect: deviceAppTmpPath (for test bundle and frameworks): /private/var/mobile/Containers/Data/Application/37C3D662-6ED9-4048-9FDF-A3DA2A7AD7C9/tmp
2015-10-09 12:16:23.712 xcodebuild[85849:754947]  iPhoneConnect: Failed to copy test bundle dSYM from /Library/Developer/XcodeServer/Integrations/Caches/e7f117d90d5259fe86a059a24a005a30/DerivedData/Build/Products/Debug-iphoneos/OurAppUITests-Runner.app/PlugIns/OurAppUITests.xctest.dSYM to /var/folders/zg/gcbrsb6d78zbhwmygd4mpy_8000087/T/A5B5BEF3-4567-49B1-9EFD-AE89175EAC6F-85849-00000B84BCEE6ABB/tmp/OurAppUITests.xctest.dSYM: error Error Domain=NSCocoaErrorDomain Code=260 "The file “OurAppUITests.xctest.dSYM” couldn’t be opened because there is no such file." UserInfo=0x7fa0193e1b80 {NSFilePath=/Library/Developer/XcodeServer/Integrations/Caches/e7f117d90d5259fe86a059a24a005a30/DerivedData/Build/Products/Debug-iphoneos/OurAppUITests-Runner.app/PlugIns/OurAppUITests.xctest.dSYM, NSUnderlyingError=0x7fa0187e7e50 "The operation couldn’t be completed. No such file or directory"}
2015-10-09 12:16:32.508 xcodebuild[85849:754947]  iPhoneConnect: Updated testing environment variables {
    "DYLD_FRAMEWORK_PATH" = "/Library/Developer/XcodeServer/Integrations/Caches/e7f117d90d5259fe86a059a24a005a30/DerivedData/Build/Products/Debug-iphoneos:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks";
    "DYLD_LIBRARY_PATH" = "/Library/Developer/XcodeServer/Integrations/Caches/e7f117d90d5259fe86a059a24a005a30/DerivedData/Build/Products/Debug-iphoneos:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks";
    "OBJC_DISABLE_GC" = YES;
    "XCODE_DBG_XPC_EXCLUSIONS" = "com.apple.dt.xctestSymbolicator";
    XCTestConfigurationFilePath = "/Library/Developer/XcodeServer/Integrations/Caches/e7f117d90d5259fe86a059a24a005a30/DerivedData/Build/Products/Debug-iphoneos/OurAppUITests-Runner.app/PlugIns/OurAppUITests.xctest/OurAppUITests-D0281812-5D1E-4DC7-B72C-10BA9D748609.xctestconfiguration";
}
2015-10-09 12:16:33.717 xcodebuild[85849:756908]  iPhoneConnect: Started debugserver on device. fd = 34
2015-10-09 12:16:34.723 xcodebuild[85849:748584] [MT] IDETestOperationsObserverDebug: (D0281812-5D1E-4DC7-B72C-10BA9D748609) Adding console adaptor <IDEConsoleAdaptor: 0x7fa019516010 'target'> for test session D0281812-5D1E-4DC7-B72C-10BA9D748609.
2015-10-09 12:16:37.057 xcodebuild[85849:748584] [MT] iPhoneConnect: ############## DID EXECUTE #################
2015-10-09 12:16:39.248 xcodebuild[85849:748584] [MT] IDETestOperationsObserverDebug: ((null)) Test operation failure: Test session exited(82) without checking in. Executable cannot be loaded for some other reason, such as a problem with a library it depends on or a code signature/entitlements mismatch. Retry after a Clean build.
2015-10-09 12:16:39.249 xcodebuild[85849:748584] [MT] IDETestOperationsObserverDebug: ((null)) _finishWithError:Error Domain=IDETestOperationsObserverErrorDomain Code=4 "Test session exited(82) without checking in. Executable cannot be loaded for some other reason, such as a problem with a library it depends on or a code signature/entitlements mismatch. Retry after a Clean build." UserInfo=0x7fa018b7b010 {NSLocalizedDescription=Test session exited(82) without checking in. Executable cannot be loaded for some other reason, such as a problem with a library it depends on or a code signature/entitlements mismatch. Retry after a Clean build.} didCancel: 1
Child: Can't write length for data
Child: Can't write length for data
Child: Couldn't write response, exiting...
Child with pid 87094 exited normally
2015-10-09 12:16:39.668 xcodebuild[85849:748584] [MT] IDETestOperationsObserverDebug: ((null)) Finished syncing device diagnostic logs after 0.4s.
2015-10-09 12:16:39.669 xcodebuild[85849:748584] [MT] IDETestOperationsObserverDebug: Test runner for (null) will finish with error: Test session exited(82) without checking in. Executable cannot be loaded for some other reason, such as a problem with a library it depends on or a code signature/entitlements mismatch. Retry after a Clean build. If you believe this error represents a bug, please attach the log file at /Library/Developer/XcodeServer/Integrations/Integration-02a785e2fc7352a91083f18f3e1abcba/Session-2015-10-09_12:14:37-9pF10S.log (canceled: 1)
2015-10-09 12:16:39.669 xcodebuild[85849:748584] [MT] IDETestOperationsObserverDebug: <IDEOCUnitTestRunner: 0x7fa015fb44a0> set currentTestRunOperation to nil
2015-10-09 12:16:39.669 xcodebuild[85849:748584] [MT] IDETestOperationsObserverDebug: -[IDETestOperationsObserver testRunner:willFinishWithError:didCancel:] willFinishWithError Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo=0x7fa0188ee900 {NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted} (cancel: 1)
2015-10-09 12:16:39.670 xcodebuild[85849:748584] [MT] IDETestOperationsObserverDebug: -[IDETestsSummariesBuilder testOperationWillFinishWithSuccess:withError:]: emptying stack
2015-10-09 12:16:39.670 xcodebuild[85849:748584] [MT] IDETestOperationsObserverDebug: Set current runner to nil
2015-10-09 12:16:39.670 xcodebuild[85849:748584] [MT] IDETestOperationsObserverDebug: _considerFinishing
** TEST FAILED **

I found this on Stack - but installing the updated profile didn't help in my case:

http://stackoverflow.com/questions/33404226/xcode-ui-automation-test-not-running-on-physical-device?answertab=oldest#tab-top

I still have same issue in Xcode 7.2.

I have the same problem. "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" One for each simulator when trying to perform automated UI test with Xcode 7.2 bot.

The reason is your app popup some system alert (notification, location) and the bot is unable to handle it.

For anyone else that gets this via CI/Bots, make sure Xcode isn't on a breakpoint. I had a previous run that triggered a breakpoint and subsequent runs failed with this exact same message. I turned off the breakpoint and restarted Xcode and it worked.