Class: DevCreek::TestSuite

Inherits:
Object
  • Object
show all
Defined in:
lib/devcreek_testsuite.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(framework) ⇒ TestSuite

Returns a new instance of TestSuite.



15
16
17
# File 'lib/devcreek_testsuite.rb', line 15

def initialize(framework)
  @framework, @test_results, @start, @elapsed_time = framework, {}, Time.new, 0.0   
end

Instance Attribute Details

#elapsed_timeObject

Returns the value of attribute elapsed_time.



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

def elapsed_time
  @elapsed_time
end

#finishObject (readonly)

Returns the value of attribute finish.



14
15
16
# File 'lib/devcreek_testsuite.rb', line 14

def finish
  @finish
end

#frameworkObject (readonly)

Returns the value of attribute framework.



14
15
16
# File 'lib/devcreek_testsuite.rb', line 14

def framework
  @framework
end

#session_idObject (readonly)

Returns the value of attribute session_id.



14
15
16
# File 'lib/devcreek_testsuite.rb', line 14

def session_id
  @session_id
end

#startObject (readonly)

Returns the value of attribute start.



14
15
16
# File 'lib/devcreek_testsuite.rb', line 14

def start
  @start
end

#test_resultsObject

Returns the value of attribute test_results.



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

def test_results
  @test_results
end

Instance Method Details

#error_countObject



45
46
47
# File 'lib/devcreek_testsuite.rb', line 45

def error_count
  return sum_test_results_with_status("ERROR")
end

#failure_countObject



41
42
43
# File 'lib/devcreek_testsuite.rb', line 41

def failure_count
  return sum_test_results_with_status("FAILURE")
end

#has_finishedObject

Raises:

  • (ArgumentError)


49
50
51
52
# File 'lib/devcreek_testsuite.rb', line 49

def has_finished
  raise ArgumentError, "The finish time cannot be set twice" unless @finish.nil?
  @finish = Time.now
end

#has_test_results?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/devcreek_testsuite.rb', line 33

def has_test_results?
  return run_count > 0
end

#run_countObject



29
30
31
# File 'lib/devcreek_testsuite.rb', line 29

def run_count
  return test_results.size
end

#success_countObject



37
38
39
# File 'lib/devcreek_testsuite.rb', line 37

def success_count
  return sum_test_results_with_status("OK")
end

#to_xml(session_id) ⇒ Object



54
55
56
# File 'lib/devcreek_testsuite.rb', line 54

def to_xml(session_id)
  ERB.new(DevCreek::TRANSMISSION_RECORD_TEMPLATE, 0, "%<>").result(binding).gsub(/^  /, '')
end