ci_reporter 1.9.3 → 2.0.0.alpha1
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 +4 -4
- data/.gitignore +22 -0
- data/.travis.yml +2 -6
- data/Gemfile +0 -9
- data/History.txt +0 -4
- data/LICENSE.txt +23 -21
- data/README.md +90 -0
- data/Rakefile +5 -99
- data/ci_reporter.gemspec +23 -52
- data/gemfiles/.gitignore +1 -0
- data/lib/ci/reporter/core.rb +0 -4
- data/lib/ci/reporter/internal.rb +31 -0
- data/lib/ci/reporter/rake/utils.rb +0 -4
- data/lib/ci/reporter/report_manager.rb +7 -11
- data/lib/ci/reporter/test_suite.rb +1 -9
- data/lib/ci/reporter/version.rb +1 -7
- data/spec/ci/reporter/output_capture_spec.rb +3 -7
- data/spec/ci/reporter/report_manager_spec.rb +6 -10
- data/spec/ci/reporter/test_suite_spec.rb +0 -4
- data/spec/spec_helper.rb +0 -7
- metadata +29 -138
- data/.gemtest +0 -0
- data/.hoerc +0 -2
- data/.travis.before_install.sh +0 -13
- data/Manifest.txt +0 -50
- data/README.rdoc +0 -111
- data/acceptance/cucumber/cucumber_example.feature +0 -19
- data/acceptance/cucumber/step_definitions/development_steps.rb +0 -40
- data/acceptance/minitest_example_test.rb +0 -17
- data/acceptance/rspec_example_spec.rb +0 -24
- data/acceptance/spinach/features/spinach_example.feature +0 -24
- data/acceptance/spinach/features/steps/example_spinach_feature.rb +0 -34
- data/acceptance/test_unit_example_test.rb +0 -23
- data/acceptance/verification_spec.rb +0 -185
- data/lib/ci/reporter/cucumber.rb +0 -127
- data/lib/ci/reporter/minitest.rb +0 -226
- data/lib/ci/reporter/rake/cucumber.rb +0 -17
- data/lib/ci/reporter/rake/cucumber_loader.rb +0 -6
- data/lib/ci/reporter/rake/minitest.rb +0 -15
- data/lib/ci/reporter/rake/minitest_loader.rb +0 -9
- data/lib/ci/reporter/rake/rspec.rb +0 -31
- data/lib/ci/reporter/rake/rspec_loader.rb +0 -6
- data/lib/ci/reporter/rake/spinach.rb +0 -19
- data/lib/ci/reporter/rake/spinach_loader.rb +0 -5
- data/lib/ci/reporter/rake/test_unit.rb +0 -15
- data/lib/ci/reporter/rake/test_unit_loader.rb +0 -38
- data/lib/ci/reporter/rspec.rb +0 -220
- data/lib/ci/reporter/spinach.rb +0 -80
- data/lib/ci/reporter/test_unit.rb +0 -163
- data/spec/ci/reporter/cucumber_spec.rb +0 -230
- data/spec/ci/reporter/rake/rake_tasks_spec.rb +0 -110
- data/spec/ci/reporter/rspec_spec.rb +0 -156
- data/spec/ci/reporter/test_unit_spec.rb +0 -152
- data/stub.rake +0 -16
- data/tasks/ci_reporter.rake +0 -20
data/lib/ci/reporter/cucumber.rb
DELETED
@@ -1,127 +0,0 @@
|
|
1
|
-
# Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
|
2
|
-
# See the file LICENSE.txt included with the distribution for
|
3
|
-
# software license details.
|
4
|
-
|
5
|
-
require 'ci/reporter/core'
|
6
|
-
require 'cucumber'
|
7
|
-
begin
|
8
|
-
require 'cucumber/ast/visitor'
|
9
|
-
rescue LoadError
|
10
|
-
end
|
11
|
-
|
12
|
-
module CI
|
13
|
-
module Reporter
|
14
|
-
class CucumberFailure
|
15
|
-
attr_reader :step
|
16
|
-
|
17
|
-
def initialize(step)
|
18
|
-
@step = step
|
19
|
-
end
|
20
|
-
|
21
|
-
def failure?
|
22
|
-
true
|
23
|
-
end
|
24
|
-
|
25
|
-
def error?
|
26
|
-
!failure?
|
27
|
-
end
|
28
|
-
|
29
|
-
def name
|
30
|
-
step.exception.class.name
|
31
|
-
end
|
32
|
-
|
33
|
-
def message
|
34
|
-
step.exception.message
|
35
|
-
end
|
36
|
-
|
37
|
-
def location
|
38
|
-
step.exception.backtrace.join("\n")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class Cucumber
|
43
|
-
attr_accessor :report_manager, :test_suite, :name
|
44
|
-
|
45
|
-
def initialize(step_mother, io, options)
|
46
|
-
@report_manager = ReportManager.new("features")
|
47
|
-
end
|
48
|
-
|
49
|
-
def before_feature(feature)
|
50
|
-
self.test_suite = TestSuite.new(@name)
|
51
|
-
test_suite.start
|
52
|
-
end
|
53
|
-
|
54
|
-
def after_feature(feature)
|
55
|
-
test_suite.name = @name
|
56
|
-
test_suite.finish
|
57
|
-
report_manager.write_report(@test_suite)
|
58
|
-
@test_suite = nil
|
59
|
-
end
|
60
|
-
|
61
|
-
def before_background(*args)
|
62
|
-
end
|
63
|
-
|
64
|
-
def after_background(*args)
|
65
|
-
end
|
66
|
-
|
67
|
-
def feature_name(keyword, name)
|
68
|
-
@name = (name || "Unnamed feature").split("\n").first
|
69
|
-
end
|
70
|
-
|
71
|
-
def scenario_name(keyword, name, *args)
|
72
|
-
@scenario = (name || "Unnamed scenario").split("\n").first
|
73
|
-
end
|
74
|
-
|
75
|
-
def before_steps(steps)
|
76
|
-
@test_case = TestCase.new(@scenario)
|
77
|
-
@test_case.start
|
78
|
-
end
|
79
|
-
|
80
|
-
def after_steps(steps)
|
81
|
-
@test_case.finish
|
82
|
-
|
83
|
-
case steps.status
|
84
|
-
when :pending, :undefined
|
85
|
-
@test_case.name = "#{@test_case.name} (PENDING)"
|
86
|
-
when :skipped
|
87
|
-
@test_case.name = "#{@test_case.name} (SKIPPED)"
|
88
|
-
when :failed
|
89
|
-
@test_case.failures << CucumberFailure.new(steps)
|
90
|
-
end
|
91
|
-
|
92
|
-
test_suite.testcases << @test_case
|
93
|
-
@test_case = nil
|
94
|
-
end
|
95
|
-
|
96
|
-
def before_examples(*args)
|
97
|
-
@header_row = true
|
98
|
-
end
|
99
|
-
|
100
|
-
def after_examples(*args)
|
101
|
-
end
|
102
|
-
|
103
|
-
def before_table_row(table_row)
|
104
|
-
row = table_row # shorthand for table_row
|
105
|
-
# check multiple versions of the row and try to find the best fit
|
106
|
-
outline = (row.respond_to? :name) ? row.name :
|
107
|
-
(row.respond_to? :scenario_outline) ? row.scenario_outline :
|
108
|
-
row.to_s
|
109
|
-
@test_case = TestCase.new("#@scenario (outline: #{outline})")
|
110
|
-
@test_case.start
|
111
|
-
end
|
112
|
-
|
113
|
-
def after_table_row(table_row)
|
114
|
-
if @header_row
|
115
|
-
@header_row = false
|
116
|
-
return
|
117
|
-
end
|
118
|
-
@test_case.finish
|
119
|
-
if table_row.respond_to? :failed?
|
120
|
-
@test_case.failures << CucumberFailure.new(table_row) if table_row.failed?
|
121
|
-
test_suite.testcases << @test_case
|
122
|
-
@test_case = nil
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
data/lib/ci/reporter/minitest.rb
DELETED
@@ -1,226 +0,0 @@
|
|
1
|
-
# Copyright (c) 2012 Alexander Shcherbinin <alexander.shcherbinin@gmail.com>
|
2
|
-
# See the file LICENSE.txt included with the distribution for
|
3
|
-
# software license details.
|
4
|
-
|
5
|
-
require 'ci/reporter/core'
|
6
|
-
|
7
|
-
require 'minitest/unit'
|
8
|
-
|
9
|
-
module CI
|
10
|
-
module Reporter
|
11
|
-
class Failure
|
12
|
-
def self.new(fault, type = nil, meth = nil)
|
13
|
-
return MiniTestSkipped.new(fault) if type == :skip
|
14
|
-
return MiniTestFailure.new(fault, meth) if type == :failure
|
15
|
-
MiniTestError.new(fault)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class FailureCore
|
20
|
-
def location(e)
|
21
|
-
last_before_assertion = ""
|
22
|
-
e.backtrace.reverse_each do |s|
|
23
|
-
break if s =~ /in .(assert|refute|flunk|pass|fail|raise|must|wont)/
|
24
|
-
last_before_assertion = s
|
25
|
-
end
|
26
|
-
last_before_assertion.sub(/:in .*$/, '')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class MiniTestSkipped < FailureCore
|
31
|
-
def initialize(fault) @fault = fault end
|
32
|
-
def failure?() false end
|
33
|
-
def error?() false end
|
34
|
-
def name() @fault.class.name end
|
35
|
-
def message() @fault.message end
|
36
|
-
def location() super @fault end
|
37
|
-
end
|
38
|
-
|
39
|
-
class MiniTestFailure < FailureCore
|
40
|
-
def initialize(fault, meth) @fault = fault; @meth = meth end
|
41
|
-
def failure?() true end
|
42
|
-
def error?() false end
|
43
|
-
def name() @meth end
|
44
|
-
def message() @fault.message end
|
45
|
-
def location() super @fault end
|
46
|
-
end
|
47
|
-
|
48
|
-
class MiniTestError < FailureCore
|
49
|
-
def initialize(fault) @fault = fault end
|
50
|
-
def failure?() false end
|
51
|
-
def error?() true end
|
52
|
-
def name() @fault.class.name end
|
53
|
-
def message() @fault.message end
|
54
|
-
def location() @fault.backtrace.join("\n") end
|
55
|
-
end
|
56
|
-
|
57
|
-
class Runner < MiniTest::Unit
|
58
|
-
|
59
|
-
@@out = $stdout
|
60
|
-
|
61
|
-
def initialize
|
62
|
-
super
|
63
|
-
@report_manager = ReportManager.new("test")
|
64
|
-
end
|
65
|
-
|
66
|
-
def _run_anything(type)
|
67
|
-
suites = MiniTest::Unit::TestCase.send "#{type}_suites"
|
68
|
-
return if suites.empty?
|
69
|
-
|
70
|
-
started_anything type
|
71
|
-
|
72
|
-
sync = output.respond_to? :"sync=" # stupid emacs
|
73
|
-
old_sync, output.sync = output.sync, true if sync
|
74
|
-
|
75
|
-
_run_suites(suites, type)
|
76
|
-
|
77
|
-
output.sync = old_sync if sync
|
78
|
-
|
79
|
-
finished_anything(type)
|
80
|
-
end
|
81
|
-
|
82
|
-
def _run_suites(suites, type)
|
83
|
-
suites.map { |suite| _run_suite suite, type }
|
84
|
-
end
|
85
|
-
|
86
|
-
def _run_suite(suite, type)
|
87
|
-
start_suite(suite)
|
88
|
-
|
89
|
-
header = "#{type}_suite_header"
|
90
|
-
puts send(header, suite) if respond_to? header
|
91
|
-
|
92
|
-
filter_suite_methods(suite, type).each do |method|
|
93
|
-
_run_test(suite, method)
|
94
|
-
end
|
95
|
-
|
96
|
-
finish_suite
|
97
|
-
end
|
98
|
-
|
99
|
-
def _run_test(suite, method)
|
100
|
-
start_case(method)
|
101
|
-
|
102
|
-
result = run_test(suite, method)
|
103
|
-
|
104
|
-
@assertion_count += result._assertions
|
105
|
-
@test_count += 1
|
106
|
-
|
107
|
-
finish_case
|
108
|
-
end
|
109
|
-
|
110
|
-
def puke(klass, meth, e)
|
111
|
-
e = case e
|
112
|
-
when MiniTest::Skip then
|
113
|
-
@skips += 1
|
114
|
-
fault(e, :skip)
|
115
|
-
return "S" unless @verbose
|
116
|
-
"Skipped:\n#{meth}(#{klass}) [#{location e}]:\n#{e.message}\n"
|
117
|
-
when MiniTest::Assertion then
|
118
|
-
@failures += 1
|
119
|
-
fault(e, :failure, meth)
|
120
|
-
"Failure:\n#{meth}(#{klass}) [#{location e}]:\n#{e.message}\n"
|
121
|
-
else
|
122
|
-
@errors += 1
|
123
|
-
fault(e, :error)
|
124
|
-
bt = MiniTest::filter_backtrace(e.backtrace).join "\n "
|
125
|
-
"Error:\n#{meth}(#{klass}):\n#{e.class}: #{e.message}\n #{bt}\n"
|
126
|
-
end
|
127
|
-
@report << e
|
128
|
-
e[0, 1]
|
129
|
-
end
|
130
|
-
|
131
|
-
private
|
132
|
-
|
133
|
-
def started_anything(type)
|
134
|
-
@test_count = 0
|
135
|
-
@assertion_count = 0
|
136
|
-
@last_assertion_count = 0
|
137
|
-
@result_assertion_count = 0
|
138
|
-
@start = Time.now
|
139
|
-
|
140
|
-
puts
|
141
|
-
puts "# Running #{type}s:"
|
142
|
-
puts
|
143
|
-
end
|
144
|
-
|
145
|
-
def finished_anything(type)
|
146
|
-
t = Time.now - @start
|
147
|
-
puts
|
148
|
-
puts
|
149
|
-
puts "Finished #{type}s in %.6fs, %.4f tests/s, %.4f assertions/s." %
|
150
|
-
[t, @test_count / t, @assertion_count / t]
|
151
|
-
|
152
|
-
report.each_with_index do |msg, i|
|
153
|
-
puts "\n%3d) %s" % [i + 1, msg]
|
154
|
-
end
|
155
|
-
|
156
|
-
puts
|
157
|
-
|
158
|
-
status
|
159
|
-
end
|
160
|
-
|
161
|
-
def filter_suite_methods(suite, type)
|
162
|
-
filter = options[:filter] || '/./'
|
163
|
-
filter = Regexp.new $1 if filter =~ /\/(.*)\//
|
164
|
-
|
165
|
-
suite.send("#{type}_methods").find_all do |m|
|
166
|
-
filter === m || filter === "#{suite}##{m}"
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def run_test(suite, method)
|
171
|
-
inst = suite.new method
|
172
|
-
inst._assertions = 0
|
173
|
-
|
174
|
-
print "#{suite}##{method} = " if @verbose
|
175
|
-
|
176
|
-
@start_time = Time.now
|
177
|
-
result = inst.run self
|
178
|
-
time = Time.now - @start_time
|
179
|
-
|
180
|
-
print "%.2f s = " % time if @verbose
|
181
|
-
print result
|
182
|
-
puts if @verbose
|
183
|
-
|
184
|
-
return inst
|
185
|
-
end
|
186
|
-
|
187
|
-
def start_suite(suite_name)
|
188
|
-
@current_suite = CI::Reporter::TestSuite.new(suite_name)
|
189
|
-
@current_suite.start
|
190
|
-
end
|
191
|
-
|
192
|
-
def finish_suite
|
193
|
-
if @current_suite
|
194
|
-
@current_suite.finish
|
195
|
-
@current_suite.assertions = @assertion_count - @last_assertion_count
|
196
|
-
@last_assertion_count = @assertion_count
|
197
|
-
@report_manager.write_report(@current_suite)
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
def start_case(test_name)
|
202
|
-
tc = CI::Reporter::TestCase.new(test_name)
|
203
|
-
tc.start
|
204
|
-
@current_suite.testcases << tc
|
205
|
-
end
|
206
|
-
|
207
|
-
def finish_case
|
208
|
-
tc = @current_suite.testcases.last
|
209
|
-
tc.finish
|
210
|
-
tc.assertions = @assertion_count - @result_assertion_count
|
211
|
-
@result_assertion_count = @assertion_count
|
212
|
-
end
|
213
|
-
|
214
|
-
def fault(fault, type = nil, meth = nil)
|
215
|
-
tc = @current_suite.testcases.last
|
216
|
-
if :skip == type
|
217
|
-
tc.skipped = true
|
218
|
-
else
|
219
|
-
tc.failures << Failure.new(fault, type, meth)
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
end
|
224
|
-
|
225
|
-
end
|
226
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
|
2
|
-
# See the file LICENSE.txt included with the distribution for
|
3
|
-
# software license details.
|
4
|
-
|
5
|
-
require File.expand_path('../utils', __FILE__)
|
6
|
-
|
7
|
-
namespace :ci do
|
8
|
-
namespace :setup do
|
9
|
-
task :cucumber_report_cleanup do
|
10
|
-
rm_rf ENV["CI_REPORTS"] || "features/reports"
|
11
|
-
end
|
12
|
-
|
13
|
-
task :cucumber => :cucumber_report_cleanup do
|
14
|
-
ENV["CUCUMBER_OPTS"] = "#{ENV['CUCUMBER_OPTS']} --format CI::Reporter::Cucumber"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Copyright (c) 2012 Alexander Shcherbinin <alexander.shcherbinin@gmail.com>
|
2
|
-
# See the file LICENSE.txt included with the distribution for
|
3
|
-
# software license details.
|
4
|
-
|
5
|
-
require File.expand_path('../utils', __FILE__)
|
6
|
-
|
7
|
-
namespace :ci do
|
8
|
-
namespace :setup do
|
9
|
-
task :minitest do
|
10
|
-
rm_rf ENV["CI_REPORTS"] || "test/reports"
|
11
|
-
test_loader = CI::Reporter.maybe_quote_filename "#{File.dirname(__FILE__)}/minitest_loader.rb"
|
12
|
-
ENV["TESTOPTS"] = "#{ENV["TESTOPTS"]} #{test_loader}"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# Copyright (c) 2012 Alexander Shcherbinin <alexander.shcherbinin@gmail.com>
|
2
|
-
# See the file LICENSE.txt included with the distribution for
|
3
|
-
# software license details.
|
4
|
-
|
5
|
-
$: << File.dirname(__FILE__) + "/../../.."
|
6
|
-
require 'ci/reporter/minitest'
|
7
|
-
|
8
|
-
# set defaults
|
9
|
-
MiniTest::Unit.runner = CI::Reporter::Runner.new
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
|
2
|
-
# See the file LICENSE.txt included with the distribution for
|
3
|
-
# software license details.
|
4
|
-
|
5
|
-
require File.expand_path('../utils', __FILE__)
|
6
|
-
|
7
|
-
namespace :ci do
|
8
|
-
namespace :setup do
|
9
|
-
task :spec_report_cleanup do
|
10
|
-
rm_rf ENV["CI_REPORTS"] || "spec/reports"
|
11
|
-
end
|
12
|
-
|
13
|
-
task :rspec => :spec_report_cleanup do
|
14
|
-
spec_opts = ["--require", CI::Reporter.maybe_quote_filename("#{File.dirname(__FILE__)}/rspec_loader.rb"),
|
15
|
-
"--format", "CI::Reporter::RSpec"].join(" ")
|
16
|
-
ENV["SPEC_OPTS"] = "#{ENV['SPEC_OPTS']} #{spec_opts}"
|
17
|
-
end
|
18
|
-
|
19
|
-
task :rspecdoc => :spec_report_cleanup do
|
20
|
-
spec_opts = ["--require", CI::Reporter.maybe_quote_filename("#{File.dirname(__FILE__)}/rspec_loader.rb"),
|
21
|
-
"--format", "CI::Reporter::RSpecDoc"].join(" ")
|
22
|
-
ENV["SPEC_OPTS"] = "#{ENV['SPEC_OPTS']} #{spec_opts}"
|
23
|
-
end
|
24
|
-
|
25
|
-
task :rspecbase => :spec_report_cleanup do
|
26
|
-
spec_opts = ["--require", CI::Reporter.maybe_quote_filename("#{File.dirname(__FILE__)}/rspec_loader.rb"),
|
27
|
-
"--format", "CI::Reporter::RSpecBase"].join(" ")
|
28
|
-
ENV["SPEC_OPTS"] = "#{ENV['SPEC_OPTS']} #{spec_opts}"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
namespace :ci do
|
2
|
-
namespace :setup do
|
3
|
-
task :spinach_report_cleanup do
|
4
|
-
rm_rf ENV["CI_REPORTS"] || "features/reports"
|
5
|
-
end
|
6
|
-
|
7
|
-
task :spinach => :spinach_report_cleanup do
|
8
|
-
loader = File.expand_path('prepare_ci_reporter.rb', ENV["SPINACH_SUPPORT_PATH"] || 'features/support')
|
9
|
-
if !File.exist? loader
|
10
|
-
File.open(loader, 'w') do |f|
|
11
|
-
f.puts "require 'ci/reporter/rake/spinach_loader'"
|
12
|
-
end
|
13
|
-
at_exit do
|
14
|
-
File.unlink loader
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|