Xcode 9 - Xcodebuild error - UI tests not running, Timed out waiting for AX loaded notification

耗尽温柔 提交于 2021-02-10 04:11:57

问题


My tests do not start executing, and always timeout every time I try to use an xcodebuild command.

The command that I used is the following:

xcodebuild -workspace App.xcworkspace -scheme 'AppName' -sdk iphonesimulator -configuration 'UI_Automation' CODE_SIGN_STYLE='Manual' CODE_SIGN_IDENTITY='iPhone Developer: John Smith (XXXXXXXX)' PROVISIONING_PROFILE_SPECIFIER='John Smith PP Name' DEVELOPMENT_TEAM='ABC Company Apple DEV' -destination 'platform=iOS Simulator,name=iPhone 8,OS=11.2' -destination-timeout 600 -only-testing:AppUITests clean test

It goes through a process where the app is built, but then the tests do not start executing. As a matter of fact, the Simulator does not even start, and I get the following error.

Testing failed:
Timed out waiting for AX loaded notification If you believe this error represents a bug, please attach the log file at /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/com.apple.dt.XCTest/IDETestRunSession-60333F56-66CA-4C34-8460-3846DCF59C14/AppUITests-F74C4FDD-17EE-44AD-A2BA-DDB1BC0A1D7E/Session-AppUITests-2017-12-28_150211-qwlao1.log

Does anyone know how to fix this? I have been racking my brain around this for the past 2 weeks and can't figure it out.


回答1:


xcode build command changed since xcode 9. So you have to change your build command.

Follow the mentioned steps:

  • First build the project. Command for build app is

    xcodebuild build-for-testing -workspace "Your.xcworkspace" -scheme "UpgradeAll" -destination "platform=iOS Simulator,name=iPad Air,OS=11.0" -derivedDataPath "All"
    
  • Then execute the test command using this.

    xcodebuild test-without-building -xctestrun "All/Build/Products/UpgradeAll_iphonesimulator11.0-x86_64.xctestrun" -destination "platform=iOS Simulator,name=iPad Air,OS=11.0" '-only-testing:YourTestbundleName' -derivedDataPath 'build/reports/bundleName' | tee xcodebuild.log | ios-sim start --devicetypeid "iPad-Air, 11.0" 
    



回答2:


I got this error when trying to run my UI Tests through jenkins. What I did was:

  • Set up Jenkins as a Launch Agent instead of a daemon. (more info here https://medium.com/@ved.pandey/setting-up-jenkins-on-mac-osx-50d8fe16df9f)

  • Grant the jenkins user admin privileges under System Preferences -> Users & Groups -> Jenkins user -> 'Allow user to administer this computer'.

Rebooted my Mac Mini and the UI Tests work now.



来源:https://stackoverflow.com/questions/48013914/xcode-9-xcodebuild-error-ui-tests-not-running-timed-out-waiting-for-ax-load

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!