Method: Beaker::TestSuite#initialize

Defined in:
lib/beaker/test_suite.rb

#initialize(name, hosts, options, timestamp, fail_mode = nil) ⇒ TestSuite

Create Beaker::TestSuite instance

Parameters:

  • name (String)

    The name of the Beaker::TestSuite

  • hosts (Array<Host>)

    An Array of Hosts to act upon.

  • options (Hash{Symbol=>String})

    Options for this object

  • fail_mode (Symbol) (defaults to: nil)

    One of :slow, :fast

  • timestamp (Time)

    Beaker execution start time

Options Hash (options):

  • :logger (Logger)

    The Logger object to report information to

  • :log_dir (String)

    The directory where text run logs will be written

  • :xml_dir (String)

    The directory where JUnit XML file will be written

  • :xml_file (String)

    The name of the JUnit XML file to be written to

  • :project_root (String)

    The full path to the Beaker lib directory

  • :xml_stylesheet (String)

    The path to a stylesheet to be applied to the generated XML output



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/beaker/test_suite.rb', line 26

def initialize(name, hosts, options, timestamp, fail_mode=nil)
  @logger     = options[:logger]
  @test_cases = []
  @test_files = options[name]
  @name       = name.to_s.gsub(/\s+/, '-')
  @hosts      = hosts
  @run        = false
  @options    = options
  @fail_mode  = fail_mode || @options[:fail_mode] || :slow
  @test_suite_results = TestSuiteResult.new(@options, name)
  @timestamp = timestamp

  report_and_raise(@logger, RuntimeError.new("#{@name}: no test files found..."), "TestSuite: initialize") if @test_files.empty?

rescue => e
  report_and_raise(@logger, e, "TestSuite: initialize")
end