class SpecData

Public Class Methods

add_spec_stats_to_suite_stats() click to toggle source
# File lib/spec_data.rb, line 58
def self.add_spec_stats_to_suite_stats
  $verifications_total += $verification_passes
  $warnings_total += execution_warnings.length
  $errors_total += verification_errors.length
end
clear_all_spec_stats() click to toggle source
# File lib/spec_data.rb, line 64
def self.clear_all_spec_stats
  $verifications_total = 0
  $warnings_total = 0
  $errors_total = 0
end
clear_spec_state() click to toggle source
# File lib/spec_data.rb, line 15
def self.clear_spec_state
  execution_warnings.clear
  verification_errors.clear
  $verification_passes = 0
  $fail_test_instantly = false
  $fail_test_at_end = false
end
determine_spec_result() click to toggle source
# File lib/spec_data.rb, line 30
def self.determine_spec_result
  if execution_warnings.empty?
    Log.info("[GRIDIUM::SpecData] No warnings detected during test run.")
  else
    Log.info("[GRIDIUM::SpecData]Warnings detected during test run: (#{execution_warnings.length} total).")
    msg = "Warning detected during test execution:"
    execution_warnings.each { |error_message| msg << "\n\t" + error_message }
  end

  if verification_errors.empty?
    Log.info("[GRIDIUM::SpecData]No errors detected during test run.")
  else
    Log.info("[GRIDIUM::SpecData]Errors detected during test run: (#{verification_errors.length} total).")
    msg = "TEST FAILURE: Errors detected during test execution:"
    verification_errors.each { |error_message| msg << "\n\t" + error_message }
  end

  if $fail_test_instantly
    Log.info("[GRIDIUM::SpecData]TEST FAILED - CRITICAL ERROR DETECTED")
    Kernel.fail("TEST FAILED - CRITICAL ERROR DETECTED\n")
  elsif $fail_test_at_end
    Log.info("[GRIDIUM::SpecData]TEST FAILED - VERIFICATION ERRORS DETECTED")
    Kernel.fail("TEST FAILED - VERIFICATION ERRORS DETECTED\n")
  else
    Log.info("[GRIDIUM::SpecData]TEST PASSED\n")
  end
end
execution_warnings() click to toggle source
# File lib/spec_data.rb, line 78
def self.execution_warnings
  @execution_warnings ||= Array.new
end
load_spec_state() click to toggle source
# File lib/spec_data.rb, line 7
def self.load_spec_state
  execution_warnings
  verification_errors
  $verification_passes = 0
  $fail_test_instantly = false
  $fail_test_at_end = false
end
load_suite_state() click to toggle source
# File lib/spec_data.rb, line 2
def self.load_suite_state
  screenshots_message
  screenshots_captured
end
reset_captured_screenshots() click to toggle source
# File lib/spec_data.rb, line 23
def self.reset_captured_screenshots
  screenshots_message.clear
  screenshots_captured.clear
  $screenshots_data = {}
  $fail_screenshot = nil
end
screenshots_captured() click to toggle source
# File lib/spec_data.rb, line 74
def self.screenshots_captured
  @screenshots_captured ||= Array.new
end
screenshots_message() click to toggle source
# File lib/spec_data.rb, line 70
def self.screenshots_message
  @screenshots_message ||= Array.new
end
verification_errors() click to toggle source
# File lib/spec_data.rb, line 82
def self.verification_errors
  @verification_errors ||= Array.new
end