Class: Tapout::Reporters::ProgressReporter
- 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
Instance Method Summary collapse
- #error(test) ⇒ Object
- #fail(test) ⇒ Object
-
#finish_suite(entry) ⇒ Object
def finish_case(kase) end.
- #omit(entry) ⇒ Object
-
#pass(entry) ⇒ Object
def test(entry) #@pbar.inc end.
- #start_case(entry) ⇒ Object
- #start_suite(entry) ⇒ Object
- #todo(entry) ⇒ Object
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
Constructor Details
This class inherits a constructor from Tapout::Reporters::Abstract
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) .clear err = test['exception'] label = test['label'].to_s errclass = err['class'] = err['message'] trace = backtrace_snippets(test) capture = captured_output(err) parts = [errclass, , trace, capture].compact.reject{ |x| x.strip.empty? } puts "#{@i+=1}. #{ERROR} #{label}" puts puts parts.join("\n\n").tabto(4) puts .style(:bar=>config.error) .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) .clear err = test['exception'] label = test['label'].to_s errclass = err['class'] = err['message'] trace = backtrace_snippets(test) capture = captured_output(err) parts = [errclass, , trace, capture].compact.reject{ |x| x.strip.empty? } puts "#{@i+=1}. #{FAIL} #{label}" puts puts parts.join("\n\n").tabto(4) puts .style(:bar=>config.fail) .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) .style(:bar=>config.pass) if pass > 0 .style(:bar=>config.error) if error > 0 .style(:bar=>config.fail) if fail > 0 .finish #post_report(entry) puts puts (entry) end |
#omit(entry) ⇒ Object
92 93 94 95 |
# File 'lib/tapout/reporters/progress_reporter.rb', line 92 def omit(entry) .style(:bar=>config.omit) .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) .style(:bar=>config.pass) .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) = ::ANSI::.new('Testing', entry['count'].to_i + 1) .style(:bar=>[:invert, *config.pass]) .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) .style(:bar=>config.todo) .inc end |