teaspoon 1.1.5 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/MIT.LICENSE +2 -2
- data/README.md +37 -28
- data/app/assets/javascripts/teaspoon/hook.coffee +1 -1
- data/app/assets/javascripts/teaspoon/teaspoon.coffee +13 -1
- data/app/controllers/teaspoon/suite_controller.rb +18 -13
- data/app/views/teaspoon/suite/index.html.erb +1 -1
- data/lib/generators/teaspoon/install/install_generator.rb +34 -34
- data/lib/generators/teaspoon/install/templates/MISSING_FRAMEWORK +1 -1
- data/lib/generators/teaspoon/install/templates/POST_INSTALL +1 -1
- data/lib/generators/teaspoon/install/templates/_boot.html.erb +1 -1
- data/lib/generators/teaspoon/install/templates/env_comments.rb.tt +8 -8
- data/lib/tasks/teaspoon/info.rake +1 -1
- data/lib/teaspoon/command_line.rb +76 -76
- data/lib/teaspoon/configuration.rb +4 -4
- data/lib/teaspoon/console.rb +40 -40
- data/lib/teaspoon/coverage.rb +29 -25
- data/lib/teaspoon/deprecated.rb +1 -1
- data/lib/teaspoon/driver.rb +0 -1
- data/lib/teaspoon/driver/browserstack.rb +48 -51
- data/lib/teaspoon/driver/phantomjs.rb +25 -25
- data/lib/teaspoon/driver/phantomjs/runner.js +31 -3
- data/lib/teaspoon/driver/selenium.rb +13 -9
- data/lib/teaspoon/engine.rb +26 -15
- data/lib/teaspoon/environment.rb +28 -28
- data/lib/teaspoon/exceptions.rb +7 -7
- data/lib/teaspoon/exporter.rb +23 -23
- data/lib/teaspoon/formatter/base.rb +64 -46
- data/lib/teaspoon/formatter/clean.rb +2 -2
- data/lib/teaspoon/formatter/documentation.rb +40 -40
- data/lib/teaspoon/formatter/dot.rb +12 -12
- data/lib/teaspoon/formatter/json.rb +21 -21
- data/lib/teaspoon/formatter/junit.rb +52 -52
- data/lib/teaspoon/formatter/modules/report_module.rb +34 -32
- data/lib/teaspoon/formatter/pride.rb +21 -21
- data/lib/teaspoon/formatter/rspec_html.rb +31 -31
- data/lib/teaspoon/formatter/snowday.rb +6 -5
- data/lib/teaspoon/formatter/swayze_or_oprah.rb +91 -91
- data/lib/teaspoon/formatter/tap.rb +29 -29
- data/lib/teaspoon/formatter/tap_y.rb +57 -57
- data/lib/teaspoon/formatter/teamcity.rb +63 -63
- data/lib/teaspoon/framework/base.rb +1 -1
- data/lib/teaspoon/instrumentation.rb +18 -18
- data/lib/teaspoon/registry.rb +8 -8
- data/lib/teaspoon/registry/has_default.rb +2 -2
- data/lib/teaspoon/runner.rb +37 -37
- data/lib/teaspoon/server.rb +30 -29
- data/lib/teaspoon/suite.rb +68 -57
- data/lib/teaspoon/utility.rb +6 -0
- data/lib/teaspoon/version.rb +1 -1
- metadata +10 -18
- data/lib/teaspoon/driver/capybara_webkit.rb +0 -40
@@ -8,20 +8,20 @@ module Teaspoon
|
|
8
8
|
|
9
9
|
protected
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
def log_spec(result)
|
12
|
+
return log_str(".", GREEN) if result.passing?
|
13
|
+
return log_str("*", YELLOW) if result.pending?
|
14
|
+
log_str("F", RED)
|
15
|
+
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
def log_console(message)
|
18
|
+
log_str(message)
|
19
|
+
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
def log_result(result)
|
22
|
+
log_line("\n")
|
23
|
+
super
|
24
|
+
end
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -5,33 +5,33 @@ module Teaspoon
|
|
5
5
|
class Json < Base
|
6
6
|
protected
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
def log_runner(result)
|
9
|
+
log_result(result)
|
10
|
+
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
def log_suite(result)
|
13
|
+
log_result(result)
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
def log_spec(result)
|
17
|
+
log_result(result)
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def log_error(result)
|
21
|
+
log_result(result)
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
def log_exception(result)
|
25
|
+
log_result(result)
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
def log_console(message)
|
29
|
+
log_line(%{{"type":"console","log":"#{message.gsub(/\n$/, '').gsub('\n', '\\n')}"}})
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
def log_result(result)
|
33
|
+
log_str(result.original_json)
|
34
|
+
end
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -6,75 +6,75 @@ module Teaspoon
|
|
6
6
|
class Junit < Base
|
7
7
|
protected
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
def log_runner(result)
|
10
|
+
log_line(%{<?xml version="1.0" encoding="UTF-8"?>})
|
11
|
+
log_line(%{<testsuites name="Teaspoon">})
|
12
|
+
start_time = Time.parse(result.start).iso8601
|
13
|
+
log_line(%{<testsuite name="#{escape(@suite_name)}" tests="#{@total_count}" timestamp="#{start_time}">})
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
def log_suite(result)
|
17
|
+
log_end_suite
|
18
|
+
log_line(%{<testsuite name="#{escape(result.label)}">})
|
19
|
+
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
def log_passing_spec(result)
|
22
|
+
log_junit_spec(suite: result.suite, label: result.label)
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def log_pending_spec(result)
|
26
|
+
log_junit_spec(suite: result.suite, label: result.label) do
|
27
|
+
log_line(%{ <skipped/>})
|
28
|
+
end
|
28
29
|
end
|
29
|
-
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
def log_failing_spec(result)
|
32
|
+
log_junit_spec(suite: result.suite, label: result.label) do
|
33
|
+
log_line(%{ <failure type="AssertionFailed">#{cdata(result.message)}</failure>})
|
34
|
+
end
|
34
35
|
end
|
35
|
-
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
def log_result(_result)
|
38
|
+
log_end_suite
|
39
|
+
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
def log_coverage(message)
|
42
|
+
properties = "<properties>#{cdata(message)}</properties>"
|
43
|
+
log_line(%{<testsuite name="Coverage summary" tests="0">\n#{properties}\n</testsuite>})
|
44
|
+
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
def log_threshold_failure(message)
|
47
|
+
log_line(%{<testsuite name="Coverage thresholds" tests="1">})
|
48
|
+
log_junit_spec(suite: "Coverage thresholds", label: "were not met") do
|
49
|
+
log_line(%{ <failure type="AssertionFailed">#{cdata(message)}</failure>})
|
50
|
+
end
|
51
|
+
log_line(%{</testsuite>})
|
50
52
|
end
|
51
|
-
log_line(%{</testsuite>})
|
52
|
-
end
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
def log_complete(_failure_count)
|
55
|
+
log_line(%{</testsuite>\n</testsuites>})
|
56
|
+
end
|
57
57
|
|
58
58
|
private
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
def log_end_suite
|
61
|
+
log_line(%{</testsuite>}) if @last_suite
|
62
|
+
end
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
64
|
+
def log_junit_spec(opts, &_block)
|
65
|
+
log_line(%{<testcase classname="#{escape(opts[:suite])}" name="#{escape(opts[:label])}">})
|
66
|
+
yield if block_given?
|
67
|
+
log_line(%{<system-out>#{cdata(@stdout)}</system-out>}) unless @stdout.blank?
|
68
|
+
log_line(%{</testcase>})
|
69
|
+
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
def escape(str)
|
72
|
+
CGI.escapeHTML(str)
|
73
|
+
end
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
def cdata(str)
|
76
|
+
"\n<![CDATA[\n#{str.gsub(/\n$/, '')}\n]]>\n"
|
77
|
+
end
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -15,6 +15,8 @@ module Teaspoon
|
|
15
15
|
log_line
|
16
16
|
end
|
17
17
|
|
18
|
+
alias_method :log_exception, :log_error
|
19
|
+
|
18
20
|
def log_result(result)
|
19
21
|
log_information
|
20
22
|
log_stats(result)
|
@@ -31,46 +33,46 @@ module Teaspoon
|
|
31
33
|
|
32
34
|
private
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
def log_information
|
37
|
+
log_pending if pendings.size > 0
|
38
|
+
log_failures if failures.size > 0
|
39
|
+
end
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
def log_pending
|
42
|
+
log_line("Pending:")
|
43
|
+
pendings.each do |result|
|
44
|
+
log_line(" #{result.description}", YELLOW)
|
45
|
+
log_line(" # Not yet implemented\n", CYAN)
|
46
|
+
end
|
44
47
|
end
|
45
|
-
end
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
def log_failures
|
50
|
+
log_line("Failures:\n")
|
51
|
+
failures.each_with_index do |failure, index|
|
52
|
+
log_line(" #{index + 1}) #{failure.description}")
|
53
|
+
log_line(" Failure/Error: #{failure.message}\n", RED)
|
54
|
+
end
|
52
55
|
end
|
53
|
-
end
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
def log_stats(result)
|
58
|
+
log_line("Finished in #{result.elapsed} seconds")
|
59
|
+
stats = "#{pluralize('example', run_count)}, #{pluralize('failure', failures.size)}"
|
60
|
+
stats << ", #{pendings.size} pending" if pendings.size > 0
|
61
|
+
log_line(stats, stats_color)
|
62
|
+
end
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
def log_failed_examples
|
65
|
+
return if failures.size == 0
|
66
|
+
log_line
|
67
|
+
log_line("Failed examples:\n")
|
68
|
+
failures.each do |failure|
|
69
|
+
log_line("teaspoon -s #{@suite_name} --filter=\"#{failure.link}\"", RED)
|
70
|
+
end
|
68
71
|
end
|
69
|
-
end
|
70
72
|
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
def stats_color
|
74
|
+
failures.size > 0 ? RED : pendings.size > 0 ? YELLOW : GREEN
|
75
|
+
end
|
74
76
|
end
|
75
77
|
end
|
76
78
|
end
|
@@ -12,34 +12,34 @@ module Teaspoon
|
|
12
12
|
|
13
13
|
protected
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
def log_spec(result)
|
16
|
+
return log_pride if result.passing?
|
17
|
+
super
|
18
|
+
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
def log_pride
|
23
|
+
return log_str(".") unless Teaspoon.configuration.color
|
24
|
+
log_str("\e[38;5;#{next_color}m.\e[0m")
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
def colors
|
28
|
+
@colors ||= (0...42).map do |i|
|
29
|
+
i *= 1.0 / 6
|
30
|
+
36 * calc_color(i) + 6 * calc_color(i + 2 * PI_3) + calc_color(i + 4 * PI_3) + 16
|
31
|
+
end
|
31
32
|
end
|
32
|
-
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
def calc_color(val)
|
35
|
+
(3 * Math.sin(val) + 3).to_i
|
36
|
+
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
def next_color
|
39
|
+
c = colors[@color_index % colors.size]
|
40
|
+
@color_index += 1
|
41
|
+
c
|
42
|
+
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -38,38 +38,38 @@ module Teaspoon
|
|
38
38
|
|
39
39
|
private
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
def log_suite_start(result)
|
42
|
+
@current_suite << result.label
|
43
|
+
log_template @suite_start_template, result
|
44
|
+
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
def log_suite_end
|
47
|
+
log_template @suite_end_template, @current_suite.pop
|
48
|
+
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
def template(contents)
|
51
|
+
Template.new contents
|
52
|
+
end
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
def log_template(template, object)
|
55
|
+
log_str template.render(object)
|
56
|
+
end
|
57
57
|
|
58
|
-
|
59
|
-
|
58
|
+
class Template
|
59
|
+
include ERB::Util
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
def initialize(contents)
|
62
|
+
@template = contents
|
63
|
+
end
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
def render(obj)
|
66
|
+
@o = obj
|
67
|
+
ERB.new(@template).result binding
|
68
|
+
end
|
68
69
|
end
|
69
|
-
end
|
70
70
|
|
71
|
-
|
72
|
-
|
71
|
+
module Templates
|
72
|
+
CSS = <<-CSS.strip_heredoc
|
73
73
|
body {
|
74
74
|
margin: 0;
|
75
75
|
padding: 0;
|
@@ -191,7 +191,7 @@ module Teaspoon
|
|
191
191
|
}
|
192
192
|
CSS
|
193
193
|
|
194
|
-
|
194
|
+
JAVASCRIPT = <<-JAVASCRIPT.strip_heredoc
|
195
195
|
(function() {
|
196
196
|
"use strict";
|
197
197
|
|
@@ -386,7 +386,7 @@ module Teaspoon
|
|
386
386
|
})();
|
387
387
|
JAVASCRIPT
|
388
388
|
|
389
|
-
|
389
|
+
HEADER = <<-HTML.strip_heredoc
|
390
390
|
<!DOCTYPE html>
|
391
391
|
<html>
|
392
392
|
<head>
|
@@ -422,13 +422,13 @@ module Teaspoon
|
|
422
422
|
<div class="results">
|
423
423
|
HTML
|
424
424
|
|
425
|
-
|
425
|
+
SUITE_START = <<-HTML.strip_heredoc
|
426
426
|
<div class="example_group">
|
427
427
|
<dl>
|
428
428
|
<dt><%= h @o.label %></dt>
|
429
429
|
HTML
|
430
430
|
|
431
|
-
|
431
|
+
SPEC = <<-HTML.strip_heredoc
|
432
432
|
<dd class="example <%= h @o.status %>">
|
433
433
|
<span class="spec-name"><%= h @o.label %></span>
|
434
434
|
<span class="duration"><%= h "\#{@o.elapsed}s" if @o.elapsed %></span>
|
@@ -441,12 +441,12 @@ module Teaspoon
|
|
441
441
|
</dd>
|
442
442
|
HTML
|
443
443
|
|
444
|
-
|
444
|
+
SUITE_END = <<-HTML.strip_heredoc
|
445
445
|
</dl>
|
446
446
|
</div>
|
447
447
|
HTML
|
448
448
|
|
449
|
-
|
449
|
+
FOOTER = <<-HTML.strip_heredoc
|
450
450
|
</div>
|
451
451
|
</div>
|
452
452
|
|
@@ -458,7 +458,7 @@ module Teaspoon
|
|
458
458
|
</body>
|
459
459
|
</html>
|
460
460
|
HTML
|
461
|
-
|
461
|
+
end
|
462
462
|
end
|
463
463
|
end
|
464
464
|
end
|