Module: CMDLine
- Defined in:
- lib/utils/cmd_line.rb
Overview
Created on 13 May 2019 @author: Andy Perrett
Versions: 1.0 - Baseline
cmd_line.rb - command line script Script
Class Method Summary collapse
Class Method Details
.browser_type ⇒ Object
64 65 66 |
# File 'lib/utils/cmd_line.rb', line 64 def self.browser_type @browser_type end |
.cmdline_input ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/utils/cmd_line.rb', line 13 def self.cmdline_input # check if the test suite file name exists on the command line # allow a user to input 2 arguments in to CMD line the 2 values are: # Testcase Folder and Browser. = {} ARGV.push('-h') if ARGV.empty? OptionParser.new do |parser| # Whenever we see -b, -t or --browser, or --tests with an # argument, save the argument. parser. = 'Usage: taf [options]' parser.on( '-h', '--help', "2 arguments are required: {Browser} {Testcase folder}'" ) do puts parser Process.exit end parser.on( '-b', '--browser browser', 'Supported Browsers: chrome,' \ ' chrome-headless, firefox, firefox-headless' ) do |b| [:browser] = b @browser_type = [:browser] unless ['chrome', 'chrome-headless', 'firefox', 'firefox-headless'] .include?(@browser_type) MyLog.log.warn 'A valid Browser has not been supplied as a' \ ' command-line parameter as expected' Process.exit end end parser.on('-t', '--tests testfolder', 'i.e. tests/') do |t| [:testfolder] = t @tests_folder = [:testfolder] if Parser.test_files.size.positive? MyLog.log.info "There are: #{Parser.test_files.size}" \ ' test files to process' MyLog.log.info "List of Tests files: #{Parser.test_files} \n" else MyLog.log.warn 'A valid Test case location has not been supplied' \ ' as a command-line parameter as expected' Process.exit end end end.parse! end |
.tests_folder ⇒ Object
68 69 70 |
# File 'lib/utils/cmd_line.rb', line 68 def self.tests_folder @tests_folder end |