Class: Tapout::Reporters::ProgressReporter
- Inherits:
-
Abstract
- Object
- Abstract
- Tapout::Reporters::ProgressReporter
show all
- Defined in:
- lib/tapout/reporters/progress_reporter.rb
Overview
The progress report format utilises a progress bar to indicate
elapsed progress.
Constant Summary
collapse
- FAIL =
"FAIL".ansi(*Tapout.config.fail)
- ERROR =
"ERROR".ansi(*Tapout.config.error)
Constants inherited
from Abstract
Abstract::INTERNALS
Instance Method Summary
collapse
Methods inherited from Abstract
#<<, #backtrace, #backtrace_snippets, #backtrace_snippets_chain, #captured_output, #captured_output?, #captured_stderr, #captured_stderr?, #captured_stdout, #captured_stdout?, #clean_backtrace, #code_snippet, #complete_cases, #config, #count_tally, #duration, #exit_code, #finalize, #finish_case, #finish_test, #format_snippet_array, #handle, inherited, #initialize, #note, #parse_backtrace, #parse_source_location, #source, #start_test, #tally, #tally_message, #time_tally
Instance Method Details
#error(test) ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/tapout/reporters/progress_reporter.rb', line 63
def error(test)
@pbar.clear
err = test['exception']
label = test['label'].to_s
errclass = err['class']
message = err['message']
trace = backtrace_snippets(test)
capture = captured_output(err)
parts = [errclass, message, trace, capture].compact.reject{ |x| x.strip.empty? }
puts "#{@i+=1}. #{ERROR} #{label}"
puts
puts parts.join("\n\n").tabto(4)
puts
@pbar.style(:bar=>config.error)
@pbar.inc
end
|
#fail(test) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/tapout/reporters/progress_reporter.rb', line 40
def fail(test)
@pbar.clear
err = test['exception']
label = test['label'].to_s
errclass = err['class']
message = err['message']
trace = backtrace_snippets(test)
capture = captured_output(err)
parts = [errclass, message, trace, capture].compact.reject{ |x| x.strip.empty? }
puts "#{@i+=1}. #{FAIL} #{label}"
puts
puts parts.join("\n\n").tabto(4)
puts
@pbar.style(:bar=>config.fail)
@pbar.inc
end
|
#finish_suite(entry) ⇒ Object
def finish_case(kase)
end
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/tapout/reporters/progress_reporter.rb', line 100
def finish_suite(entry)
total, pass, fail, error, todo, omit = count_tally(entry)
@pbar.style(:bar=>config.pass) if pass > 0
@pbar.style(:bar=>config.error) if error > 0
@pbar.style(:bar=>config.fail) if fail > 0
@pbar.finish
puts
puts tally_message(entry)
end
|
#omit(entry) ⇒ Object
92
93
94
95
|
# File 'lib/tapout/reporters/progress_reporter.rb', line 92
def omit(entry)
@pbar.style(:bar=>config.omit)
@pbar.inc
end
|
#pass(entry) ⇒ Object
def test(entry)
#@pbar.inc
end
34
35
36
37
|
# File 'lib/tapout/reporters/progress_reporter.rb', line 34
def pass(entry)
@pbar.style(:bar=>config.pass)
@pbar.inc
end
|
#start_case(entry) ⇒ Object
27
28
|
# File 'lib/tapout/reporters/progress_reporter.rb', line 27
def start_case(entry)
end
|
#start_suite(entry) ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/tapout/reporters/progress_reporter.rb', line 17
def start_suite(entry)
@pbar = ::ANSI::Progressbar.new('Testing', entry['count'].to_i + 1)
@pbar.style(:bar=>[:invert, *config.pass])
@pbar.inc
@i = 0
super(entry)
end
|
#todo(entry) ⇒ Object
86
87
88
89
|
# File 'lib/tapout/reporters/progress_reporter.rb', line 86
def todo(entry)
@pbar.style(:bar=>config.todo)
@pbar.inc
end
|