class Tapout::Reporters::ProgressReporter

The progress report format utilises a progress bar to indicate elapsed progress.

Constants

ERROR
FAIL

Public Instance Methods

error(test) click to toggle source
# 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) click to toggle source
# 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) click to toggle source

def finish_case(kase) end

# 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

  #post_report(entry)
  puts
  puts tally_message(entry)
end
omit(entry) click to toggle source
# File lib/tapout/reporters/progress_reporter.rb, line 92
def omit(entry)
  @pbar.style(:bar=>config.omit)
  @pbar.inc
end
pass(entry) click to toggle source

def test(entry)

#@pbar.inc

end

# File lib/tapout/reporters/progress_reporter.rb, line 34
def pass(entry)
  @pbar.style(:bar=>config.pass)
  @pbar.inc
end
start_case(entry) click to toggle source
# File lib/tapout/reporters/progress_reporter.rb, line 27
def start_case(entry)
end
start_suite(entry) click to toggle source
Calls superclass method Tapout::Reporters::Abstract#start_suite
# 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) click to toggle source
# File lib/tapout/reporters/progress_reporter.rb, line 86
def todo(entry)
  @pbar.style(:bar=>config.todo)
  @pbar.inc
end