Module: Parser

Defined in:
lib/parser/parser.rb

Overview

Created on 02 Aug 2018 @author: Andy Perrett

Versions: 1.0 - Baseline

parser.rb - basic parser functions

Class Method Summary collapse

Class Method Details

.parse_test_step_data(test_file_type) ⇒ Object

parseTestStepData



44
45
46
# File 'lib/parser/parser.rb', line 44

def self.parse_test_step_data(test_file_type)
  XlsxParser.parse_test_step_data(test_file_type)
end

.read_test_data(test_file_name) ⇒ Object

readTestData



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/parser/parser.rb', line 20

def self.read_test_data(test_file_name)
  # get the file type
  file_type = File.extname(test_file_name)
  if file_type.casecmp(@xlsx_file_name_type).zero?
    MyLog.log.info "Processing test file: #{test_file_name}"
    MyLog.log.info "Browser Type: #{$browserType}"
    $xlsxDoc = RubyXL::Parser.parse(test_file_name)
    XlsxParser.parse_xlxs_test_header_data
    return 'XLSX'
  else
    # if unable to read the test file list then construct a custom error
    # message and raise an exception.
    error_to_display = "Test File Name: '#{test_file_name}' " \
                       'type not recognised (must be .xslx)'
    raise IOError, error_to_display
  end

  # if an error occurred reading the test file list then
  # re-raise the exception.
rescue StandardError => error
  raise IOError, error
end

.test_filesObject



13
14
15
16
17
# File 'lib/parser/parser.rb', line 13

def self.test_files
  @test_files ||= Dir.glob("#{$testcasesFolder}/*.xlsx").reject do |file|
    File.basename(file).start_with?('~$')
  end.sort
end