Class: Tapout::Reporters::DotReporter

Inherits:
Abstract
  • Object
show all
Defined in:
lib/tapout/reporters/dot_reporter.rb

Overview

Traditional dot progress reporter.

Constant Summary

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, #omit, #parse_backtrace, #parse_source_location, #source, #start_case, #start_test, #tally, #tally_message, #time_tally, #todo

Constructor Details

This class inherits a constructor from Tapout::Reporters::Abstract

Instance Method Details

#error(entry) ⇒ Object



32
33
34
35
36
# File 'lib/tapout/reporters/dot_reporter.rb', line 32

def error(entry)
  $stdout.print 'E'.ansi(*config.error)
  $stdout.flush
  super(entry)
end

#fail(entry) ⇒ Object



25
26
27
28
29
# File 'lib/tapout/reporters/dot_reporter.rb', line 25

def fail(entry)
  $stdout.print 'F'.ansi(*config.fail)
  $stdout.flush
  super(entry)
end

#finish_suite(entry) ⇒ Object



39
40
41
42
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
87
88
89
90
91
92
93
# File 'lib/tapout/reporters/dot_reporter.rb', line 39

def finish_suite(entry)
  $stdout.puts "\n\n"

  i = 1

  @failed.each do |test|
    label     = test['label'].to_s
    snippets  = backtrace_snippets(test)
    errclass  = test['exception']['class']
    message   = test['exception']['message']
    capture   = captured_output(test)
 
    parts = [errclass, message, snippets, capture].compact.map{ |e| e.strip }.reject{ |e| e.empty? }

    puts "#{i}. " + "FAIL".ansi(*config.error) + " " + label.ansi(*config.fail)
    puts
    puts parts.join("\n\n").tabto(4)
    puts

    i += 1
  end

  @raised.each do |test|
    label     = test['label'].to_s
    snippets  = backtrace_snippets(test)
    errclass  = test['exception']['class']
    message   = test['exception']['message']
    capture   = captured_output(test)
 
    parts = [errclass, message, snippets, capture].compact.map{ |e| e.strip }.reject{ |e| e.empty? }

    puts "#{i}. " + "ERROR".ansi(*config.error) + " " + label.ansi(*config.highlight)
    puts
    puts parts.join("\n\n").tabto(4)
    puts

    i += 1
  end

  time, rate, avg = time_tally(entry)

  # total, pass, fail, error, todo, omit = count_tally(entry)

  #total = @passed.size + @failed.size + @raised.size + @skipped.size + @omitted.size
  #total = entry['counts']['total'] || total

  #time = (entry['time'] || (Time.now - @start_time)).to_f
  #avg  = time / total
  #rate = total / time

  puts
  puts "Finished in %.3fs (%.3f test/s, %.6fs avg.)" % [time, rate, avg]
  puts
  puts tally_message(entry)
end

#pass(entry) ⇒ Object



18
19
20
21
22
# File 'lib/tapout/reporters/dot_reporter.rb', line 18

def pass(entry)
  $stdout.print '.'.ansi(*config.pass)
  $stdout.flush
  super(entry)
end

#start_suite(suite) ⇒ Object



10
11
12
13
14
15
# File 'lib/tapout/reporters/dot_reporter.rb', line 10

def start_suite(suite)
  print "Started"
  print " w/ Seed: #{suite['seed']}" if suite['seed']
  puts
  super(suite)
end