Module: TestSteps

Defined in:
lib/utils/test_steps.rb,
lib/functions/handlers/login.rb,
lib/functions/handlers/ipause.rb,
lib/functions/handlers/open_url.rb,
lib/functions/handlers/check_box.rb,
lib/functions/handlers/check_url.rb,
lib/functions/handlers/ping_test.rb,
lib/functions/handlers/check_logs.rb,
lib/functions/handlers/base_handler.rb,
lib/functions/handlers/browser_back.rb,
lib/functions/handlers/browser_quit.rb,
lib/functions/handlers/click_button.rb,
lib/functions/handlers/radio_button.rb,
lib/functions/handlers/capture_alert.rb,
lib/functions/handlers/check_boxdata.rb,
lib/functions/handlers/write_box_data.rb,
lib/functions/handlers/browser_forward.rb,
lib/functions/handlers/browser_refresh.rb,
lib/functions/handlers/select_dropdown.rb,
lib/functions/handlers/check_screendata.rb,
lib/functions/handlers/send_special_keys.rb,
lib/functions/handlers/check_browser_title.rb,
lib/functions/handlers/handle_browser_window.rb,
lib/functions/handlers/execute_system_command.rb,
lib/functions/handlers/list_all_dropdowns_values.rb

Overview

Created on 20 Sept 2017 @author: Andy Perrett

Versions: 1.0 - Baseline

test_steps.rb - process the required test step functions

Defined Under Namespace

Modules: Handlers

Class Method Summary collapse

Class Method Details

.handlersObject



13
14
15
# File 'lib/utils/test_steps.rb', line 13

def self.handlers
  @handlers ||= {}
end

.process_test_steps(test_file_name, test_step_idx, step_attributes) ⇒ Object

process the test step data by matching the test step functions and processing the associated data accordingly



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/utils/test_steps.rb', line 19

def self.process_test_steps(test_file_name, test_step_idx, step_attributes)
  # print the test step information
  Report.print_test_step_header(test_file_name, test_step_idx,
                                step_attributes[:testdesc])
  runtest = step_attributes[:skipTestCase]
  step_function = step_attributes[:testFunction]
  handler = handlers[step_function.to_s]

  if handler.respond_to?(:perform)
    func = handler.perform(step_attributes) if runtest == false
    Report.test_pass_fail(func, test_file_name, test_step_idx)
    Report.check_failure_threshold(test_file_name)
    return true
  else
    MyLog.log.warn "\nUnable to match function: #{step_function}"
    raise UnknownTestStep, "Unknown test step: #{step_function}"
  end
end