class ADBRunner
Attributes
callback[RW]
Public Instance Methods
execute_test(runner:, package:, test_name:, class_name:)
click to toggle source
# File lib/quokkadb/adb_runner.rb, line 12 def execute_test(runner:, package:, test_name:, class_name:) puts("adb shell am instrument -w -e class #{class_name}##{test_name} #{package}/#{runner}") `adb shell am instrument -w -e class #{class_name}##{test_name} #{package}/#{runner}` end
find_tests(runner:, package:, serial: nil, annotation: nil, shards: nil, index: nil)
click to toggle source
# File lib/quokkadb/adb_runner.rb, line 7 def find_tests(runner:, package:, serial: nil, annotation: nil, shards: nil, index: nil) puts("adb #{serial ? "-s #{serial}" : ''} shell am instrument #{annotation ? "-e annotation #{annotation}" : ''} -e numShards 4 -e shardIndex 0 -r -w #{package}/#{runner}\n") `adb #{serial ? "-s #{serial}" : ''} shell am instrument #{annotation ? "-e annotation #{annotation}" : ''} #{shards ? "-e numShards #{shards}" : ''} #{index ? "-e shardIndex #{index}" : ''} -e log true -r -w #{package}/#{runner}` end
generate_sharding_options(shards:, index:)
click to toggle source
# File lib/quokkadb/adb_runner.rb, line 41 def generate_sharding_options(shards:, index:) return "" unless shards "#{shards != '' ? "-e numShards #{shards}" : ''} #{index && index != '' ? "-e shardIndex #{index}" : ''}" end
mass_execute(runner:, package:, tests:)
click to toggle source
# File lib/quokkadb/adb_runner.rb, line 17 def mass_execute(runner:, package:, tests:) tests_list = [] tests.each do |test_info| tests_list.push("#{test_info.class_name}##{test_info.name}") end puts("adb shell am instrument -w -e class #{tests_list.join(',')} #{package}/#{runner}") `adb shell am instrument -w -e class #{tests_list.join(',')} -r #{package}/#{runner}` end
run_tests(runner:, package:, serial: nil, annotation: nil, shards: nil, index: nil)
click to toggle source
# File lib/quokkadb/adb_runner.rb, line 27 def run_tests(runner:, package:, serial: nil, annotation: nil, shards: nil, index: nil) command = "adb #{serial ? "-s #{serial}" : ''} shell am instrument #{annotation ? "-e annotation #{annotation}" : ''} #{generate_sharding_options(shards: shards, index: index)} -r -w #{package}/#{runner}" puts("Command: #{command}") Open3.popen2(command) do |stdin, stdout_err, wait_thr| while line = stdout_err.gets @callback.call(line) end exit_status = wait_thr.value unless exit_status.success? @callback.call("FAILURES!!!") end end end