UI Testing Failure - Failed to launch within 2.5s, Interrupting test

Since Xcode 7 I have been getting the following crash when trying to run UITests, it fails on app.launch() is there anyway we can set the timeout of launching, or is that a red-herring?


Test Case '-[AppNameUITests.WARPUINavigationSwipeTests testAfterLaunchWeAreOnCameraScreen]' started.
    t =     0.00s     Start Test
    t =     0.00s     Set Up
    t =     0.01s     Launch com.AppName.ios
2015-09-30 17:38:47.534 XCTRunner[20491:235908] Continuing to run tests in the background with task ID 1
    t =     3.29s         Assertion Failure: UI Testing Failure - Failed to receive completion for <XCDeviceEvent:0x7861d160 page 12 usage 64 duration 0.01s within 2.5s
/Users/chrisdavis/Documents/Clients/Inktrap/AppName/Client/AppName/AppNameUITests/WARPUINavigationSwipeTests.swift:36: error: -[AppNameUITests.WARPUINavigationSwipeTests testAfterLaunchWeAreOnCameraScreen] : UI Testing Failure - Failed to receive completion for <XCDeviceEvent:0x7861d160 page 12 usage 64 duration 0.01s within 2.5s
2015-09-30 17:38:50.321 XCTRunner[20491:235908] *** Terminating app due to uncaught exception '_XCTestCaseInterruptionException', reason: 'Interrupting test'
*** First throw call stack:
(
  0   CoreFoundation                      0x00b6fa94 __exceptionPreprocess + 180
  1   libobjc.A.dylib                     0x00630e02 objc_exception_throw + 50
  2   CoreFoundation                      0x00b6f9bd +[NSException raise:format:] + 141
  3   XCTest                              0x0011a2a0 +[_XCTestCaseInterruptionException interruptTest] + 57
  4   XCTest                              0x0011ac6c -[XCTestCase _interruptTest] + 789
  5   XCTest                              0x0011ada6 -[XCTestCase recordFailureWithDescription:inFile:atLine:expected:] + 306
  6   XCTest                              0x0011b09d -[XCTestCase _dequeueFailures] + 751
  7   XCTest                              0x0011b35e -[XCTestCase _enqueueFailureWithDescription:inFile:atLine:expected:] + 547
  8   XCTest                              0x001244b9 _XCTFailureHandler + 1117
  9   XCTest                              0x0011a220 _XCTFailInCurrentTest + 454
  10  XCTest                              0x0013d307 -[XCUIDevice _dispatchEventWithPage:usage:duration:] + 857
  11  XCTest                              0x0013d548 -[XCUIDevice _silentPressButton:] + 74
  12  XCTest                              0x0012bbab -[XCAXClient_iOS init] + 200
  13  libobjc.A.dylib                     0x00645257 +[NSObject new] + 98
  14  XCTest                              0x0012bad7 __30+[XCAXClient_iOS sharedClient]_block_invoke + 37
  15  libdispatch.dylib                   0x02d5d6fd _dispatch_client_callout + 14
  16  libdispatch.dylib                   0x02d494d5 dispatch_once_f + 83
  17  libdispatch.dylib                   0x02d4947d dispatch_once + 31
  18  XCTest                              0x0012bab0 +[XCAXClient_iOS sharedClient] + 61
  19  XCTest                              0x0013ecc5 __37-[XCUIApplication _launchUsingXcode:]_block_invoke + 48
  20  XCTest                              0x0011f924 -[XCTestCase startActivityWithTitle:block:] + 402
  21  XCTest                              0x0013ec8d -[XCUIApplication _launchUsingXcode:] + 341
  22  XCTest                              0x0013eb33 -[XCUIApplication launch] + 41
  23  AppNameUITests                     0x0cccacbd _TFC15AppNameUITests26WARPUINavigationSwipeTests34testAfterLaunchWeAreOnCameraScreenfS0_FT_T_ + 429
  24  AppNameUITests                     0x0cccafd2 _TToFC15AppNameUITests26WARPUINavigationSwipeTests34testAfterLaunchWeAreOnCameraScreenfS0_FT_T_ + 34
  25  CoreFoundation                      0x00a47ccd __invoking___ + 29
  26  CoreFoundation                      0x00a47b76 -[NSInvocation invoke] + 342
  27  XCTest                              0x0011b644 __24-[XCTestCase invokeTest]_block_invoke_2 + 174
  28  XCTest                              0x00153b1f -[XCTestContext performInScope:] + 229
  29  XCTest                              0x0011b589 -[XCTestCase invokeTest] + 193
  30  XCTest                              0x0011bb43 -[XCTestCase performTest:] + 529
  31  XCTest                              0x00145d4a -[XCTest runTest] + 354
  32  XCTest                              0x001191e2 -[XCTestSuite performTest:] + 427
  33  XCTest                              0x00145d4a -[XCTest runTest] + 354
  34  XCTest                              0x001191e2 -[XCTestSuite performTest:] + 427
  35  XCTest                              0x00145d4a -[XCTest runTest] + 354
  36  XCTest                              0x00102cd4 __25-[XCTestDriver _runSuite]_block_invoke + 61
  37  XCTest                              0x00129956 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 736
  38  XCTest                              0x00102bf9 -[XCTestDriver _runSuite] + 491
  39  XCTest                              0x00103c74 -[XCTestDriver _checkForTestManager] + 318
  40  XCTest                              0x00104149 -[XCTestDriver runTestConfiguration:completionHandler:] + 399
  41  XCTest                              0x001551ef _XCTestMain + 715
  42  XCTRunner                           0x0009aba5 XCTRunner + 7077
  43  libdispatch.dylib                   0x02d3fa7f _dispatch_call_block_and_release + 15
  44  libdispatch.dylib                   0x02d5d6fd _dispatch_client_callout + 14
  45  libdispatch.dylib                   0x02d46322 _dispatch_main_queue_callback_4CF + 689
  46  CoreFoundation                      0x00ac170e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
  47  CoreFoundation                      0x00a7f454 __CFRunLoopRun + 2356
  48  CoreFoundation                      0x00a7e866 CFRunLoopRunSpecific + 470
  49  CoreFoundation                      0x00a7e67b CFRunLoopRunInMode + 123
  50  GraphicsServices                    0x025d7664 GSEventRunModal + 192
  51  GraphicsServices                    0x025d74a1 GSEventRun + 104
  52  UIKit                               0x00efecc1 UIApplicationMain + 160
  53  XCTRunner                           0x0009ad09 XCTRunner + 7433
  54  libdyld.dylib                       0x02d82a21 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type _XCTestCaseInterruptionException


Thanks


Chris

Replies

Please file a bug report (using the Report Bugs link at the bottom of this page). Thanks!

I get this too.

Is there a work around in the meantime? This is a fresh install of Xcode 7.0.1 - is there anyway to set the timeout? - if indeed that is the problem?

Not sure if there's a workaround. If there is, we'll let you know through your bug report.

I updated from latest Yosemite to El Capitain and I'm no-longer getting that error......hmmm

Hmm - just installed El Capitan and I'm still getting this error.

Getting the same issue. First screen my app goes to is a UIViewController with just the splash screen image on it. I use this screen to load some data and do some checks before continuing to the login page.


I have 1 UI test, it waits for a UITextField to show up. All works fine locally. Throws the same error as above on the server.


I removed the delay, reduced the time the UI test waits at the start and the error went away. Seems to be that there is an inbuilt timeout that causes the tests to fail if the app doesn't open and start interacting immediately. This is going to be a huge issue for developers, myself included.

UPDATE:


I've removed everything before the login screen, app now opens directly into the login screen with the textfields. Removed the wait from the start of the UI test and now everything is working.


This timeout at the start is a serious blocker to using UI tests

Has anyone tried this with any of the 7.1 betas?

I put bug #23149204 in for this.

UPDATE:


Xcode 7.1, released earlier today, appears to have fixed this 2.5 second XCUIApplication().launch() issue for me, after initial testing.


Is anyone else still having this problem on Xcode 7.1?

I also have experienced this error with El Capitan and Xcode 7.1 and iOS 9. Any idea on how to adjust the timeout? I think I've tried everything at this point. The tests I have written are completely and consistently not working.

Here too, hitting the issue with El Capitan and Xcode 7.0... I can workaround by running a compile first to cache everything, thereby speeding up the load time. But hopefully fixed in v7.1 or shortly thereafter.

It looks like 7.1 may have increased the timeout from 2.5 to 10 seconds, but this is unfortunately not long enough for the mid-2010 Mac Mini that I use as a continuous integration server.

Please file a bug report to let us know that the timeout is still too aggressive. Would be much appreciated!