【问题标题】:Timed out waiting 120 seconds for simulator to boot等待模拟器启动 120 秒超时
【发布时间】:2015-01-18 01:55:57
【问题描述】:

Teamcity 代理(TC 版本为 9.0 EAP)似乎无法通过测试 shell 脚本运行 iOS Simulator

我正在使用Build Step: Command Line,它运行Custom Script 并将参数传递给它。 Teamcity 代理是在 Mac OS X Yosemite 10.10 上使用 shell 脚本 ../bin/mac.launchd.sh 启动的。

来自构建日志的错误:

[12:33:24][Step 2/2] 2014-11-20 11:33:25.421 xcodebuild[28083:289783]  iPhoneSimulator: Timed out waiting 120 seconds for simulator to boot, current state is 1.
[12:33:24][Step 2/2] 
[12:33:24][Step 2/2] Testing failed:
[12:33:24][Step 2/2] Test target app-tests encountered an error (Timed out waiting 120 seconds for simulator to boot, current state is 1. If you believe this error represents a bug, please attach the log file at /var/folders/sz/1lfcb1354xggcnd04_9j5kc40000gp/T/com.apple.dt.XCTest-status/Session-2014-11-20_11:31:25-P1Pjwd.log)
[12:33:24][Step 2/2] ** TEST FAILED **

我用于测试的 shell 脚本:

xcodebuild \
    -sdk iphonesimulator8.1 \
    -destination "name=iPad Air,OS=8.1" \
    -configuration Debug \
    -project "$PROJECTPATH" \
    -scheme app-tests \
    CONFIGURATION_BUILD_DIR="$BUILDPATH" \
    clean test \
    | xcpretty -tc -r junit --output "$BUILDPATH/junit.xml"

我也尝试了这个question 的解决方案,但它没有帮助我。

【问题讨论】:

  • 当我使用 Build Step: Xcode Project 我收到同样的错误:iPhoneSimulator: Could not launch simulator: -10810. Timed out waiting 120 seconds for simulator to boot, current state is 1. ** TEST FAILED **
  • 我在 JetBrains 论坛上开启了讨论:devnet.jetbrains.com/message/5529292#5529292
  • 我的经验是代理必须通过真正的桌面会话启动(即不通过 SSH,我猜通过 launchd 启动可能类似于 SSH)。否则,与 iOS 模拟器的交互无论如何都无法进行。

标签: ios xcode teamcity xcodebuild ocunit


【解决方案1】:

这已经在 cmets 中得到了回答,这里也是苹果论坛讨论它的链接,AFAIK,在苹果改变它之前,这仍然是不可能的

https://devforums.apple.com/message/1040016#1040016

【讨论】:

    【解决方案2】:

    如果有人仍然遇到此错误,您可以使用 simulatorStartupTimeout 在功能中设置所需的超时时间。

    在java中:

    DesiredCapabilities caps = new DesiredCapabilities();
    ...
    caps.setCapability("simulatorStartupTimeout", 5 * 60 * 1000); // 5mn
    ...
    

    https://github.com/appium/appium-xcuitest-driver#simulator

    【讨论】:

      【解决方案3】:

      您的自定义脚本可能需要很长时间才能完成。通过在构建阶段添加一个自定义脚本休眠 5000 秒,我能够复制此问题。

      【讨论】:

      • 您是否收到完全相同的错误消息,即模拟器在启动时超时,iPhoneSimulator: Timed out waiting 120 seconds for simulator to boot, current state is 1.?还是您收到不同的超时消息?我收到问题中提到的超时错误,我的测试不需要那么长时间即可运行。
      • 我说的不是测试,而是构建阶段的自定义脚本。
      • 我明白了。因此,当您添加构建阶段以运行脚本以休眠 5000 时,您的测试失败了,即使自定义脚本是构建过程的一部分而不是测试过程的一部分?我在 Jenkins 上遇到了这个问题,仅供参考。
      • 您的测试目标依赖于应用目标。因此,当您运行测试时,首先编译应用程序,一旦启动应用程序,就会执行测试。这可能是导致超时的问题之一。
      • 也许新的 Xcode 更新 (7.2.1) 会解决这个问题。在更新说明中它说它修复了一个命令行工具问题:"Command line tool 'xcodebuild test' will no longer time out waiting for Simulator.app to launch"
      猜你喜欢
      • 1970-01-01
      • 2017-04-03
      • 2016-01-05
      • 2021-08-31
      • 2018-05-10
      • 2016-11-16
      • 2023-02-05
      • 2012-04-18
      相关资源
      最近更新 更多