Class: Test::Unit::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/test/unit/testcase_xml.rb

Instance Method Summary collapse

Instance Method Details

#faultObject



7
8
9
# File 'lib/test/unit/testcase_xml.rb', line 7

def fault
  @_fault
end

#run_with_timing(result, &block) ⇒ Object Also known as: run



22
23
24
25
26
27
28
# File 'lib/test/unit/testcase_xml.rb', line 22

def run_with_timing(result, &block)
  before_time = Time.now.to_f
  run_without_timing(result, &block)
ensure
  after_time = Time.now.to_f
  @_elapsed_time = after_time - before_time
end

#xml_elementObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/test/unit/testcase_xml.rb', line 11

def xml_element
  return if @method_name.to_s == "default_test"
  
  testcase = REXML::Element.new("testcase")
  testcase.add_attributes('classname' => self.class.name, 'name' => @method_name, 'time' => @_elapsed_time.to_s)
  if fault
    testcase.elements << fault.xml_element
  end
  testcase
end