ci_reporter 1.7.3 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +5 -0
- data/History.txt +8 -0
- data/README.rdoc +2 -0
- data/Rakefile +13 -1
- data/acceptance/verification_spec.rb +43 -0
- data/ci_reporter.gemspec +14 -2
- data/lib/ci/reporter/minitest.rb +3 -3
- data/lib/ci/reporter/rake/test_unit_loader.rb +2 -0
- data/lib/ci/reporter/rspec.rb +7 -1
- data/lib/ci/reporter/test_suite.rb +1 -1
- data/lib/ci/reporter/version.rb +1 -1
- data/spec/ci/reporter/output_capture_spec.rb +7 -0
- data/spec/ci/reporter/report_manager_spec.rb +4 -2
- data/stub.rake +1 -0
- metadata +67 -3
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -3,6 +3,7 @@ GEM
|
|
3
3
|
specs:
|
4
4
|
bouncy-castle-java (1.5.0146.1)
|
5
5
|
builder (3.0.0)
|
6
|
+
colorize (0.5.8)
|
6
7
|
cucumber (0.10.2)
|
7
8
|
builder (>= 2.1.2)
|
8
9
|
diff-lcs (>= 1.1.2)
|
@@ -35,6 +36,9 @@ GEM
|
|
35
36
|
rspec-mocks (2.8.0)
|
36
37
|
rubyforge (2.0.4)
|
37
38
|
json_pure (>= 1.1.7)
|
39
|
+
spinach (0.1.5.3)
|
40
|
+
colorize
|
41
|
+
gherkin
|
38
42
|
term-ansicolor (1.0.5)
|
39
43
|
test-unit (2.3.0)
|
40
44
|
|
@@ -52,4 +56,5 @@ DEPENDENCIES
|
|
52
56
|
rdoc
|
53
57
|
rspec (> 2.0.0)
|
54
58
|
rubyforge
|
59
|
+
spinach (< 0.2)
|
55
60
|
test-unit (> 2.0.0)
|
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 1.8.0 (11/30/12)
|
2
|
+
|
3
|
+
- Add support for Spinach -- pull request #67 from spraints/spinach
|
4
|
+
- Merge pull request #62 from citrusmoose/master
|
5
|
+
- Merge pull request #76 from pivotal-leopold/master
|
6
|
+
- Merge pull request #78 from Marketcircle/minitest-errors
|
7
|
+
- Merge pull request #56 from orianthi/master
|
8
|
+
|
1
9
|
== 1.7.3 (10/09/12)
|
2
10
|
|
3
11
|
- Don't extend RSpec BaseFormatter but instead delegate via method_missing for
|
data/README.rdoc
CHANGED
@@ -62,6 +62,8 @@ There's a bit of a chicken and egg problem because rubygems needs to be loaded b
|
|
62
62
|
* +CI_REPORTS+: if set, points to a directory where report files will be written.
|
63
63
|
* +CI_CAPTURE+: if set to value "off", stdout/stderr capture will be disabled.
|
64
64
|
|
65
|
+
== Travis Build Status {<img src="https://secure.travis-ci.org/nicksieger/ci_reporter.png"/>}[http://travis-ci.org/#!/nicksieger/ci_reporter]
|
66
|
+
|
65
67
|
== Source
|
66
68
|
|
67
69
|
You can get the CI::Reporter source using Git, in any of the following ways:
|
data/Rakefile
CHANGED
@@ -23,7 +23,12 @@ begin
|
|
23
23
|
p.description = p.paragraphs_of('README.rdoc', 0...1).join("\n\n")
|
24
24
|
p.extra_rdoc_files += ["README.rdoc"]
|
25
25
|
p.test_globs = ["spec/**/*_spec.rb"]
|
26
|
-
p.extra_deps
|
26
|
+
p.extra_deps << [ 'builder', '>= 2.1.2' ]
|
27
|
+
p.extra_dev_deps << [ 'cucumber', '~> 0.10.0' ]
|
28
|
+
p.extra_dev_deps << [ 'rspec', '> 2.0.0' ]
|
29
|
+
p.extra_dev_deps << [ 'test-unit', '> 2.0.0' ]
|
30
|
+
p.extra_dev_deps << [ 'minitest', '~> 2.2.0' ]
|
31
|
+
|
27
32
|
p.clean_globs += ["spec/reports", "acceptance/reports"]
|
28
33
|
end
|
29
34
|
hoe.spec.rdoc_options += ["-SHN", "-f", "darkfish"]
|
@@ -100,6 +105,13 @@ task :generate_output do
|
|
100
105
|
ruby "-Ilib #{opts} -rci/reporter/rake/minitest_loader acceptance/minitest_example_test.rb", &result_proc
|
101
106
|
ruby "-Ilib #{opts} -S #{@spec_bin} --require ci/reporter/rake/rspec_loader --format CI::Reporter::RSpec acceptance/rspec_example_spec.rb", &result_proc
|
102
107
|
ruby "-Ilib #{opts} -rci/reporter/rake/cucumber_loader -S cucumber --format CI::Reporter::Cucumber acceptance/cucumber", &result_proc
|
108
|
+
Dir.chdir 'acceptance/spinach' do
|
109
|
+
Bundler.with_clean_env do
|
110
|
+
ENV['CI_REPORTS'] = "../reports/spinach"
|
111
|
+
ruby "-S bundle"
|
112
|
+
ruby "-I../../lib #{opts} -rci/reporter/rake/spinach_loader -S spinach", &result_proc
|
113
|
+
end
|
114
|
+
end
|
103
115
|
ensure
|
104
116
|
ENV['RUBYOPT'] = opts if opts != "-rubygems"
|
105
117
|
ENV.delete 'CI_REPORTS'
|
@@ -142,3 +142,46 @@ describe "Cucumber acceptance" do
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
end
|
145
|
+
|
146
|
+
SPINACH_REPORTS_DIR = File.expand_path('spinach', REPORTS_DIR)
|
147
|
+
|
148
|
+
describe "Spinach acceptance" do
|
149
|
+
it "should generate three XML files" do
|
150
|
+
File.exist?(File.join(SPINACH_REPORTS_DIR, 'FEATURES-Example-feature.xml')).should == true
|
151
|
+
|
152
|
+
Dir["#{SPINACH_REPORTS_DIR}/FEATURES-*.xml"].length.should == 1
|
153
|
+
end
|
154
|
+
|
155
|
+
context "SPINACH report file" do
|
156
|
+
before :each do
|
157
|
+
@doc = File.open(File.join(SPINACH_REPORTS_DIR, 'FEATURES-Example-feature.xml')) do |f|
|
158
|
+
REXML::Document.new(f)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should have three tests and two failures" do
|
163
|
+
@doc.root.attributes["errors"].should == "2"
|
164
|
+
@doc.root.attributes["failures"].should == "1"
|
165
|
+
@doc.root.attributes["tests"].should == "4"
|
166
|
+
@doc.root.elements.to_a("/testsuite/testcase").size.should == 4
|
167
|
+
end
|
168
|
+
|
169
|
+
it "should have one failure for the lazy hacker" do
|
170
|
+
failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Lazy hacker']/failure")
|
171
|
+
failures.size.should == 1
|
172
|
+
failures.first.attributes["type"].should =~ /ExpectationNotMetError/
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should have one failure for missing steps" do
|
176
|
+
failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Missing steps']/failure")
|
177
|
+
failures.size.should == 1
|
178
|
+
failures.first.attributes["type"].should =~ /StepNotDefinedException/
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should have one failure for the bad coder" do
|
182
|
+
failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Bad coder']/failure")
|
183
|
+
failures.size.should == 1
|
184
|
+
failures.first.attributes["type"].should == "RuntimeError"
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
data/ci_reporter.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "ci_reporter"
|
5
|
-
s.version = "1.
|
5
|
+
s.version = "1.8.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Nick Sieger"]
|
9
|
-
s.date = "2012-
|
9
|
+
s.date = "2012-11-30"
|
10
10
|
s.description = "CI::Reporter is an add-on to Test::Unit, RSpec and Cucumber that allows you to generate XML reports of your test, spec and/or feature runs. The resulting files can be read by a continuous integration system that understands Ant's JUnit report XML format, thus allowing your CI system to track test/spec successes and failures."
|
11
11
|
s.email = "nick@nicksieger.com"
|
12
12
|
s.extra_rdoc_files = ["History.txt", "LICENSE.txt", "Manifest.txt", "README.rdoc"]
|
@@ -25,17 +25,29 @@ Gem::Specification.new do |s|
|
|
25
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
26
|
s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
|
27
27
|
s.add_development_dependency(%q<rubyforge>, [">= 2.0.4"])
|
28
|
+
s.add_development_dependency(%q<cucumber>, ["~> 0.10.0"])
|
29
|
+
s.add_development_dependency(%q<rspec>, ["> 2.0.0"])
|
30
|
+
s.add_development_dependency(%q<test-unit>, ["> 2.0.0"])
|
31
|
+
s.add_development_dependency(%q<minitest>, ["~> 2.2.0"])
|
28
32
|
s.add_development_dependency(%q<hoe>, ["~> 2.12"])
|
29
33
|
s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
|
30
34
|
else
|
31
35
|
s.add_dependency(%q<builder>, [">= 2.1.2"])
|
32
36
|
s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
|
37
|
+
s.add_dependency(%q<cucumber>, ["~> 0.10.0"])
|
38
|
+
s.add_dependency(%q<rspec>, ["> 2.0.0"])
|
39
|
+
s.add_dependency(%q<test-unit>, ["> 2.0.0"])
|
40
|
+
s.add_dependency(%q<minitest>, ["~> 2.2.0"])
|
33
41
|
s.add_dependency(%q<hoe>, ["~> 2.12"])
|
34
42
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
35
43
|
end
|
36
44
|
else
|
37
45
|
s.add_dependency(%q<builder>, [">= 2.1.2"])
|
38
46
|
s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
|
47
|
+
s.add_dependency(%q<cucumber>, ["~> 0.10.0"])
|
48
|
+
s.add_dependency(%q<rspec>, ["> 2.0.0"])
|
49
|
+
s.add_dependency(%q<test-unit>, ["> 2.0.0"])
|
50
|
+
s.add_dependency(%q<minitest>, ["~> 2.2.0"])
|
39
51
|
s.add_dependency(%q<hoe>, ["~> 2.12"])
|
40
52
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
41
53
|
end
|
data/lib/ci/reporter/minitest.rb
CHANGED
@@ -49,9 +49,9 @@ module CI
|
|
49
49
|
def initialize(fault) @fault = fault end
|
50
50
|
def failure?() false end
|
51
51
|
def error?() true end
|
52
|
-
def name() @fault.
|
53
|
-
def message() @fault.
|
54
|
-
def location() @fault.
|
52
|
+
def name() @fault.class.name end
|
53
|
+
def message() @fault.message end
|
54
|
+
def location() @fault.backtrace.join("\n") end
|
55
55
|
end
|
56
56
|
|
57
57
|
class Runner < MiniTest::Unit
|
@@ -11,6 +11,7 @@ module Test #:nodoc:all
|
|
11
11
|
module UI
|
12
12
|
module Console
|
13
13
|
class TestRunner
|
14
|
+
undef :create_mediator if instance_methods.map(&:to_s).include?("create_mediator")
|
14
15
|
def create_mediator(suite)
|
15
16
|
# swap in our custom mediator
|
16
17
|
return CI::Reporter::TestUnit.new(suite)
|
@@ -26,6 +27,7 @@ module Test #:nodoc:all
|
|
26
27
|
module Unit
|
27
28
|
module UI
|
28
29
|
class TestRunner
|
30
|
+
undef :setup_mediator if instance_methods.map(&:to_s).include?("setup_mediator")
|
29
31
|
def setup_mediator
|
30
32
|
# swap in our custom mediator
|
31
33
|
@mediator = CI::Reporter::TestUnit.new(@suite)
|
data/lib/ci/reporter/rspec.rb
CHANGED
@@ -75,8 +75,14 @@ module CI
|
|
75
75
|
output = []
|
76
76
|
output.push "#{exception.class.name << ":"}" unless exception.class.name =~ /RSpec/
|
77
77
|
output.push @exception.message
|
78
|
+
|
79
|
+
format_metadata = if defined?(::RSpec::Core::BacktraceFormatter)
|
80
|
+
@example.metadata
|
81
|
+
else
|
82
|
+
@example
|
83
|
+
end
|
78
84
|
|
79
|
-
[@formatter.format_backtrace(@exception.backtrace,
|
85
|
+
[@formatter.format_backtrace(@exception.backtrace, format_metadata)].flatten.each do |backtrace_info|
|
80
86
|
backtrace_info.lines.each do |line|
|
81
87
|
output.push " #{line}"
|
82
88
|
end
|
data/lib/ci/reporter/version.rb
CHANGED
@@ -40,10 +40,12 @@ describe "The ReportManager" do
|
|
40
40
|
it "should shorten extremely long report filenames" do
|
41
41
|
reporter = CI::Reporter::ReportManager.new("spec")
|
42
42
|
suite = mock("test suite")
|
43
|
-
|
43
|
+
very_long_name = "some test suite name that goes on and on and on and on and on and on and does not look like it will end any time soon and just when you think it is almost over it just continues to go on and on and on and on and on until it is almost over but wait there is more and then el fin"
|
44
|
+
suite.should_receive(:name).and_return(very_long_name)
|
44
45
|
suite.should_receive(:to_xml).and_return("<xml></xml>")
|
45
46
|
reporter.write_report(suite)
|
46
|
-
filename = "#{REPORTS_DIR}/SPEC-
|
47
|
+
filename = "#{REPORTS_DIR}/SPEC-#{very_long_name}"[0..CI::Reporter::ReportManager::MAX_FILENAME_SIZE].gsub(/\s/, '-') + ".xml"
|
48
|
+
filename.length.should be_<= 255
|
47
49
|
File.exist?(filename).should be_true
|
48
50
|
File.open(filename) {|f| f.read.should == "<xml></xml>"}
|
49
51
|
end
|
data/stub.rake
CHANGED
@@ -12,4 +12,5 @@ load File.dirname(__FILE__) + '/lib/ci/reporter/rake/rspec.rb'
|
|
12
12
|
load File.dirname(__FILE__) + '/lib/ci/reporter/rake/cucumber.rb'
|
13
13
|
load File.dirname(__FILE__) + '/lib/ci/reporter/rake/test_unit.rb'
|
14
14
|
load File.dirname(__FILE__) + '/lib/ci/reporter/rake/minitest.rb'
|
15
|
+
load File.dirname(__FILE__) + '/lib/ci/reporter/rake/spinach.rb'
|
15
16
|
load 'Rakefile'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ci_reporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|
@@ -43,6 +43,70 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 2.0.4
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: cucumber
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.10.0
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.10.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>'
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 2.0.0
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>'
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.0.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: test-unit
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>'
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.0.0
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>'
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.0.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: minitest
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.2.0
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.2.0
|
46
110
|
- !ruby/object:Gem::Dependency
|
47
111
|
name: hoe
|
48
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
215
|
version: '0'
|
152
216
|
segments:
|
153
217
|
- 0
|
154
|
-
hash:
|
218
|
+
hash: -344492552991075668
|
155
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
220
|
none: false
|
157
221
|
requirements:
|