Class: ParallelCalabash::AndroidRunner
- Inherits:
-
Object
- Object
- ParallelCalabash::AndroidRunner
- Includes:
- Runner
- Defined in:
- lib/parallel_calabash/runner.rb
Instance Method Summary collapse
- #base_command ⇒ Object
- #command_for_test(process_number, base_command, apk_path, cucumber_options, test_files) ⇒ Object
-
#initialize(device_helper, silence) ⇒ AndroidRunner
constructor
A new instance of AndroidRunner.
- #prepare_for_parallel_execution ⇒ Object
- #run_tests(test_files, process_number, options) ⇒ Object
Methods included from Runner
#execute_command_for_process, #show_output
Constructor Details
#initialize(device_helper, silence) ⇒ AndroidRunner
Returns a new instance of AndroidRunner.
39 40 41 42 |
# File 'lib/parallel_calabash/runner.rb', line 39 def initialize(device_helper, silence) @device_helper = device_helper @silence = silence end |
Instance Method Details
#base_command ⇒ Object
48 49 50 |
# 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) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/parallel_calabash/runner.rb', line 61 def command_for_test(process_number, base_command, apk_path, , test_files) cmd = [base_command, apk_path, , *test_files].compact*' ' device_id, device_info = @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: device_id.to_s + '_' } 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 ⇒ Object
44 45 46 |
# 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) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/parallel_calabash/runner.rb', line 52 def run_tests(test_files, process_number, ) cmd = command_for_test( process_number, base_command, [: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 |