0

我使用 Ruby 在 Calabash 中编写了各种测试。我已经在模拟器和物理设备上本地尝试了测试,没有任何问题,但是当我尝试在 Xamarin 测试云上执行它们时,它会引发与 Calabash 启动器相关的错误。我已多次更改 01_launch.rb 文件,但错误仍然存​​在。这是日志文件:

{"type":"install","last_exception":{"class":"XTCOperationalError","message":"500\n{\"message\":\"undefined method `strip' for nil:NilClass\",\"app_id\”:\”XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"}","backtrace":null}} (XTCOperationalError)
./xtc-sandbox-runtime-lib/xtc/formatter/patches/calabash_common_patch.rb:64:in `raise_operational_error'
./xtc-sandbox-runtime-lib/xtc/formatter/patches/calabash_ios_patch.rb:223:in `xtc_install_app'
./xtc-sandbox-runtime-lib/xtc/formatter/patches/calabash_ios_patch.rb:129:in `relaunch'
./features/support/01_launch.rb:98:in `launch'
./features/support/01_launch.rb:340:in `Before'

我一直在搜索这个问题,但我没有找到任何相关的东西。我正在尝试测试该平台,以便在大型 iOS 和 Android 应用程序的 CI 环境中使用它。欢迎任何帮助。

更新:我已经能够使用这些设置在本地计算机上的物理设备上运行测试,但 Xamarin 测试云测试仍然失败。失败的线在 Before 钩子是:

launcher.relaunch(options)

这是 01_launch.rb 文件:

# encoding: utf-8

require 'calabash-cucumber/launcher'

module LaunchControl
  @@launcher = nil

  def self.launcher
    @@launcher ||= Calabash::Cucumber::Launcher.new
  end

  def self.launcher=(launcher)
    @@launcher = launcher
  end

  def self.xcode
    Calabash::Cucumber::Environment.xcode
  end

  def self.instruments
    Calabash::Cucumber::Environment.instruments
  end

  def self.simctl
    Calabash::Cucumber::Environment.simctl
  end

  def self.environment
    {
      :simctl => self.simctl,
      :instruments => self.instruments,
      :xcode => self.xcode
    }
  end

  def self.target
    ENV['DEVICE_TARGET'] || RunLoop::Core.default_simulator
  end

  def self.target_is_simulator?
    self.launcher.simulator_target?
  end

  def self.target_is_physical_device?
    self.launcher.device_target?
  end
end

# Delete user data after a scenario tagged with '@reset_settings'
After('@reset_settings') do
  if xamarin_test_cloud?
   ENV['RESET_BETWEEN_SCENARIOS'] = '1'
  elsif LaunchControl.target_is_simulator?
    target = LaunchControl.target
    device = RunLoop::Device.device_with_identifier(target,       LaunchControl.environment)
    RunLoop::CoreSimulator.erase(device)
  else
    LaunchControl.install_on_physical_device
  end
end



Before do |scenario|

  launcher = LaunchControl.launcher
  options = {
  }

 launcher.relaunch(options)

end

After do |scenario|
  if launcher.quit_app_after_scenario?
    calabash_exit
  end
end

我使用了葫芦黄瓜 (0.20.3) 和 run_loop (2.2.2) 宝石。

谢谢。PS: app_id 被省略,在测试中真正的 app_id 设置正确。

4

1 回答 1

0

您可能在挂钩中引用了 RunLoop::Xcode。如果您提供 01_launch.rb 的要点,我可能会提供帮助。

^ 谢谢!

导致此问题的错误已得到修复。

于 2016-12-01T11:46:23.513 回答