iosrubytestingcalabashxamarin-test-cloud

Error executing Calabash iOS tests Xamarin Test Cloud


I've various tests written in Calabash using Ruby. I've tried the tests locally on the simulator and on a physical device and there wasn't any issues but, when I try to execute them on the Xamarin Test Cloud it throws an error relative to the Calabash launcher. I've changed the 01_launch.rb file several times and the error persists. This is the log file:

{"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'

I've been searching about this issue but I don't find anything related. I'm trying to test the platform in order to use it in a CI environment for a large iOS and Android app. Any help would be welcome.

Update: I've been able to run the test on a physical device on my local machine with these settings but the Xamarin Test Cloud tests still failing. The failing line is at the Before hook is:

launcher.relaunch(options)

This is the 01_launch.rb file:

# 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

I've used the calabash-cucumber (0.20.3) and the run_loop (2.2.2) gems.

Thanks. P.S: The app_id is omitted, in the tests the real app_id is setted correctly.


Solution

  • You are probably referencing RunLoop::Xcode in your hooks. If you provide a gist of your 01_launch.rb, I might be able to help.

    ^ Thanks!

    The bug that was causing this has been fixed.