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(testFileType) ⇒ Object

parseTestStepData



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

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

.read_test_data(testFileName) ⇒ 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(testFileName)
  # get the file type
  fileType = File.extname(testFileName)
  if (fileType.casecmp(@XlsxFileNameType) == 0)
    MyLog.log.info "Processing test file: #{testFileName}"
    MyLog.log.info "Browser Type: #{$browserType}"
    $xlsxDoc = RubyXL::Parser.parse(testFileName)
    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: '#{testFileName}' " \
                       "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