我的测试没有开始执行,每次我尝试使用 xcodebuild 命令时总是超时。
我使用的命令如下:
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
它经历了构建应用程序的过程,但随后测试并未开始执行。事实上,模拟器甚至没有启动,我收到以下错误。
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
有人知道怎么解决吗?在过去的 2 周里,我一直在为此绞尽脑汁,但想不通。
最佳答案
自 xcode 9 以来,xcode 构建命令已更改。因此您必须更改构建命令。
按照上述步骤:
首先构建项目。构建应用程序的命令是
xcodebuild build-for-testing -workspace "Your.xcworkspace" -scheme "UpgradeAll" -destination "platform=iOS Simulator,name=iPad Air,OS=11.0" -derivedDataPath "All"
然后使用它执行测试命令。
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"
关于ios - Xcode 9 - Xcodebuild 错误 - UI 测试未运行,等待 AX 加载通知超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48013914/