0

我正在尝试启动测试服务器,但出现以下错误。请有人给我解决方案。我尝试了 gem 版本的不同组合,但没有运气。感谢对此的快速帮助。

我正在使用类似的命令

DEVICE_TARGET='iPhone 5 (9.2)' calabash-ios console


irb(main):001:0> start_test_server_in_background

ArgumentError:无法从 /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/run_loop-2.1.1/lib/run_loop/device.rb 找到具有 UDID 或名称与“iPhone”匹配的设备:126:in device_with_identifier' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/run_loop-2.1.1/lib/run_loop/device.rb:160:indetect_device' 来自 /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/run_loop-2.1.1/lib/run_loop/core.rb:71:in run_with_options' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/run_loop-2.1.1/lib/run_loop.rb:134:inrun' 来自 /Users/ test/.rvm/gems/ruby-2.0.0-p353/gems/calabash-cucumber-0.18.1/lib/calabash-cucumber/launcher.rb:718:in block in new_run_loop' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/calabash-cucumber-0.18.1/lib/calabash-cucumber/launcher.rb:716:intimes' 来自 /Users/test/.rvm/gems /ruby-2.0.0-p353/gems/calabash-cucumber-0.18.1/lib/calabash-cucumber/launcher.rb:716:in relaunch new_run_loop' from /Users/test/.rvm/gems/ruby-2.0.0-p353/gems/calabash-cucumber-0.18.1/lib/calabash-cucumber/launcher.rb:584:in' 来自 /Users/test/.rvm/gems/ruby-2.0.0 -p353/gems/calabash-cucumber-0.18.1/lib/calabash-cucumber/core.rb:943:in start_test_server_in_background' from (irb):1 from /Users/test/.rvm/rubies/ruby-2.0.0-p353/bin/irb:12:in'

4

1 回答 1

0

更新

从您的评论来看,您似乎正在尝试在物理设备上启动,而不是在模拟器上启动。这令人困惑,因为“iPhone 5 (9.2)”与模拟器具有相同的命名约定。

当您以物理设备为目标时,您需要使用该设备的 UDID,您可以在以下输出的前几行中找到它instruments

$ xcrun instruments -s devices
stern [4AFA58C7-5D39-54D0-9733-04302E7XXXXX]
neptune (9.3.1) [43be3f89d9587e9468c24672777ff6241bdXXXXX]
uranus (9.3.1) [6c3ed5434b5dfc29758f8835644b55bd43XXXXX]
Apple TV 1080p (9.0) [D6875A98-2C0E-4138-85EF-841025A54DE0] (Simulator)
# the rest are simulators.

在上面的例子中:

* stern is the host computer.
* neptune and uranus are physical devices.

瞄准海王星:

$ DEVICE_TARGET=43be3f89d9587e9468c24672777ff6241bdXXXXX \
  DEVICE_ENDPOINT=http://<ip of your device>:37265 \
  calabash-ios console

如果您明智地命名您的设备,您也可以这样做:

$ DEVICE_TARGET=neptune \
  DEVICE_ENDPOINT=http://<ip of your device>:37265 \
  calabash-ios console

我怀疑由于您的物理设备名称与模拟器名称完全匹配,Calabash 对您想要定位的设备感到困惑。

回顾一下:您有两个选择:

 1. Use the UDID you get from instruments.
 $ DEVICE_TARGET=43be3f89d9587e9468c24672777ff6241bdXXXXX \
   DEVICE_ENDPOINT=http://<ip of your device>:37265 \
   calabash-ios console

 2. Rename your device to something like "iphone5"
 $ DEVICE_TARGET=iphone5 \
   DEVICE_ENDPOINT=http://<ip of your device>:37265 \
   calabash-ios console

您可能会发现物理设备上的测试wiki 页面很有帮助。

上一个答案

你试过"引号吗?

$ DEVICE_TARGET="iPhone 5 (9.2)" calabash-ios console

ArgumentError:找不到具有 UDID 或名称与“iPhone”匹配的设备

由于某种原因,运行循环缺少字符串的“5 (9.2)”部分。

我能想到的唯一另一件事是您没有安装 iPhone 5 iOS 9.2 模拟器。你在 Xcode 中看到了吗?

您也可以尝试直接使用 UDID。

# List the available simulators
$ xcrun instruments -s devices
<snip>
iPhone 6 Plus (9.3) [D6AFEDFE-2E02-4A33-AEC8-740053DDC6DE] (Simulator)

 # Use the UDID directly.
 $ DEVICE_TARGET="D6AFEDFE-2E02-4A33-AEC8-740053DDC6DE" calabash-ios console
于 2016-05-11T11:09:52.410 回答