Xcode 12 UI Tests Launch Time Extremely Slow

We have noticed a 4X increase in app launch time for UI tests in Xcode 12 compared with Xcode 11. App launch times were typically ~15 seconds and are now approximately ~75 seconds.

When I pause the debugger, I can see that it is hanging on
Code Block
XCUIApplication.launch()

  1. Is this a known issue? Are others experiencing this issue?

  2. Should we be expecting to see this increase?

  3. Are there mitigations we can implement to improve the launch time?

We are not aware of any regression in that area. To investigate this, could you please file a feedback report and attach

a) the result bundle of a test run
b) a matching sysdiagnose of the device / simulator taken after the test finished

for both the Xcode 11 scenario and the Xcode 12 one?

Thank you!
Feedback report has been filed (FB8546638)
Is this on a physical device?

If yes, the slow launch times might be the same problem as in this three Xcode 12 Beta 4, long time for Debug launch on iOS 14 b4.

What helped for me: Deleting the content of ~/Library/Developer/Xcode/iOS DeviceSupport/
(This seems to be a cache of installed dynamic libraries and frameworks. Probably to be able to "symbolicate" the call stacks.)
I also have issues when launching the app on a real device. It freezes on app launch and fails after some time. There is no way to go after app launch. The log file stopped after t =  15.14s     Setting up automation session .
There is the following error then
TestCase.swift:135: error: -[UITests.Tests testPlan] : Failed to get automation session for x.y.z:350: Timed out while requesting automation session for x.y.z (pid:350).
After that, tearDown() is called


It works fine on simulator.
Did you find any fix for that ?
Same here
I also has this issue

mac os catalina,Xcode Version 12.3 (12C33) , iPhon11 14.2


my test code is easy

Code Block l
 XCUIApplication *app = [[XCUIApplication alloc] init];
 [app launch];



if I run test case with Xocode, I get error

failed to get automation session for com.xxxxxx.xxxx:0: Timed out while requesting automation session for com.xxxxxx.xxxx (pid:44238).

if I run with xcodebuild

Code Block shell
xcodebuild build-for-testing -project ${script_dir}/***.xcodeproj \
-scheme *** -destination "platform=iOS,name=***" test -only-testing:***/***/testExample


I get

Failed to get automation session for com.xxxx:44179: Unable to communicate with helper. . Please retry the operation. If it fails, please exit and restart the application, and then try again。. connection on mach service named com.apple.dt.xctestd.target from pid 44179

but in iPhone7, 14.2 is OK,so any bug in iPhon11?

I has the same problem
Any update/fix for this issue?

I find this issue whenever my script tries to uninstall and install the test app within same test run.

Same issue here. UI tests consistently take over 30sec, sometimes up to 60sec or more, to start up. Running Xcode 12.4 with iOS8 simulator.

Same issue here, with XCode 12.5 and iPhone 11 (iOS 14.5) simulator.

Hello, I also get this issue, but in my CI/CD pipeline on GitHub Actions. I'm testing this locally with fastlane and it works fine, but when I run the tests in the server, I receive the same error as some has mentioned above.

Failed to get automation session for com.***.mobile.ios.xx.***:19096: Timed out while requesting automation session for com.***.mobile.ios.***.xx (pid:19096).

I've tried:

  • Running on different simulators, iPhone 11, iPhone 8 etc.
  • prelaunch_simulator <-- ended in a a loop

I found this in the log

SimDevice: iPhone 8 (D24B8183-F18A-4A00-87FD-8B49D06619A6, iOS 14.4, Shutdown)

Does it mean that it's not launching the simulator?

EDIT: Had a clean build on the project. This solved my issue!

Xcode 12 UI Tests Launch Time Extremely Slow
 
 
Q