ios - Xcode 9 - Xcodebuild 错误 - UI 测试未运行,等待 AX 加载通知超时

标签 ios xcode9 xctest xcodebuild ios-ui-automation

我的测试没有开始执行,每次我尝试使用 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/

相关文章:

android - Flutter重新运行内部StatefulWidget的initState函数

ios - 从 Stanford iOS 7 教程复制的代码出现 'expected expression' 错误

ios - 使用未声明的类型 'MessagingDelegate'

app-store - iTunesConnect - 如何检索现有应用程序的 1024x1024 图标?

ios - 在无效的 indexPath 处捕获了对 rect 的 NSInternalInconsistencyException 请求

ios - 在 iOS Developer Enterprise Program 下开发的 iOS 内部应用程序的分发

iOS 表格 View 查找单元格

ios - 无法启动与模拟器 Xcode 的服务连接

Xcode 10 XCTest 错误 : "Underlying error: Test session exited(1) without checking in.)"

ios - "XXX-Swift.h"测试项目中找不到文件