2016-03-03 29 views
1

上下文如何判断蟑螂不会在模拟器暂停时暂停......慢慢地运动?

我有一台运行Xcode的Mac Mini,并运行一系列Cucumber测试并运行Calabash。

问题

他们失败,因为模拟器需要很长(可能50秒),以启动和运行。我试图通过timeout启动选项(按照文档将它们传递给我的电话前),但我仍然失败,并且我还没有理解如何在calabash-ios console模式下使用启动选项。

我通过源找到的东西没有记录here的希望读书。

其实我从this question取得任何进展:

calabash-ios console 
> Running irb... 
> irb(main):001:0> start_test_server_in_background(:timeout => 6000) 
> RunLoop::Xcrun::TimeoutError: Xcrun timed out after 30.30 seconds executing 
> xcrun instruments -s templates 
> with a timeout of 30 

我可以完全禁用启动超时,并我将如何做到这一点(保存编辑蠡源...)?

+0

我相信这是http://stackoverflow.com/questions/24075107/how-to-pass-in-timeout-for-cucumber-command-as-in-start-test-server的副本-in-backgroun至于添加启动选项,您可以像这样将它们放在前面“DEVICE_TARGET ='iPhone 6(9.1)'DEBUG = 1 calabash-ios console”。这也花了我一些时间并帮助弄清楚。 – Lasse

回答

3

这不是很明显,但有一种方法。从xcrun.rb(这实际上是在run_loop宝石),

# You can override these values if they do not work in your environment. 
# 
# For cucumber users, the best place to override would be in your 
# features/support/env.rb. 
# 
# For example: 
# 
# RunLoop::Xcrun::DEFAULT_OPTIONS[:timeout] = 60 

让我知道,如果不为你工作。

至于完全禁用它,我认为只是使用巨大的超时值更容易。请记住,超时是有原因的。如果你的模拟器实际上卡住了,并且由于某种原因无法启动,那么有一些超时保证是合理的。

+0

它真的没有卡住,但速度很慢(机器让我疯狂地手动启动模拟器,我在等我的公司订购一台新机器......)。你对使用巨大的价值是正确的,我会尝试你的技巧并报告回来! – Kheldar

+1

@Kheldar'我可以完全禁用启动超时[无需修改葫芦形源]'的答案是否定的。见https://github.com/calabash/run_loop/blob/ef787180a27903ea55c50467e7b90821d0c7a3a2/lib/run_loop/device.rb#L405我不认为这将是很难修改,如果你想做一个回购叉,但通常情况下,超时会更容易。 –

1

不能忍受缓慢

必须更新到新计算机。我推荐SSD驱动器 - 它会真的加快你的模拟器测试。

除了RunLoop::Xcrun::DEFAULT_OPTIONS[:timeout]RunLoop::CoreSimulator::DEFAULT_OPTIONS

# These options control various aspects of an app's life cycle on the iOS 
    # Simulator. 
    # 
    # You can override these values if they do not work in your environment. 
    # 
    # For cucumber users, the best place to override would be in your 
    # features/support/env.rb. 
    # 
    # For example: 
    # 
    # RunLoop::CoreSimulator::DEFAULT_OPTIONS[:install_app_timeout] = 60 
    DEFAULT_OPTIONS = { 
    # In most cases 30 seconds is a reasonable amount of time to wait for an 
    # install. When testing larger apps, on slow machines, or in CI, this 
    # value may need to be higher. 120 is the default for CI. 
    :install_app_timeout => RunLoop::Environment.ci? ? 120 : 30, 
    :uninstall_app_timeout => RunLoop::Environment.ci? ? 120 : 30, 
    :launch_app_timeout => RunLoop::Environment.ci? ? 120 : 30, 
    :wait_for_state_timeout => RunLoop::Environment.ci? ? 120 : 30 
    } 
+0

[是的,我同意,我确实需要一台新机器。等待适当的部门提供。]现在,我试图找出如何发送xcodebuild的一个-project选项,因为我的团队想要在统一的构建系统中的多个项目和平台上运行测试。那可能吗? – Kheldar

+0

使用xcodebuild是一个单独的问题。请不要在评论中提出有关其他主题的问题 - 提出一个新问题。查看这些项目中的Makefile和bin/make脚本https://github.com/calabash/ios-smoke-test-app/tree/master/CalSmokeApp | https://github.com/calabash/Permissions 100%可能。 100%推荐。 – jmoody