class ParallelCalabash::AndroidRunner

Public Class Methods

new(device_helper, silence) click to toggle source
# File lib/parallel_calabash/runner.rb, line 39
def initialize(device_helper, silence)
  @device_helper = device_helper
  @silence = silence
end

Public Instance Methods

base_command() click to toggle source
# File lib/parallel_calabash/runner.rb, line 48
def base_command
  'calabash-android run'
end
command_for_test(process_number, base_command, apk_path, cucumber_options, test_files) click to toggle source
# File lib/parallel_calabash/runner.rb, line 61
def command_for_test(process_number, base_command, apk_path, cucumber_options, test_files)
  cmd = [base_command, apk_path, cucumber_options, *test_files].compact*' '
  device_id, device_info, screenshot_prefix = @device_helper.device_for_process process_number
  env = {
      AUTOTEST: '1',
      ADB_DEVICE_ARG: device_id,
      DEVICE_INFO: device_info,
      TEST_PROCESS_NUMBER: (process_number+1).to_s,
      SCREENSHOT_PATH: screenshot_prefix
  }
  separator = (WINDOWS ? ' & ' : ';')
  exports = env.map { |k, v| WINDOWS ? "(SET \"#{k}=#{v}\")" : "#{k}=#{v};export #{k}" }.join(separator)
  exports + separator + cmd
end
prepare_for_parallel_execution() click to toggle source
# File lib/parallel_calabash/runner.rb, line 44
def prepare_for_parallel_execution
  # Android is fairly sane....
end
run_tests(test_files, process_number, options) click to toggle source
# File lib/parallel_calabash/runner.rb, line 52
def run_tests(test_files, process_number, options)
  cmd = command_for_test(
      process_number, base_command, options[:apk_path],
      "#{options[:cucumber_options]} #{options[:cucumber_reports]}", test_files)
  $stdout.print "#{process_number}>> Command: #{cmd}\n"
  $stdout.flush
  execute_command_for_process(process_number, cmd)
end