tapout 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +12 -3
- data/.yardopts +6 -5
- data/HISTORY.rdoc +16 -0
- data/README.rdoc +18 -16
- data/TAP-YJ.md +15 -15
- data/bin/tapout +1 -1
- data/demo/applique/ae.rb +1 -0
- data/{spec → demo}/applique/env.rb +0 -0
- data/{spec → demo}/issues/applique/env.rb +0 -0
- data/{spec → demo}/issues/default_reporter.rdoc +2 -2
- data/{spec → demo}/perl_adapter.rdoc +3 -3
- data/{spec → demo}/reporters/applique/cli.rb +1 -1
- data/{spec → demo}/reporters/fixtures/tapy.yml +0 -0
- data/{spec → demo}/reporters/reporters.rdoc +0 -0
- data/lib/tapout.rb +5 -101
- data/lib/tapout.yml +12 -3
- data/lib/tapout/adapters/perl.rb +1 -1
- data/lib/tapout/cli.rb +98 -0
- data/lib/tapout/config.rb +103 -0
- data/lib/tapout/parsers/json.rb +2 -2
- data/lib/tapout/parsers/perl.rb +1 -1
- data/lib/tapout/parsers/yaml.rb +3 -2
- data/lib/tapout/reporters.rb +2 -1
- data/lib/tapout/reporters/abstract.rb +223 -31
- data/lib/tapout/reporters/breakdown_reporter.rb +49 -57
- data/lib/tapout/reporters/dot_reporter.rb +52 -33
- data/lib/tapout/reporters/html_reporter.rb +3 -1
- data/lib/tapout/reporters/markdown_reporter.rb +101 -0
- data/lib/tapout/reporters/outline_reporter.rb +68 -25
- data/lib/tapout/reporters/pretty_reporter.rb +65 -86
- data/lib/tapout/reporters/progress_reporter.rb +47 -22
- data/lib/tapout/reporters/runtime_reporter.rb +223 -0
- data/lib/tapout/reporters/tap_reporter.rb +1 -1
- data/lib/tapout/reporters/turn_reporter.rb +26 -65
- data/lib/tapout/version.rb +2 -2
- metadata +34 -19
- data/test/unit/test-progressbar.rb +0 -5
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'tapout/reporters/abstract'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Tapout
|
4
4
|
|
5
5
|
module Reporters
|
6
6
|
|
@@ -15,8 +15,9 @@ module TapOut
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def start_suite(entry)
|
18
|
-
headers = [ 'TESTCASE', 'TESTS', 'PASS', 'FAIL', '
|
19
|
-
puts "\n%-20s %8s %8s %8s %8s %8s\n" % headers
|
18
|
+
headers = [ 'TESTCASE', 'TESTS', 'PASS', 'FAIL', 'ERROR', 'TODO', 'OMIT' ]
|
19
|
+
puts "\n%-20s %8s %8s %8s %8s %8s %8s\n" % headers
|
20
|
+
puts ("-" * 80)
|
20
21
|
end
|
21
22
|
|
22
23
|
def start_case(entry)
|
@@ -34,89 +35,80 @@ module TapOut
|
|
34
35
|
groups = @case_entries.group_by{ |e| e['status'] }
|
35
36
|
|
36
37
|
total = @case_entries.size
|
37
|
-
sums = %w{pass fail error
|
38
|
+
sums = %w{pass fail error todo omit}.map{ |n| groups[n] ? groups[n].size : 0 }
|
38
39
|
|
39
40
|
result = sums[1] + sums[2] > 0 ? "FAIL".ansi(:red) : "PASS".ansi(:green)
|
40
41
|
|
41
|
-
puts "%-20s %8s %8s %8s %8s %8s [%s]" % ([label, total] + sums + [result])
|
42
|
+
puts "%-20s %8s %8s %8s %8s %8s %8s [%s]" % ([label, total] + sums + [result])
|
42
43
|
end
|
43
44
|
|
44
45
|
#
|
45
46
|
def finish_suite(entry)
|
46
|
-
#@pbar.finish
|
47
47
|
post_report(entry)
|
48
48
|
end
|
49
49
|
|
50
50
|
#
|
51
51
|
def post_report(entry)
|
52
52
|
|
53
|
-
sums =
|
54
|
-
|
55
|
-
puts ("-" * 80)
|
53
|
+
sums = count_tally(entry) #%w{pass fail error todo}.map{ |n| entry['counts'][n] || 0 }
|
56
54
|
|
57
55
|
tally_line = "%-20s " % "TOTAL"
|
58
|
-
tally_line << "%8s %8s %8s %8s %8s" %
|
56
|
+
tally_line << "%8s %8s %8s %8s %8s %8s" % sums
|
59
57
|
|
58
|
+
puts ("-" * 80)
|
60
59
|
puts(tally_line + "\n")
|
61
60
|
|
62
|
-
=
|
63
|
-
tally = test_tally(entry)
|
61
|
+
index = 1
|
64
62
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
files = nil
|
71
|
-
|
72
|
-
suite.each do |testrun|
|
73
|
-
if testrun.files != [testrun.name] && testrun.files != files
|
74
|
-
label = testrun.files.join(' ')
|
75
|
-
label = Colorize.magenta(label)
|
76
|
-
io.puts(label + "\n")
|
77
|
-
files = testrun.files
|
63
|
+
unless @failed.empty?
|
64
|
+
puts
|
65
|
+
@failed.each do |test|
|
66
|
+
printout(test, index, *config.fail)
|
67
|
+
index += 1
|
78
68
|
end
|
79
|
-
|
69
|
+
puts
|
80
70
|
end
|
81
71
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
io.puts(tally_line + "\n")
|
89
|
-
=end
|
90
|
-
|
91
|
-
bad = @failed + @raised
|
92
|
-
|
93
|
-
#fails = suite.select do |testrun|
|
94
|
-
# testrun.fail? || testrun.error?
|
95
|
-
#end
|
96
|
-
|
97
|
-
#if tally[2] != 0 or tally[3] != 0
|
98
|
-
unless bad.empty? # or verbose?
|
99
|
-
#puts "\n-- Failures and Errors --\n"
|
100
|
-
puts
|
101
|
-
bad.each do |e|
|
102
|
-
x = e['exception']
|
103
|
-
message = [x['class'],x['message']].compact.join(': ').strip
|
104
|
-
message = message.ansi(:red)
|
105
|
-
puts(message)
|
106
|
-
puts "#{x['file']}:#{x['line']}"
|
107
|
-
puts
|
108
|
-
puts code_snippet(x)
|
109
|
-
end
|
110
|
-
puts
|
72
|
+
unless @raised.empty?
|
73
|
+
puts
|
74
|
+
@raised.each do |test|
|
75
|
+
printout(test, index, *config.fail)
|
76
|
+
index += 1
|
111
77
|
end
|
112
|
-
|
78
|
+
puts
|
79
|
+
end
|
113
80
|
|
81
|
+
time, rate, avg = time_tally(entry)
|
82
|
+
|
83
|
+
puts "Finished in %.4fs at %.2f tests/s." % [time, rate, avg]
|
84
|
+
puts
|
114
85
|
puts tally_message(entry)
|
115
86
|
end
|
116
87
|
|
88
|
+
private
|
89
|
+
|
90
|
+
def printout(test, index, *ansi)
|
91
|
+
x = test['exception']
|
92
|
+
|
93
|
+
label = test['label'].to_s
|
94
|
+
exclass = test['exception']['class']
|
95
|
+
message = test['exception']['message']
|
96
|
+
|
97
|
+
exclass = nil if exclass.to_s.strip.empty?
|
98
|
+
message = nil if message.to_s.strip.empty?
|
99
|
+
|
100
|
+
print "#{index}. "
|
101
|
+
print label.ansi(*config.highlight)
|
102
|
+
print " " + exclass.ansi(*ansi) if exclass
|
103
|
+
puts
|
104
|
+
puts message.tabto(4) if message
|
105
|
+
puts backtrace_snippets(test).tabto(4)
|
106
|
+
puts captured_output(test).tabto(4)
|
107
|
+
puts
|
108
|
+
end
|
109
|
+
|
117
110
|
end
|
118
111
|
|
119
112
|
end
|
120
113
|
|
121
114
|
end
|
122
|
-
|
@@ -1,34 +1,36 @@
|
|
1
1
|
require 'tapout/reporters/abstract'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Tapout::Reporters
|
4
4
|
|
5
5
|
# Traditional dot progress reporter.
|
6
6
|
#
|
7
7
|
class DotReporter < Abstract
|
8
8
|
|
9
9
|
#
|
10
|
-
def start_suite(
|
11
|
-
|
12
|
-
|
10
|
+
def start_suite(suite)
|
11
|
+
print "Started"
|
12
|
+
print " w/ Seed: #{suite['seed']}" if suite['seed']
|
13
|
+
puts
|
14
|
+
super(suite)
|
13
15
|
end
|
14
16
|
|
15
17
|
#
|
16
18
|
def pass(entry)
|
17
|
-
$stdout.print '.'.ansi(
|
19
|
+
$stdout.print '.'.ansi(*config.pass)
|
18
20
|
$stdout.flush
|
19
21
|
super(entry)
|
20
22
|
end
|
21
23
|
|
22
24
|
#
|
23
25
|
def fail(entry)
|
24
|
-
$stdout.print 'F'.ansi(
|
26
|
+
$stdout.print 'F'.ansi(*config.fail)
|
25
27
|
$stdout.flush
|
26
28
|
super(entry)
|
27
29
|
end
|
28
30
|
|
29
31
|
#
|
30
32
|
def error(entry)
|
31
|
-
$stdout.print 'E'.ansi(
|
33
|
+
$stdout.print 'E'.ansi(*config.error)
|
32
34
|
$stdout.flush
|
33
35
|
super(entry)
|
34
36
|
end
|
@@ -39,38 +41,55 @@ module TapOut::Reporters
|
|
39
41
|
|
40
42
|
i = 1
|
41
43
|
|
42
|
-
@failed.each do |
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
44
|
+
@failed.each do |test|
|
45
|
+
label = test['label'].to_s
|
46
|
+
snippets = backtrace_snippets(test)
|
47
|
+
errclass = test['exception']['class']
|
48
|
+
message = test['exception']['message']
|
49
|
+
capture = captured_output(test)
|
50
|
+
|
51
|
+
parts = [errclass, message, snippets, capture].compact.map{ |e| e.strip }.reject{ |e| e.empty? }
|
52
|
+
|
53
|
+
puts "#{i}. " + "FAIL".ansi(*config.error) + " " + label.ansi(*config.fail)
|
54
|
+
puts
|
55
|
+
puts parts.join("\n\n").tabto(4)
|
56
|
+
puts
|
57
|
+
|
54
58
|
i += 1
|
55
59
|
end
|
56
60
|
|
57
|
-
@raised.each do |
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
61
|
+
@raised.each do |test|
|
62
|
+
label = test['label'].to_s
|
63
|
+
snippets = backtrace_snippets(test)
|
64
|
+
errclass = test['exception']['class']
|
65
|
+
message = test['exception']['message']
|
66
|
+
capture = captured_output(test)
|
67
|
+
|
68
|
+
parts = [errclass, message, snippets, capture].compact.map{ |e| e.strip }.reject{ |e| e.empty? }
|
69
|
+
|
70
|
+
puts "#{i}. " + "ERROR".ansi(*config.error) + " " + label.ansi(*config.highlight)
|
71
|
+
puts
|
72
|
+
puts parts.join("\n\n").tabto(4)
|
73
|
+
puts
|
74
|
+
|
69
75
|
i += 1
|
70
76
|
end
|
71
77
|
|
72
|
-
|
73
|
-
|
78
|
+
time, rate, avg = time_tally(entry)
|
79
|
+
|
80
|
+
total, pass, fail, error, todo, omit = count_tally(entry)
|
81
|
+
|
82
|
+
#total = @passed.size + @failed.size + @raised.size + @skipped.size + @omitted.size
|
83
|
+
#total = entry['counts']['total'] || total
|
84
|
+
|
85
|
+
#time = (entry['time'] || (Time.now - @start_time)).to_f
|
86
|
+
#avg = time / total
|
87
|
+
#rate = total / time
|
88
|
+
|
89
|
+
puts
|
90
|
+
puts "Finished in %.3fs (%.3f test/s, %.6fs avg.)" % [time, rate, avg]
|
91
|
+
puts
|
92
|
+
puts "%s tests: %s pass, %s fail, %s exit, %s todo, %s omit" % [total, pass, fail, error, todo, omit]
|
74
93
|
end
|
75
94
|
|
76
95
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'tapout/reporters/abstract'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Tapout::Reporters
|
4
4
|
|
5
5
|
# HTML Test Reporter
|
6
6
|
#
|
@@ -78,6 +78,7 @@ module TapOut::Reporters
|
|
78
78
|
puts clean_backtrace(e['backtrace']).join("\n")
|
79
79
|
puts "</pre>"
|
80
80
|
puts %[</li>]
|
81
|
+
# TODO: Add captured_stdout and _stderr
|
81
82
|
end
|
82
83
|
|
83
84
|
#
|
@@ -91,6 +92,7 @@ module TapOut::Reporters
|
|
91
92
|
puts clean_backtrace(e['backtrace']).join("\n")
|
92
93
|
puts "</pre>"
|
93
94
|
puts %[</li>]
|
95
|
+
# TODO: Add captured_stdout and _stderr
|
94
96
|
end
|
95
97
|
|
96
98
|
#
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'tapout/reporters/abstract'
|
2
|
+
|
3
|
+
module Tapout::Reporters
|
4
|
+
|
5
|
+
# Markdown reporter.
|
6
|
+
#
|
7
|
+
class Markdown < Abstract
|
8
|
+
|
9
|
+
#
|
10
|
+
def start_suite(entry)
|
11
|
+
@start_time = Time.now
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
def mark
|
16
|
+
('#' * (@_level + 1)) + ' '
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
def start_case(entry)
|
21
|
+
@_level = entry['level'].to_i + 1
|
22
|
+
$stdout.print('#' * @_level + ' ')
|
23
|
+
$stdout.puts(entry['label'])
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
def pass(entry)
|
28
|
+
super(entry)
|
29
|
+
$stdout.puts "#{mark}" + entry['label'] + " #{entry['source']}"
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
def fail(entry)
|
34
|
+
super(entry)
|
35
|
+
|
36
|
+
$stdout.puts "#{mark}" + entry['label'] + " #{entry['source']}"
|
37
|
+
|
38
|
+
$stdout.puts "\n**MESSAGE**\n\n"
|
39
|
+
$stdout.puts entry['exception']['message'].tabto(4)
|
40
|
+
|
41
|
+
$stdout.puts "\n**TYPE**\n\n"
|
42
|
+
$stdout.puts entry['exception']['class'].tabto(4)
|
43
|
+
|
44
|
+
#$stdout.puts " " + ok.caller #clean_backtrace(exception.backtrace)[0]
|
45
|
+
|
46
|
+
$stdout.puts "\n**SNIPPET**\n\n"
|
47
|
+
$stdout.puts code_snippet(entry['exception'])
|
48
|
+
|
49
|
+
if captured_stdout?(entry)
|
50
|
+
$stdout.puts "\n**STDOUT**\n\n"
|
51
|
+
$stdout.puts captured_stdout(entry).tabto(4)
|
52
|
+
end
|
53
|
+
|
54
|
+
if captured_stderr?(entry)
|
55
|
+
$stdout.puts "\n**STDERR**\n\n"
|
56
|
+
$stdout.puts captured_stderr(entry).tabto(4)
|
57
|
+
end
|
58
|
+
|
59
|
+
$stdout.puts
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
def error(entry)
|
64
|
+
super(entry)
|
65
|
+
|
66
|
+
$stdout.puts "#{mark}" + entry['label'] + " #{entry['source']}"
|
67
|
+
|
68
|
+
$stdout.puts "\n**MESSAGE**\n\n"
|
69
|
+
$stdout.puts entry['exception']['message'].tabto(4)
|
70
|
+
|
71
|
+
$stdout.puts "\n**TYPE**\n\n"
|
72
|
+
$stdout.puts entry['exception']['class'].tabto(4)
|
73
|
+
|
74
|
+
#$stdout.puts " " + ok.caller #clean_backtrace(exception.backtrace)[0..2].join(" \n")
|
75
|
+
|
76
|
+
$stdout.puts "\n**SNIPPET**\n\n"
|
77
|
+
$stdout.puts code_snippet(entry['exception'])
|
78
|
+
|
79
|
+
if captured_stdout?(entry)
|
80
|
+
$stdout.puts "\n**STDOUT**\n\n"
|
81
|
+
$stdout.puts captured_stdout(entry).tabto(4)
|
82
|
+
end
|
83
|
+
|
84
|
+
if captured_stderr?(entry)
|
85
|
+
$stdout.puts "\n**STDERR**\n\n"
|
86
|
+
$stdout.puts captured_stderr(entry).tabto(4)
|
87
|
+
end
|
88
|
+
|
89
|
+
$stdout.puts
|
90
|
+
end
|
91
|
+
|
92
|
+
#
|
93
|
+
def finish_suite(entry)
|
94
|
+
#$stderr.puts
|
95
|
+
$stderr.print tally_message(entry)
|
96
|
+
$stderr.puts " [%0.4fs] " % [Time.now - @start_time]
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
@@ -1,61 +1,104 @@
|
|
1
1
|
require 'tapout/reporters/abstract'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Tapout::Reporters
|
4
4
|
|
5
5
|
# Outline reporter.
|
6
6
|
#
|
7
|
-
# TODO:
|
7
|
+
# TODO: Not sure there is really any good point to this reporter.
|
8
8
|
#
|
9
9
|
class Outline < Abstract
|
10
10
|
|
11
11
|
#
|
12
12
|
def start_suite(entry)
|
13
|
+
@_case_count = [0]
|
13
14
|
@start_time = Time.now
|
14
15
|
end
|
15
16
|
|
16
17
|
#
|
17
18
|
def start_case(entry)
|
18
|
-
|
19
|
+
@_test_count = 0
|
20
|
+
@_level = entry['level'].to_i
|
21
|
+
|
22
|
+
print(' ' * (level_tab - 2))
|
23
|
+
puts(case_count(entry) + '. ' + entry['label'].ansi(*config.highlight))
|
24
|
+
#puts
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
def level_tab
|
29
|
+
2 * (@_level + 1)
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
def case_count(entry)
|
34
|
+
level = entry['level'].to_i
|
35
|
+
@_case_count = @_case_count[0,level+1]
|
36
|
+
@_case_count[level] ||= 0
|
37
|
+
@_case_count[level] += 1
|
38
|
+
@_case_count.join('.') #+ '.'
|
39
|
+
@_case_count[level].to_s
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
def start_test(test)
|
44
|
+
@_test_count += 1
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
def test_count
|
49
|
+
@_test_count
|
19
50
|
end
|
20
51
|
|
52
|
+
#
|
21
53
|
def pass(entry)
|
22
54
|
super(entry)
|
23
|
-
|
55
|
+
print(' ' * level_tab)
|
56
|
+
puts "#{test_count}. " + entry['label'].ansi(:green) + " #{entry['source']}"
|
24
57
|
end
|
25
58
|
|
26
59
|
def fail(entry)
|
27
60
|
super(entry)
|
28
61
|
|
29
|
-
|
30
|
-
|
31
|
-
$stdout.puts "* " + entry['label'].ansi(:red) + " #{entry['source']}"
|
32
|
-
$stdout.puts
|
33
|
-
$stdout.puts " #{msg}"
|
34
|
-
#$stdout.puts " " + ok.caller #clean_backtrace(exception.backtrace)[0]
|
35
|
-
$stdout.puts
|
36
|
-
$stdout.puts code_snippet(entry['exception'])
|
37
|
-
$stdout.puts
|
62
|
+
printout(entry, 'FAIL', config.fail)
|
38
63
|
end
|
39
64
|
|
40
65
|
def error(entry)
|
41
66
|
super(entry)
|
42
67
|
|
43
|
-
|
44
|
-
|
45
|
-
$stdout.puts "* " + entry['label'].ansi(:yellow) + " #{entry['source']}"
|
46
|
-
$stdout.puts
|
47
|
-
$stdout.puts " #{msg}"
|
48
|
-
#$stdout.puts " " + ok.caller #clean_backtrace(exception.backtrace)[0..2].join(" \n")
|
49
|
-
$stdout.puts
|
50
|
-
$stdout.puts code_snippet(entry['exception'])
|
51
|
-
$stdout.puts
|
68
|
+
printout(entry, 'ERROR', config.error)
|
52
69
|
end
|
53
70
|
|
54
71
|
#
|
55
72
|
def finish_suite(entry)
|
56
|
-
|
57
|
-
|
58
|
-
|
73
|
+
time, rate, avg = time_tally(entry)
|
74
|
+
delta = duration(time)
|
75
|
+
|
76
|
+
puts
|
77
|
+
print tally_message(entry)
|
78
|
+
#puts " [%0.4fs %.4ft/s %.4fs/t] " % [time, rate, avg]
|
79
|
+
puts " [%s %.2ft/s %.4fs/t] " % [delta, rate, avg]
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
#
|
85
|
+
def printout(entry, type, ansi)
|
86
|
+
counter = "#{test_count}. "
|
87
|
+
|
88
|
+
label = entry['label'].ansi(*ansi)
|
89
|
+
message = entry['exception']['message']
|
90
|
+
exclass = entry['exception']['class']
|
91
|
+
|
92
|
+
parts = [message, exclass].compact.reject{ |x| x.strip.empty? }
|
93
|
+
|
94
|
+
print(' ' * level_tab)
|
95
|
+
puts counter + label + " #{entry['source']}"
|
96
|
+
puts
|
97
|
+
puts parts.join("\n\n").tabto(level_tab+counter.size)
|
98
|
+
puts
|
99
|
+
puts backtrace_snippets(entry).tabto(level_tab++counter.size+4)
|
100
|
+
print captured_output(entry).tabto(level_tab+counter.size)
|
101
|
+
puts
|
59
102
|
end
|
60
103
|
|
61
104
|
end
|