I am running an AppUITests for an iOS app from Jenkins build script. Unit tests (AppTests) running fine but AppUITests are failed because of the below issue. How can I resolve this issue?
09:19:53.506 XCTRunner[22911:77924] Failed to background test runner within 30.0s. 09:19:53.507 xcodebuild[22835:77541] -[IDETestOperationCoordinator testRunnerSession:initializationForUITestingDidFailWithError:] 09:19:53.507 XCTRunner[22911:77924] Calling completion. 09:19:53.507 xcodebuild[22835:77541] Test operation failure: Failed to background test runner. 09:19:53.507 xcodebuild[22835:77541] _finishWithError:Error Domain=IDETestOperationsObserverErrorDomain Code=13 "Failed to background test runner." UserInfo={NSLocalizedDescription=Failed to background test runner.} didCancel: 1
I had the same issue in our app. It was caused by a permission alert displayed on launch (APN in this case, but it's likely to be the same for any other alert).
Error Domain=IDETestOperationsObserverErrorDomain Code=13 "Failed to background test runner.
Run the UITests before the normal Tests (just change the order in edit scheme
=> Test
=> Info
)
Notes:
XTest
s addUIInterruptionMonitor
method. Or otherwise it could be possible the (normal) Tests will fail the same way (didn't test this scenario).