Class: Turn::ProgressReporter
- Defined in:
- lib/turn/reporters/progress_reporter.rb
Constant Summary
Constants included from Colorize
Colorize::COLORIZE, Colorize::ERROR, Colorize::FAIL, Colorize::PASS
Instance Attribute Summary
Attributes inherited from Reporter
Instance Method Summary collapse
-
#finish_case(kase) ⇒ Object
def error(message=nil) #@pbar.inc end.
- #finish_suite(suite) ⇒ Object
- #post_report(suite) ⇒ Object
- #start_suite(suite) ⇒ Object
Methods inherited from Reporter
#error, #fail, #finish_test, #initialize, #pass, #start_case, #start_test
Constructor Details
This class inherits a constructor from Turn::Reporter
Instance Method Details
#finish_case(kase) ⇒ Object
def error(message=nil)
#@pbar.inc
end
33 34 35 |
# File 'lib/turn/reporters/progress_reporter.rb', line 33 def finish_case(kase) @pbar.inc end |
#finish_suite(suite) ⇒ Object
37 38 39 40 |
# File 'lib/turn/reporters/progress_reporter.rb', line 37 def finish_suite(suite) @pbar.finish post_report(suite) end |
#post_report(suite) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/turn/reporters/progress_reporter.rb', line 43 def post_report(suite) tally = test_tally(suite) width = suite.collect{ |tr| tr.name.size }.max headers = [ 'TESTCASE ', ' TESTS ', 'ASSERTIONS', ' FAILURES ', ' ERRORS ' ] io.puts "\n%-#{width}s %10s %10s %10s %10s\n" % headers files = nil suite.each do |testrun| if testrun.files != [testrun.name] && testrun.files != files label = testrun.files.join(' ') label = ::ANSICode.magenta(label) if COLORIZE io.puts(label + "\n") files = testrun.files end io.puts paint_line(testrun, width) end #puts("\n%i tests, %i assertions, %i failures, %i errors\n\n" % tally) tally_line = "-----\n" tally_line << "%-#{width}s " % "TOTAL" tally_line << "%10s %10s %10s %10s" % tally io.puts(tally_line + "\n") fails = suite.select do |testrun| testrun.fail? || testrun.error? end #if tally[2] != 0 or tally[3] != 0 unless fails.empty? # or verbose? io.puts "\n\n-- Failures and Errors --\n\n" fails.uniq.each do |testrun| = testrun..tabto(0).strip = ::ANSICode.red() if COLORIZE io.puts(+"\n\n") end io.puts end #end end |
#start_suite(suite) ⇒ Object
10 11 12 13 |
# File 'lib/turn/reporters/progress_reporter.rb', line 10 def start_suite(suite) @pbar = ::ProgressBar.new('Testing', suite.size) @pbar.inc end |