执行 Calabash iOS 测试时出错 Xamarin Test Cloud

Error executing Calabash iOS tests Xamarin Test Cloud

我使用 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 Test Cloud 测试仍然失败。 失败行在 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) 宝石。

谢谢。 P.S:省略了app_id,在测试中真正的app_id设置正确。

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

^ 谢谢!

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