Class: LegoTechSelenium::TestSuite

Inherits:
Object
  • Object
show all
Defined in:
lib/ui/test-suites/TestSuite.rb

Defined Under Namespace

Classes: Builder

Instance Method Summary collapse

Constructor Details

#initialize(name, driver) ⇒ TestSuite

Returns a new instance of TestSuite.

Parameters:

  • name (String)

    is the name of the TestSuite

  • driver (Driver)

    is the driver variable



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ui/test-suites/TestSuite.rb', line 8

def initialize(name, driver)
  if name.nil? or name.empty?
    raise "All TestSuites must have a name associated to them"
  end

  if driver.nil?
    raise "Driver must be non nil"
  end
  @name = name
  @driver = driver
  @testCases = []
end

Instance Method Details

#add_test_case(testCase) ⇒ Object

Function used to add a TestCase to thee TestSuite

Parameters:

  • testCase (TestCase)

    A test case to be executed



23
24
25
26
27
28
29
30
31
32
# File 'lib/ui/test-suites/TestSuite.rb', line 23

def add_test_case(testCase)
  if testCase.nil?
    raise "Cannot have nil testCase within TestSuite"
  end

  unless testCase.instance_of? LegoTechSelenium::TestCase
    raise "testCase is not an instance of TestCase within the TestSuite"
  end
  @testCases.push(testCase)
end

#get_nameString

Retrieve the name of the TestSuite

Returns:

  • (String)

    The name of the TestSuite



36
37
38
# File 'lib/ui/test-suites/TestSuite.rb', line 36

def get_name()
  return @name
end

#get_number_of_test_casesNumber

Retrieve the number of TestCases within the TestSuite

Returns:

  • (Number)

    Number of TestCases



42
43
44
# File 'lib/ui/test-suites/TestSuite.rb', line 42

def get_number_of_test_cases
  return @testCases.size
end

#runObject

Function that will invoke all test cases



47
48
49
50
51
# File 'lib/ui/test-suites/TestSuite.rb', line 47

def run()
  @testCases.each do |testCase|
    testCase.run()
  end
end