Class: ParallelCucumber::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/parallel_cucumber/cli.rb

Constant Summary collapse

DEFAULTS =
{
  batch_size: 1,
  batch_timeout: 600,
  setup_timeout: 30,
  precheck_timeout: 30,
  batch_error_timeout: 30,
  cucumber_options: '',
  debug: false,
  directed_tests: {},
  log_dir: '.',
  log_decoration: {},
  env_variables: {},
  n: 0, # Default: computed from longest list in json parameters, minimum 1.
  queue_connection_params: ['redis://127.0.0.1:6379', DateTime.now.strftime('queue-%Y%m%d%H%M%S')],
  worker_delay: 0,
  test_command: 'cucumber',
  backup_worker_count: 0
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Cli

Returns a new instance of Cli.



26
27
28
29
30
31
32
33
34
35
# File 'lib/parallel_cucumber/cli.rb', line 26

def initialize(argv)
  @argv = argv
  @logger = ParallelCucumber::CustomLogger.new(STDOUT)
  @logger.progname = 'CLI'
  @logger.level = if @argv.include?('--debug')
                    ParallelCucumber::CustomLogger::DEBUG
                  else
                    ParallelCucumber::CustomLogger::INFO
                  end
end

Instance Method Details

#runObject



37
38
39
40
41
42
43
44
# File 'lib/parallel_cucumber/cli.rb', line 37

def run
  options = parse_options!(@argv)
  message = <<-LOG
      Running parallel_cucumber with options: #{options.map { |k, v| "#{k}=#{v}" }.join(', ')}
  LOG
  @logger.debug(message)
  ParallelCucumber::Main.new(options).run
end