_cucumber/lib/options/run_tests_options.rb
#
# Parses the command line supplied to the run-test.rb wrapper script.
#
Parses the command line supplied to the run-test.rb wrapper script.
Parses the command line supplied to the run - test . rb wrapper script .
def parse_command_line(args)
    test_configuration = create_default_test_configuration
    option_parser = OptionParser.new do |opts|
      opts.banner = 'Usage: run-tests.rb [options]'
      opts.separator 'Specific options:'
      opts.on('--host-to-test HOST_TO_TEST', String, 'Run the tests against the specified host e.g http://developers.stage.redhat.com') do |host|
        test_configuration[:host_to_test] = host
      end
      opts.on('--profile PROFILE', String, 'The Cucumber profile to use when running the tests [default=desktop]') do |profile|
        test_configuration[:profile] = profile
      end
      opts.on('--cucumber-tags CUCUMBER_TAGS', String, 'The cucumber tags to use') do |cucumber_tags|
        test_configuration[:cucumber_tags] = cucumber_tags
      end
      opts.on('--driver DRIVER', String, 'The driver to use when running the tests. [default=chrome]') do |driver|
        check_supported_driver(driver)
        test_configuration[:driver] = driver
      end
      opts.on('--use-browserstack', String, 'Run the acceptance tests using Browserstack') do
        test_configuration[:browserstack] = true
      end
       Options supporting the execution of the tests within Docker
      opts.on('--use-docker', 'Run the acceptance tests using Docker') do
        test_configuration[:docker] = true
      end
      opts.on('--browser-count BROWSER_COUNT', String, 'The number of browsers to launch when running the tests with Docker [default=2]') do |browser_count|
        test_configuration[:browser_count] = browser_count.to_i
      end
      opts.on('--update-github-status SHA1', String, 'The SHA to report test results for on GitHub') do |sha1|
        test_configuration[:github_sha1] = sha1
      end
      opts.on_tail('-h', '--help', 'Show this message') do
        puts opts
        Kernel.exit(1)
      end
    end
    begin
      option_parser.parse!(args)
    rescue OptionParser::InvalidOption => e
      puts "{e}"
      option_parser.parse(%w(-h))
    end
     Bind the environment variables required by the tests from the user supplied configuration
    bind_environment_variable('HOST_TO_TEST', test_configuration[:host_to_test])
    bind_environment_variable('CUCUMBER_TAGS', test_configuration[:cucumber_tags])
    bind_profile_environment_variables(test_configuration[:profile])
    bind_driver_environment_variables(test_configuration[:docker], test_configuration[:driver], test_configuration)
    bind_browserstack_environment_variables(test_configuration[:browserstack], test_configuration[:driver])
    bind_github_status_environment_variables(test_configuration[:docker], test_configuration[:github_sha1], test_configuration[:profile])
    build_test_execution_command(test_configuration)
    test_configuration
  end
def parse_command_line ( args ) test_configuration = create_default_test_configuration option_parser = OptionParser . new do | opts | opts . banner = 'Usage: run-tests.rb [options]' opts . separator 'Specific options:' opts . on ( '--host-to-test HOST_TO_TEST' , String , 'Run the tests against the specified host e.g http://developers.stage.redhat.com' ) do | host | test_configuration [ :host_to_test ] = host end opts . on ( '--profile PROFILE' , String , 'The Cucumber profile to use when running the tests [default=desktop]' ) do | profile | test_configuration [ :profile ] = profile end opts . on ( '--cucumber-tags CUCUMBER_TAGS' , String , 'The cucumber tags to use' ) do | cucumber_tags | test_configuration [ :cucumber_tags ] = cucumber_tags end opts . on ( '--driver DRIVER' , String , 'The driver to use when running the tests. [default=chrome]' ) do | driver | check_supported_driver ( driver ) test_configuration [ :driver ] = driver end opts . on ( '--use-browserstack' , String , 'Run the acceptance tests using Browserstack' ) do test_configuration [ :browserstack ] = true end opts . on ( '--use-docker' , 'Run the acceptance tests using Docker' ) do test_configuration [ :docker ] = true end opts . on ( '--browser-count BROWSER_COUNT' , String , 'The number of browsers to launch when running the tests with Docker [default=2]' ) do | browser_count | test_configuration [ :browser_count ] = browser_count . to_i end opts . on ( '--update-github-status SHA1' , String , 'The SHA to report test results for on GitHub' ) do | sha1 | test_configuration [ :github_sha1 ] = sha1 end opts . on_tail ( '-h' , '--help' , 'Show this message' ) do puts opts Kernel . exit ( 1 ) end end begin option_parser . parse! ( args ) rescue OptionParser :: InvalidOption => e puts "#{e}" option_parser . parse ( %w( -h ) ) end bind_environment_variable ( 'HOST_TO_TEST' , test_configuration [ :host_to_test ] ) bind_environment_variable ( 'CUCUMBER_TAGS' , test_configuration [ :cucumber_tags ] ) bind_profile_environment_variables ( test_configuration [ :profile ] ) bind_driver_environment_variables ( test_configuration [ :docker ] , test_configuration [ :driver ] , test_configuration ) bind_browserstack_environment_variables ( test_configuration [ :browserstack ] , test_configuration [ :driver ] ) bind_github_status_environment_variables ( test_configuration [ :docker ] , test_configuration [ :github_sha1 ] , test_configuration [ :profile ] ) build_test_execution_command ( test_configuration ) test_configuration end
Parses the command line supplied to the run-test.rb wrapper script.
Parses the command line supplied to the run - test . rb wrapper script .
# # Options supporting the execution of the tests within Docker # # # Bind the environment variables required by the tests from the user supplied configuration #
args
<not_specific>