Class: Test::Unit::UI::Statistics::Lineman::TestRunner

Inherits:
BaseRunner
  • Object
show all
Defined in:
lib/test/unit/ui/statistics/runners/lineman.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.nameObject



10
11
12
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 10

def self.name
  'lineman'
end

Instance Method Details

#case_finished(test_name) ⇒ Object

callback



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 53

def case_finished test_name
  two_point_time = ("%.2f" % cstat.elapsed_time)
  if cstat.errs.nonzero?
    err_or_pass_fail = 'ERROR'
  else
    err_or_pass_fail = '%4.4s:%-4.4s' % [cstat.pass,
                                         cstat.fail]
  end
  extended_actions = ''
  extended_actions += (cstat.pend.nonzero? ? 'P' : ' ')
  extended_actions += (cstat.omit.nonzero? ? 'O' : ' ')
  extended_actions += (cstat.note.nonzero? ? 'N' : ' ')
  puts "%9.9s %6.6s  %s" % [err_or_pass_fail, two_point_time,
                            extended_actions]
end

#case_started(test_name) ⇒ Object

callback



47
48
49
50
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 47

def case_started test_name
  output_name = test_name.gsub(/\(#{sstat.test_suite.to_s}\)$/, '')
  print "    %-46.46s " % output_name
end

#exception_backtrace(fault) ⇒ Object



104
105
106
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 104

def exception_backtrace fault
  "    " + fault.backtrace.join("\n    ")
end

#fault_header_line(num, fault) ⇒ Object



92
93
94
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 92

def fault_header_line num, fault
  "  %#{@exception_max_width}i) %s:" % [num, fault.label]
end

#fault_location_line(fault) ⇒ Object



96
97
98
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 96

def fault_location_line fault
  "#{fault.test_name} #{fault.location}:"
end

#fault_message(fault) ⇒ Object



100
101
102
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 100

def fault_message fault
  fault.message
end

#finished(time) ⇒ Object

callback



20
21
22
23
24
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 20

def finished time
  show_faults
  puts "Finished in #{time.inspect}"
  puts result.to_s
end

#reset(size) ⇒ Object

callback



15
16
17
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 15

def reset size
  puts "Preparing to run #{size} tests"
end

#show_faultsObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 69

def show_faults
  puts "\n"
  order = [Test::Unit::Error, Test::Unit::Failure, Test::Unit::Omission,
           Test::Unit::Pending, Test::Unit::Notification]
  order.each do |type|
    faults = result.faults.select {|f| f.is_a?(type) }
    if faults.length.nonzero?
      type_str = "#{type.to_s.split('::').last}s"
      puts "=" * type_str.length
      puts type_str
      puts "=" * type_str.length
      puts ''
      max_width = faults.length.to_s.length
      faults.each_with_index do |f,i|
        puts "  %#{max_width}i) %s\n" % [i+1, f.long_display]
        puts ''
      end
      puts ''
    end
  end
  puts "\n"
end

#suite_finished(testcase) ⇒ Object

callback



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 32

def suite_finished testcase
  two_point_time = ("%.2f" % sstat.elapsed_time)
  extended_actions = ''
  extended_actions += (sstat.errs.nonzero? ? 'E' : ' ')
  extended_actions += (sstat.pend.nonzero? ? 'P' : ' ')
  extended_actions += (sstat.omit.nonzero? ? 'O' : ' ')
  extended_actions += (sstat.note.nonzero? ? 'N' : ' ')
  puts "%-50.50s %4.4s:%-4.4s %6.6s %s" % [testcase,
                                          sstat.pass,
                                          sstat.fail,
                                          two_point_time,
                                          extended_actions]
end

#suite_started(testcase) ⇒ Object

callback



27
28
29
# File 'lib/test/unit/ui/statistics/runners/lineman.rb', line 27

def suite_started testcase
  puts "%-0.80s" % testcase
end