ci_reporter 1.7.0 → 1.7.1
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.
- data/.gemtest +0 -0
- data/.travis.yml +8 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +55 -0
- data/History.txt +13 -0
- data/Manifest.txt +10 -0
- data/README.rdoc +13 -4
- data/Rakefile +1 -5
- data/acceptance/cucumber/cucumber_example.feature +19 -0
- data/acceptance/cucumber/step_definitions/development_steps.rb +40 -0
- data/acceptance/minitest_example_test.rb +17 -0
- data/acceptance/rspec_example_spec.rb +24 -0
- data/acceptance/test_unit_example_test.rb +23 -0
- data/acceptance/verification_spec.rb +144 -0
- data/ci_reporter.gemspec +42 -0
- data/lib/ci/reporter/minitest.rb +5 -1
- data/lib/ci/reporter/rspec.rb +8 -4
- data/lib/ci/reporter/test_suite.rb +20 -5
- data/lib/ci/reporter/test_unit.rb +2 -2
- data/lib/ci/reporter/version.rb +1 -1
- metadata +137 -126
data/.gemtest
ADDED
File without changes
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
|
3
|
+
# See the file LICENSE.txt included with the distribution for
|
4
|
+
# software license details.
|
5
|
+
#++
|
6
|
+
|
7
|
+
source :rubygems
|
8
|
+
|
9
|
+
gem 'builder'
|
10
|
+
group :development do
|
11
|
+
gem 'hoe'
|
12
|
+
gem 'rubyforge'
|
13
|
+
gem 'cucumber'
|
14
|
+
gem 'rspec', '> 2.0.0'
|
15
|
+
gem 'test-unit', '> 2.0.0'
|
16
|
+
gem 'minitest'
|
17
|
+
gem 'rcov', :platform => :ruby_18
|
18
|
+
gem 'rdoc'
|
19
|
+
gem 'jruby-openssl', :platform => :jruby
|
20
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
bouncy-castle-java (1.5.0146.1)
|
5
|
+
builder (3.0.0)
|
6
|
+
cucumber (0.10.2)
|
7
|
+
builder (>= 2.1.2)
|
8
|
+
diff-lcs (>= 1.1.2)
|
9
|
+
gherkin (>= 2.3.5)
|
10
|
+
json (>= 1.4.6)
|
11
|
+
term-ansicolor (>= 1.0.5)
|
12
|
+
diff-lcs (1.1.3)
|
13
|
+
gherkin (2.3.5)
|
14
|
+
json (>= 1.4.6)
|
15
|
+
gherkin (2.3.5-java)
|
16
|
+
json (>= 1.4.6)
|
17
|
+
hoe (2.12.4)
|
18
|
+
rake (~> 0.8)
|
19
|
+
jruby-openssl (0.7.4)
|
20
|
+
bouncy-castle-java
|
21
|
+
json (1.6.3)
|
22
|
+
json (1.6.3-java)
|
23
|
+
json_pure (1.6.1)
|
24
|
+
minitest (2.2.2)
|
25
|
+
rake (0.9.2.2)
|
26
|
+
rcov (1.0.0)
|
27
|
+
rdoc (3.9.2)
|
28
|
+
rspec (2.8.0)
|
29
|
+
rspec-core (~> 2.8.0)
|
30
|
+
rspec-expectations (~> 2.8.0)
|
31
|
+
rspec-mocks (~> 2.8.0)
|
32
|
+
rspec-core (2.8.0)
|
33
|
+
rspec-expectations (2.8.0)
|
34
|
+
diff-lcs (~> 1.1.2)
|
35
|
+
rspec-mocks (2.8.0)
|
36
|
+
rubyforge (2.0.4)
|
37
|
+
json_pure (>= 1.1.7)
|
38
|
+
term-ansicolor (1.0.5)
|
39
|
+
test-unit (2.3.0)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
java
|
43
|
+
ruby
|
44
|
+
|
45
|
+
DEPENDENCIES
|
46
|
+
builder
|
47
|
+
cucumber
|
48
|
+
hoe
|
49
|
+
jruby-openssl
|
50
|
+
minitest
|
51
|
+
rcov
|
52
|
+
rdoc
|
53
|
+
rspec (> 2.0.0)
|
54
|
+
rubyforge
|
55
|
+
test-unit (> 2.0.0)
|
data/History.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
== 1.7.1 (08/16/12)
|
2
|
+
|
3
|
+
- #58: Use const_defined? for checking a constant is defined (Kouhei Sutou)
|
4
|
+
- #70: Initialize delegate IO for non-tee methods
|
5
|
+
- #55: Accommodate 1.8.7 which requires std streams to be subclasses of IO
|
6
|
+
- #52: Mark skipped tests as skipped instead of failure
|
7
|
+
- #51: Allow for constants to include "Omission" or :Omission (1.8 vs. 1.9).
|
8
|
+
|
9
|
+
== 1.7.0 (01/28/11)
|
10
|
+
|
11
|
+
- #39, #49: Minitest support (thanks Alexander Shcherbinin)!
|
12
|
+
- #14, #44: fix remaining 1.9 issues
|
13
|
+
|
1
14
|
== 1.6.9 (12/14/11)
|
2
15
|
|
3
16
|
- #49: fix nil to_xs with CI_CAPTURE=off (thanks Sean Walbran)
|
data/Manifest.txt
CHANGED
@@ -1,8 +1,18 @@
|
|
1
|
+
.travis.yml
|
2
|
+
Gemfile
|
3
|
+
Gemfile.lock
|
1
4
|
History.txt
|
2
5
|
LICENSE.txt
|
3
6
|
Manifest.txt
|
4
7
|
README.rdoc
|
5
8
|
Rakefile
|
9
|
+
acceptance/cucumber/cucumber_example.feature
|
10
|
+
acceptance/cucumber/step_definitions/development_steps.rb
|
11
|
+
acceptance/minitest_example_test.rb
|
12
|
+
acceptance/rspec_example_spec.rb
|
13
|
+
acceptance/test_unit_example_test.rb
|
14
|
+
acceptance/verification_spec.rb
|
15
|
+
ci_reporter.gemspec
|
6
16
|
lib/ci/reporter/core.rb
|
7
17
|
lib/ci/reporter/cucumber.rb
|
8
18
|
lib/ci/reporter/minitest.rb
|
data/README.rdoc
CHANGED
@@ -10,20 +10,29 @@ CI::Reporter is available as a gem. To install the gem, use the usual gem comman
|
|
10
10
|
|
11
11
|
CI::Reporter works best with projects that use a +Rakefile+ along with the standard <code>Rake::TestTask</code> or <code>Spec::Rake::SpecTask/RSpec::Core::RakeTask</code> tasks for running tests or examples, respectively. In this fashion, it hooks into <code>Test::Unit</code> or +RSpec+ using environment variables recognized by these custom tasks to inject the CI::Reporter code into the test or spec runs. If you're using the Rails plugin, step 1 is unnecessary; skip to step 2.
|
12
12
|
|
13
|
-
1. To use CI::Reporter, simply add the following lines to your Rakefile:
|
13
|
+
1. To use CI::Reporter, simply add one of the following lines to your Rakefile:
|
14
14
|
|
15
|
-
require 'rubygems'
|
16
15
|
require 'ci/reporter/rake/rspec' # use this if you're using RSpec
|
17
16
|
require 'ci/reporter/rake/cucumber' # use this if you're using Cucumber
|
18
17
|
require 'ci/reporter/rake/test_unit' # use this if you're using Test::Unit
|
19
|
-
require 'ci/reporter/rake/minitest'
|
18
|
+
require 'ci/reporter/rake/minitest' # use this if you're using Ruby 1.9 or minitest
|
20
19
|
|
21
|
-
2. Next, either modify your Rakefile to make the <code>ci:setup:rspec</code>, <code>ci:setup:cucumber</code> or <code>ci:setup:
|
20
|
+
2. Next, either modify your Rakefile to make the <code>ci:setup:rspec</code>, <code>ci:setup:cucumber</code>, <code>ci:setup:testunit</code> or <code>ci:setup:minitest</code> task a dependency of your test tasks, or run one of these rake tasks:
|
22
21
|
|
23
22
|
rake ci:setup:testunit test
|
23
|
+
rake ci:setup:minitest test
|
24
|
+
rake ci:setup:rspec spec
|
25
|
+
rake ci:setup:cucumber features
|
26
|
+
|
27
|
+
== Jenkins setup
|
28
|
+
|
29
|
+
1. Tick the box labelled "Publish JUnit test result report" in the job configuration
|
30
|
+
|
31
|
+
2. Enter "test/reports/*.xml,spec/reports/*.xml" in the "Test report XMLs" field (adjust this to suit which tests you are running)
|
24
32
|
|
25
33
|
Report files are written, by default, to the <code>test/reports</code>, <code>features/reports</code> or <code>spec/reports</code> subdirectory of your project. If you wish to customize the location, simply set the environment variable CI_REPORTS (either in the environment, on the Rake command line, or in your Rakefile) to the location where they should go.
|
26
34
|
|
35
|
+
|
27
36
|
== Advanced Usage
|
28
37
|
|
29
38
|
If you don't have control over the Rakefile or don't want to modify it, CI::Reporter has a substitute rake file that you can specify on the command-line. It assumes that the main project rake file is called +Rakefile+ and lives in the current directory. Run like so:
|
data/Rakefile
CHANGED
@@ -6,11 +6,7 @@
|
|
6
6
|
|
7
7
|
require 'bundler/setup'
|
8
8
|
|
9
|
-
MANIFEST = FileList["History.txt", "Manifest.txt", "README.rdoc", "LICENSE.txt", "Rakefile",
|
10
|
-
"*.rake", "lib/**/*.rb", "spec/**/*.rb", "tasks/**/*.rake"]
|
11
|
-
|
12
9
|
begin
|
13
|
-
File.open("Manifest.txt", "w") {|f| MANIFEST.sort.each {|n| f << "#{n}\n"} }
|
14
10
|
require 'hoe'
|
15
11
|
Hoe.plugin :rubyforge
|
16
12
|
require File.dirname(__FILE__) + '/lib/ci/reporter/version'
|
@@ -28,8 +24,8 @@ begin
|
|
28
24
|
p.extra_rdoc_files += ["README.rdoc"]
|
29
25
|
p.test_globs = ["spec/**/*_spec.rb"]
|
30
26
|
p.extra_deps << ['builder', ">= 2.1.2"]
|
27
|
+
p.clean_globs += ["spec/reports", "acceptance/reports"]
|
31
28
|
end
|
32
|
-
hoe.spec.files = MANIFEST
|
33
29
|
hoe.spec.rdoc_options += ["-SHN", "-f", "darkfish"]
|
34
30
|
|
35
31
|
task :gemspec do
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Feature: Example feature
|
2
|
+
As a conscientious developer who writes features
|
3
|
+
I want to be able to see my features passing on the CI Server
|
4
|
+
So that I can bask in the glow of a green bar
|
5
|
+
|
6
|
+
Scenario: Conscientious developer
|
7
|
+
Given that I am a conscientious developer
|
8
|
+
And I write cucumber features
|
9
|
+
Then I should see a green bar
|
10
|
+
|
11
|
+
Scenario: Lazy hacker
|
12
|
+
Given that I am a lazy hacker
|
13
|
+
And I don't bother writing cucumber features
|
14
|
+
Then I should be fired
|
15
|
+
|
16
|
+
Scenario: Bad coder
|
17
|
+
Given that I can't code for peanuts
|
18
|
+
And I write step definitions that throw exceptions
|
19
|
+
Then I shouldn't be allowed out in public
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
|
3
|
+
# See the file LICENSE.txt included with the distribution for
|
4
|
+
# software license details.
|
5
|
+
#++
|
6
|
+
|
7
|
+
begin
|
8
|
+
require 'rspec/expectations'
|
9
|
+
rescue LoadError
|
10
|
+
require 'spec/expectations'
|
11
|
+
end
|
12
|
+
|
13
|
+
Given /^that I am a conscientious developer$/ do
|
14
|
+
end
|
15
|
+
|
16
|
+
Given /^I write cucumber features$/ do
|
17
|
+
end
|
18
|
+
|
19
|
+
Then /^I should see a green bar$/ do
|
20
|
+
end
|
21
|
+
|
22
|
+
Given /^that I am a lazy hacker$/ do
|
23
|
+
end
|
24
|
+
|
25
|
+
Given /^I don't bother writing cucumber features$/ do
|
26
|
+
false.should be_true
|
27
|
+
end
|
28
|
+
|
29
|
+
Then /^I should be fired$/ do
|
30
|
+
end
|
31
|
+
|
32
|
+
Given /^that I can't code for peanuts$/ do
|
33
|
+
end
|
34
|
+
|
35
|
+
Given /^I write step definitions that throw exceptions$/ do
|
36
|
+
raise RuntimeError, "User error!"
|
37
|
+
end
|
38
|
+
|
39
|
+
Then /^I shouldn't be allowed out in public$/ do
|
40
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
|
3
|
+
class MiniTestExampleTestOne < MiniTest::Unit::TestCase
|
4
|
+
def test_one
|
5
|
+
puts "Some <![CDATA[on stdout]]>"
|
6
|
+
assert false
|
7
|
+
end
|
8
|
+
def teardown
|
9
|
+
raise "second failure"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class MiniTestExampleTestTwo < MiniTest::Unit::TestCase
|
14
|
+
def test_two
|
15
|
+
assert true
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
|
3
|
+
# See the file LICENSE.txt included with the distribution for
|
4
|
+
# software license details.
|
5
|
+
#++
|
6
|
+
|
7
|
+
describe "RSpec example" do
|
8
|
+
it "should succeed" do
|
9
|
+
true.should be_true
|
10
|
+
nil.should be_nil
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should fail" do
|
14
|
+
true.should be_false
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should be pending"
|
18
|
+
|
19
|
+
describe "nested" do
|
20
|
+
it "should succeed" do
|
21
|
+
true.should be_true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
|
3
|
+
# See the file LICENSE.txt included with the distribution for
|
4
|
+
# software license details.
|
5
|
+
#++
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
class TestUnitExampleTestOne < Test::Unit::TestCase
|
10
|
+
def test_one
|
11
|
+
puts "Some <![CDATA[on stdout]]>"
|
12
|
+
assert(false, "First failure")
|
13
|
+
end
|
14
|
+
def teardown
|
15
|
+
raise "second failure"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class TestUnitExampleTestTwo < Test::Unit::TestCase
|
20
|
+
def test_two
|
21
|
+
assert true
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
|
3
|
+
# See the file LICENSE.txt included with the distribution for
|
4
|
+
# software license details.
|
5
|
+
#++
|
6
|
+
|
7
|
+
require 'rexml/document'
|
8
|
+
|
9
|
+
REPORTS_DIR = File.dirname(__FILE__) + '/reports'
|
10
|
+
|
11
|
+
describe "Test::Unit acceptance" do
|
12
|
+
it "should generate two XML files" do
|
13
|
+
File.exist?(File.join(REPORTS_DIR, 'TEST-TestUnitExampleTestOne.xml')).should == true
|
14
|
+
File.exist?(File.join(REPORTS_DIR, 'TEST-TestUnitExampleTestTwo.xml')).should == true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should have one error and one failure for TestUnitExampleTestOne" do
|
18
|
+
doc = File.open(File.join(REPORTS_DIR, 'TEST-TestUnitExampleTestOne.xml')) do |f|
|
19
|
+
REXML::Document.new(f)
|
20
|
+
end
|
21
|
+
doc.root.attributes["errors"].should == "1"
|
22
|
+
doc.root.attributes["failures"].should == "1"
|
23
|
+
doc.root.attributes["assertions"].should == "1"
|
24
|
+
doc.root.attributes["tests"].should == "1"
|
25
|
+
doc.root.elements.to_a("/testsuite/testcase").size.should == 1
|
26
|
+
doc.root.elements.to_a("/testsuite/testcase/error").size.should == 1
|
27
|
+
doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 1
|
28
|
+
doc.root.elements.to_a("/testsuite/system-out").first.texts.inject("") do |c,e|
|
29
|
+
c << e.value; c
|
30
|
+
end.strip.should == "Some <![CDATA[on stdout]]>"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should have no errors or failures for TestUnitExampleTestTwo" do
|
34
|
+
doc = File.open(File.join(REPORTS_DIR, 'TEST-TestUnitExampleTestTwo.xml')) do |f|
|
35
|
+
REXML::Document.new(f)
|
36
|
+
end
|
37
|
+
doc.root.attributes["errors"].should == "0"
|
38
|
+
doc.root.attributes["failures"].should == "0"
|
39
|
+
doc.root.attributes["assertions"].should == "1"
|
40
|
+
doc.root.attributes["tests"].should == "1"
|
41
|
+
doc.root.elements.to_a("/testsuite/testcase").size.should == 1
|
42
|
+
doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 0
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "MiniTest::Unit acceptance" do
|
47
|
+
it "should generate two XML files" do
|
48
|
+
File.exist?(File.join(REPORTS_DIR, 'TEST-MiniTestExampleTestOne.xml')).should == true
|
49
|
+
File.exist?(File.join(REPORTS_DIR, 'TEST-MiniTestExampleTestTwo.xml')).should == true
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should have one error and one failure for MiniTestExampleTestOne" do
|
53
|
+
doc = File.open(File.join(REPORTS_DIR, 'TEST-MiniTestExampleTestOne.xml')) do |f|
|
54
|
+
REXML::Document.new(f)
|
55
|
+
end
|
56
|
+
doc.root.attributes["errors"].should == "1"
|
57
|
+
doc.root.attributes["failures"].should == "1"
|
58
|
+
doc.root.attributes["assertions"].should == "1"
|
59
|
+
doc.root.attributes["tests"].should == "1"
|
60
|
+
doc.root.elements.to_a("/testsuite/testcase").size.should == 1
|
61
|
+
doc.root.elements.to_a("/testsuite/testcase/error").size.should == 1
|
62
|
+
doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 1
|
63
|
+
doc.root.elements.to_a("/testsuite/system-out").first.texts.inject("") do |c,e|
|
64
|
+
c << e.value; c
|
65
|
+
end.strip.should == "Some <![CDATA[on stdout]]>"
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should have no errors or failures for MiniTestExampleTestTwo" do
|
69
|
+
doc = File.open(File.join(REPORTS_DIR, 'TEST-MiniTestExampleTestTwo.xml')) do |f|
|
70
|
+
REXML::Document.new(f)
|
71
|
+
end
|
72
|
+
doc.root.attributes["errors"].should == "0"
|
73
|
+
doc.root.attributes["failures"].should == "0"
|
74
|
+
doc.root.attributes["assertions"].should == "1"
|
75
|
+
doc.root.attributes["tests"].should == "1"
|
76
|
+
doc.root.elements.to_a("/testsuite/testcase").size.should == 1
|
77
|
+
doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 0
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "RSpec acceptance" do
|
82
|
+
it "should generate two XML files" do
|
83
|
+
File.exist?(File.join(REPORTS_DIR, 'SPEC-RSpec-example.xml')).should == true
|
84
|
+
File.exist?(File.join(REPORTS_DIR, 'SPEC-RSpec-example-nested.xml')).should == true
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should have two tests and one failure" do
|
88
|
+
doc = File.open(File.join(REPORTS_DIR, 'SPEC-RSpec-example.xml')) do |f|
|
89
|
+
REXML::Document.new(f)
|
90
|
+
end
|
91
|
+
doc.root.attributes["errors"].should == "0"
|
92
|
+
doc.root.attributes["failures"].should == "1"
|
93
|
+
doc.root.attributes["tests"].should == "3"
|
94
|
+
doc.root.elements.to_a("/testsuite/testcase").size.should == 3
|
95
|
+
failures = doc.root.elements.to_a("/testsuite/testcase/failure")
|
96
|
+
failures.size.should == 1
|
97
|
+
failures.first.attributes["type"].should =~ /ExpectationNotMetError/
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should have one test in the nested example report" do
|
101
|
+
doc = File.open(File.join(REPORTS_DIR, 'SPEC-RSpec-example-nested.xml')) do |f|
|
102
|
+
REXML::Document.new(f)
|
103
|
+
end
|
104
|
+
doc.root.attributes["errors"].should == "0"
|
105
|
+
doc.root.attributes["failures"].should == "0"
|
106
|
+
doc.root.attributes["tests"].should == "1"
|
107
|
+
doc.root.elements.to_a("/testsuite/testcase").size.should == 1
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "Cucumber acceptance" do
|
112
|
+
it "should generate three XML files" do
|
113
|
+
File.exist?(File.join(REPORTS_DIR, 'FEATURES-Example-feature.xml')).should == true
|
114
|
+
|
115
|
+
Dir["#{REPORTS_DIR}/FEATURES-*.xml"].length.should == 1
|
116
|
+
end
|
117
|
+
|
118
|
+
context "FEATURES report file" do
|
119
|
+
before :each do
|
120
|
+
@doc = File.open(File.join(REPORTS_DIR, 'FEATURES-Example-feature.xml')) do |f|
|
121
|
+
REXML::Document.new(f)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should have three tests and two failures" do
|
126
|
+
@doc.root.attributes["errors"].should == "0"
|
127
|
+
@doc.root.attributes["failures"].should == "2"
|
128
|
+
@doc.root.attributes["tests"].should == "3"
|
129
|
+
@doc.root.elements.to_a("/testsuite/testcase").size.should == 3
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should have one failure for the lazy hacker" do
|
133
|
+
failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Lazy hacker']/failure")
|
134
|
+
failures.size.should == 1
|
135
|
+
failures.first.attributes["type"].should =~ /ExpectationNotMetError/
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should have one failure for the bad coder" do
|
139
|
+
failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Bad coder']/failure")
|
140
|
+
failures.size.should == 1
|
141
|
+
failures.first.attributes["type"].should == "RuntimeError"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
data/ci_reporter.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "ci_reporter"
|
5
|
+
s.version = "1.7.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Nick Sieger"]
|
9
|
+
s.date = "2012-08-16"
|
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
|
+
s.email = "nick@nicksieger.com"
|
12
|
+
s.extra_rdoc_files = ["History.txt", "LICENSE.txt", "Manifest.txt", "README.rdoc"]
|
13
|
+
s.files = [".travis.yml", "Gemfile", "Gemfile.lock", "History.txt", "LICENSE.txt", "Manifest.txt", "README.rdoc", "Rakefile", "acceptance/cucumber/cucumber_example.feature", "acceptance/cucumber/step_definitions/development_steps.rb", "acceptance/minitest_example_test.rb", "acceptance/rspec_example_spec.rb", "acceptance/test_unit_example_test.rb", "acceptance/verification_spec.rb", "ci_reporter.gemspec", "lib/ci/reporter/core.rb", "lib/ci/reporter/cucumber.rb", "lib/ci/reporter/minitest.rb", "lib/ci/reporter/rake/cucumber.rb", "lib/ci/reporter/rake/cucumber_loader.rb", "lib/ci/reporter/rake/minitest.rb", "lib/ci/reporter/rake/minitest_loader.rb", "lib/ci/reporter/rake/rspec.rb", "lib/ci/reporter/rake/rspec_loader.rb", "lib/ci/reporter/rake/test_unit.rb", "lib/ci/reporter/rake/test_unit_loader.rb", "lib/ci/reporter/rake/utils.rb", "lib/ci/reporter/report_manager.rb", "lib/ci/reporter/rspec.rb", "lib/ci/reporter/test_suite.rb", "lib/ci/reporter/test_unit.rb", "lib/ci/reporter/version.rb", "spec/ci/reporter/cucumber_spec.rb", "spec/ci/reporter/output_capture_spec.rb", "spec/ci/reporter/rake/rake_tasks_spec.rb", "spec/ci/reporter/report_manager_spec.rb", "spec/ci/reporter/rspec_spec.rb", "spec/ci/reporter/test_suite_spec.rb", "spec/ci/reporter/test_unit_spec.rb", "spec/spec_helper.rb", "stub.rake", "tasks/ci_reporter.rake", ".gemtest"]
|
14
|
+
s.homepage = "http://caldersphere.rubyforge.org/ci_reporter"
|
15
|
+
s.rdoc_options = ["--main", "README.rdoc", "-SHN", "-f", "darkfish"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = "caldersphere"
|
18
|
+
s.rubygems_version = "1.8.15"
|
19
|
+
s.summary = "CI::Reporter allows you to generate reams of XML for use with continuous integration systems."
|
20
|
+
s.test_files = ["spec/ci/reporter/cucumber_spec.rb", "spec/ci/reporter/output_capture_spec.rb", "spec/ci/reporter/report_manager_spec.rb", "spec/ci/reporter/rspec_spec.rb", "spec/ci/reporter/test_suite_spec.rb", "spec/ci/reporter/test_unit_spec.rb", "spec/ci/reporter/rake/rake_tasks_spec.rb"]
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
|
27
|
+
s.add_development_dependency(%q<rubyforge>, [">= 2.0.4"])
|
28
|
+
s.add_development_dependency(%q<hoe>, ["~> 2.12"])
|
29
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
|
30
|
+
else
|
31
|
+
s.add_dependency(%q<builder>, [">= 2.1.2"])
|
32
|
+
s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
|
33
|
+
s.add_dependency(%q<hoe>, ["~> 2.12"])
|
34
|
+
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
35
|
+
end
|
36
|
+
else
|
37
|
+
s.add_dependency(%q<builder>, [">= 2.1.2"])
|
38
|
+
s.add_dependency(%q<rubyforge>, [">= 2.0.4"])
|
39
|
+
s.add_dependency(%q<hoe>, ["~> 2.12"])
|
40
|
+
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
41
|
+
end
|
42
|
+
end
|
data/lib/ci/reporter/minitest.rb
CHANGED
@@ -211,7 +211,11 @@ module CI
|
|
211
211
|
|
212
212
|
def fault(fault, type = nil, meth = nil)
|
213
213
|
tc = @current_suite.testcases.last
|
214
|
-
|
214
|
+
if :skip == type
|
215
|
+
tc.skipped = true
|
216
|
+
else
|
217
|
+
tc.failures << Failure.new(fault, type, meth)
|
218
|
+
end
|
215
219
|
end
|
216
220
|
|
217
221
|
end
|
data/lib/ci/reporter/rspec.rb
CHANGED
@@ -43,16 +43,20 @@ module CI
|
|
43
43
|
!failure?
|
44
44
|
end
|
45
45
|
|
46
|
-
def name()
|
47
|
-
def message()
|
48
|
-
def location()
|
46
|
+
def name() exception.class.name end
|
47
|
+
def message() exception.message end
|
48
|
+
def location() (exception.backtrace || ["No backtrace available"]).join("\n") end
|
49
49
|
end
|
50
50
|
|
51
51
|
class RSpec2Failure < RSpecFailure
|
52
52
|
def initialize(example, formatter)
|
53
53
|
@formatter = formatter
|
54
54
|
@example = example
|
55
|
-
|
55
|
+
if @example.respond_to?(:execution_result)
|
56
|
+
@exception = @example.execution_result[:exception] || @example.execution_result[:exception_encountered]
|
57
|
+
else
|
58
|
+
@exception = @example.metadata[:execution_result][:exception]
|
59
|
+
end
|
56
60
|
end
|
57
61
|
|
58
62
|
def name
|
@@ -8,10 +8,25 @@ require 'stringio'
|
|
8
8
|
module CI
|
9
9
|
module Reporter
|
10
10
|
# Emulates/delegates IO to $stdout or $stderr in order to capture output to report in the XML file.
|
11
|
-
|
11
|
+
module OutputCapture
|
12
|
+
class Delegate < DelegateClass(IO)
|
13
|
+
include OutputCapture
|
14
|
+
def initialize(io, &assign)
|
15
|
+
super(io)
|
16
|
+
capture(io, &assign)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.wrap(io, &assign)
|
21
|
+
if defined?(RUBY_ENGINE) # JRuby, Ruby 1.9, etc.
|
22
|
+
Delegate.new(io, &assign)
|
23
|
+
else # Ruby 1.8 requires streams to be subclass of IO
|
24
|
+
IO.new(io.fileno, "w").tap {|x| x.extend self; x.capture(io, &assign) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
12
28
|
# Start capturing IO, using the given block to assign self to the proper IO global.
|
13
|
-
def
|
14
|
-
super
|
29
|
+
def capture(io, &assign)
|
15
30
|
@delegate_io = io
|
16
31
|
@captured_io = StringIO.new
|
17
32
|
@assign_block = assign
|
@@ -48,8 +63,8 @@ module CI
|
|
48
63
|
def start
|
49
64
|
@start = Time.now
|
50
65
|
unless ENV['CI_CAPTURE'] == "off"
|
51
|
-
@capture_out = OutputCapture.
|
52
|
-
@capture_err = OutputCapture.
|
66
|
+
@capture_out = OutputCapture.wrap($stdout) {|io| $stdout = io }
|
67
|
+
@capture_err = OutputCapture.wrap($stderr) {|io| $stderr = io }
|
53
68
|
end
|
54
69
|
end
|
55
70
|
|
@@ -13,8 +13,8 @@ module CI
|
|
13
13
|
class Failure
|
14
14
|
def self.new(fault)
|
15
15
|
return TestUnitFailure.new(fault) if fault.kind_of?(Test::Unit::Failure)
|
16
|
-
return TestUnitSkipped.new(fault) if Test::Unit.
|
17
|
-
return TestUnitNotification.new(fault) if Test::Unit.
|
16
|
+
return TestUnitSkipped.new(fault) if Test::Unit.const_defined?(:Omission) && (fault.kind_of?(Test::Unit::Omission) || fault.kind_of?(Test::Unit::Pending))
|
17
|
+
return TestUnitNotification.new(fault) if Test::Unit.const_defined?(:Notification) && fault.kind_of?(Test::Unit::Notification)
|
18
18
|
TestUnitError.new(fault)
|
19
19
|
end
|
20
20
|
end
|
data/lib/ci/reporter/version.rb
CHANGED
metadata
CHANGED
@@ -1,144 +1,155 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ci_reporter
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.0
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 1.7.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
- Nick Sieger
|
7
|
+
authors:
|
8
|
+
- Nick Sieger
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
files can be read by a continuous integration system that understands Ant's JUnit
|
61
|
-
report XML format, thus allowing your CI system to track test/spec successes and
|
62
|
-
failures.
|
12
|
+
|
13
|
+
date: 2012-08-16 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: builder
|
17
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.1.2
|
23
|
+
requirement: *id001
|
24
|
+
prerelease: false
|
25
|
+
type: :runtime
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rubyforge
|
28
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.4
|
34
|
+
requirement: *id002
|
35
|
+
prerelease: false
|
36
|
+
type: :development
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: hoe
|
39
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "2.12"
|
45
|
+
requirement: *id003
|
46
|
+
prerelease: false
|
47
|
+
type: :development
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rdoc
|
50
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "3.10"
|
56
|
+
requirement: *id004
|
57
|
+
prerelease: false
|
58
|
+
type: :development
|
59
|
+
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.
|
63
60
|
email: nick@nicksieger.com
|
64
61
|
executables: []
|
62
|
+
|
65
63
|
extensions: []
|
66
|
-
|
67
|
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
|
72
|
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
80
|
-
-
|
81
|
-
-
|
82
|
-
-
|
83
|
-
-
|
84
|
-
-
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
- lib/ci/reporter/
|
89
|
-
- lib/ci/reporter/
|
90
|
-
- lib/ci/reporter/
|
91
|
-
- lib/ci/reporter/
|
92
|
-
- lib/ci/reporter/
|
93
|
-
- lib/ci/reporter/
|
94
|
-
- lib/ci/reporter/
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
99
|
-
-
|
100
|
-
-
|
101
|
-
-
|
102
|
-
-
|
103
|
-
-
|
64
|
+
|
65
|
+
extra_rdoc_files:
|
66
|
+
- History.txt
|
67
|
+
- LICENSE.txt
|
68
|
+
- Manifest.txt
|
69
|
+
- README.rdoc
|
70
|
+
files:
|
71
|
+
- .travis.yml
|
72
|
+
- Gemfile
|
73
|
+
- Gemfile.lock
|
74
|
+
- History.txt
|
75
|
+
- LICENSE.txt
|
76
|
+
- Manifest.txt
|
77
|
+
- README.rdoc
|
78
|
+
- Rakefile
|
79
|
+
- acceptance/cucumber/cucumber_example.feature
|
80
|
+
- acceptance/cucumber/step_definitions/development_steps.rb
|
81
|
+
- acceptance/minitest_example_test.rb
|
82
|
+
- acceptance/rspec_example_spec.rb
|
83
|
+
- acceptance/test_unit_example_test.rb
|
84
|
+
- acceptance/verification_spec.rb
|
85
|
+
- ci_reporter.gemspec
|
86
|
+
- lib/ci/reporter/core.rb
|
87
|
+
- lib/ci/reporter/cucumber.rb
|
88
|
+
- lib/ci/reporter/minitest.rb
|
89
|
+
- lib/ci/reporter/rake/cucumber.rb
|
90
|
+
- lib/ci/reporter/rake/cucumber_loader.rb
|
91
|
+
- lib/ci/reporter/rake/minitest.rb
|
92
|
+
- lib/ci/reporter/rake/minitest_loader.rb
|
93
|
+
- lib/ci/reporter/rake/rspec.rb
|
94
|
+
- lib/ci/reporter/rake/rspec_loader.rb
|
95
|
+
- lib/ci/reporter/rake/test_unit.rb
|
96
|
+
- lib/ci/reporter/rake/test_unit_loader.rb
|
97
|
+
- lib/ci/reporter/rake/utils.rb
|
98
|
+
- lib/ci/reporter/report_manager.rb
|
99
|
+
- lib/ci/reporter/rspec.rb
|
100
|
+
- lib/ci/reporter/test_suite.rb
|
101
|
+
- lib/ci/reporter/test_unit.rb
|
102
|
+
- lib/ci/reporter/version.rb
|
103
|
+
- spec/ci/reporter/cucumber_spec.rb
|
104
|
+
- spec/ci/reporter/output_capture_spec.rb
|
105
|
+
- spec/ci/reporter/rake/rake_tasks_spec.rb
|
106
|
+
- spec/ci/reporter/report_manager_spec.rb
|
107
|
+
- spec/ci/reporter/rspec_spec.rb
|
108
|
+
- spec/ci/reporter/test_suite_spec.rb
|
109
|
+
- spec/ci/reporter/test_unit_spec.rb
|
110
|
+
- spec/spec_helper.rb
|
111
|
+
- stub.rake
|
112
|
+
- tasks/ci_reporter.rake
|
113
|
+
- .gemtest
|
104
114
|
homepage: http://caldersphere.rubyforge.org/ci_reporter
|
105
115
|
licenses: []
|
116
|
+
|
106
117
|
post_install_message:
|
107
|
-
rdoc_options:
|
108
|
-
- --main
|
109
|
-
- README.rdoc
|
110
|
-
- -SHN
|
111
|
-
- -f
|
112
|
-
- darkfish
|
113
|
-
require_paths:
|
114
|
-
- lib
|
115
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
rdoc_options:
|
119
|
+
- --main
|
120
|
+
- README.rdoc
|
121
|
+
- -SHN
|
122
|
+
- -f
|
123
|
+
- darkfish
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
127
|
none: false
|
117
|
-
requirements:
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 2
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
version: "0"
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
136
|
none: false
|
126
|
-
requirements:
|
127
|
-
|
128
|
-
|
129
|
-
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: "0"
|
130
141
|
requirements: []
|
142
|
+
|
131
143
|
rubyforge_project: caldersphere
|
132
|
-
rubygems_version: 1.8.
|
144
|
+
rubygems_version: 1.8.15
|
133
145
|
signing_key:
|
134
146
|
specification_version: 3
|
135
|
-
summary: CI::Reporter allows you to generate reams of XML for use with continuous
|
136
|
-
|
137
|
-
|
138
|
-
- spec/ci/reporter/
|
139
|
-
- spec/ci/reporter/
|
140
|
-
- spec/ci/reporter/
|
141
|
-
- spec/ci/reporter/
|
142
|
-
- spec/ci/reporter/
|
143
|
-
- spec/ci/reporter/
|
144
|
-
- spec/ci/reporter/test_unit_spec.rb
|
147
|
+
summary: CI::Reporter allows you to generate reams of XML for use with continuous integration systems.
|
148
|
+
test_files:
|
149
|
+
- spec/ci/reporter/cucumber_spec.rb
|
150
|
+
- spec/ci/reporter/output_capture_spec.rb
|
151
|
+
- spec/ci/reporter/report_manager_spec.rb
|
152
|
+
- spec/ci/reporter/rspec_spec.rb
|
153
|
+
- spec/ci/reporter/test_suite_spec.rb
|
154
|
+
- spec/ci/reporter/test_unit_spec.rb
|
155
|
+
- spec/ci/reporter/rake/rake_tasks_spec.rb
|