Class: Test::Reporters::Progress
Overview
Progess reporter gives test counter, precentage and times.
Instance Attribute Summary
Attributes inherited from Abstract
#runner
Instance Method Summary
collapse
Methods inherited from Abstract
#end_test, inherited, #initialize, registry, #skip_case, #skip_test
Instance Method Details
#begin_case(tc) ⇒ Object
26
27
28
29
30
|
# File 'lib/rubytest/reporters/progress.rb', line 26
def begin_case(tc)
(' ', tc.to_s)
@tab += 2
end
|
#begin_suite(suite) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/rubytest/reporters/progress.rb', line 10
def begin_suite(suite)
@tab = 0
@total_count = total_count(suite)
@start_time = Time.now
@test_cache = {}
@count = 0
max = @total_count.to_s.size
@layout_head = " %3u%% %#{max}s %#{max}s %8s %11s %1s %s"
@layout = " %3u%% %#{max}u/%#{max}u %8s %11s %1s %s"
timer_reset
end
|
#begin_test(test) ⇒ Object
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/rubytest/reporters/progress.rb', line 33
def begin_test(test)
if test.respond_to?(:topic) && test.topic
topic = test.topic.to_s.rstrip
@test_cache[topic] ||= (
(' ', topic) unless topic.empty?
true
)
end
timer_reset
end
|
#end_case(tcase) ⇒ Object
70
71
72
|
# File 'lib/rubytest/reporters/progress.rb', line 70
def end_case(tcase)
@tab -= 2
end
|
#end_suite(suite) ⇒ Object
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# File 'lib/rubytest/reporters/progress.rb', line 75
def end_suite(suite)
puts
if runner.verbose?
unless record[:omit].empty?
puts "OMISSIONS:\n\n"
record[:omit].reverse_each do |test, exception|
s = []
s << "#{test}".ansi(:bold)
s << "#{file_and_line(exception)}"
puts s.join("\n").tabto(4)
puts code(exception).to_s.tabto(7)
puts
end
end
end
unless record[:todo].empty?
puts "PENDING:\n\n"
record[:todo].reverse_each do |test, exception|
s = []
s << "#{test}".ansi(:bold)
s << "#{file_and_line(exception)}"
puts s.join("\n").tabto(4)
puts code(exception).to_s.tabto(7)
puts
end
end
unless record[:fail].empty?
puts "FAILURES:\n\n"
record[:fail].reverse_each do |test, exception|
s = []
s << "#{test}".ansi(:bold)
s << "#{exception}".ansi(:red)
s << "#{file_and_line(exception)}"
puts s.join("\n").tabto(4)
puts code(exception).to_s.tabto(7)
puts
end
end
unless record[:error].empty?
puts "ERRORS:\n\n"
record[:error].reverse_each do |test, exception|
trace = clean_backtrace(exception)[1..-1].map{ |bt| bt.sub(Dir.pwd+'/', '') }
s = []
s << "#{test}".ansi(:bold)
s << "#{exception.class}".ansi(:red)
s << "#{exception}".ansi(:red)
s << "#{file_and_line(exception)}"
puts s.join("\n").tabto(4)
puts code(exception).to_s.tabto(7)
puts trace.join("\n").tabto(4) unless trace.empty?
puts
end
end
puts
puts timestamp
puts
puts tally
end
|
#error(test, exception) ⇒ Object
55
56
57
|
# File 'lib/rubytest/reporters/progress.rb', line 55
def error(test, exception)
show_line("E", test, :red)
end
|
#fail(test, exception) ⇒ Object
50
51
52
|
# File 'lib/rubytest/reporters/progress.rb', line 50
def fail(test, exception)
show_line("F", test, :red)
end
|
#omit(test, exception) ⇒ Object
65
66
67
|
# File 'lib/rubytest/reporters/progress.rb', line 65
def omit(test, exception)
show_line("O", test, :cyan)
end
|
#pass(test) ⇒ Object
45
46
47
|
# File 'lib/rubytest/reporters/progress.rb', line 45
def pass(test)
show_line(".", test, :green)
end
|
#todo(test, exception) ⇒ Object
60
61
62
|
# File 'lib/rubytest/reporters/progress.rb', line 60
def todo(test, exception)
show_line("P", test, :yellow)
end
|