ci_reporter 1.0 → 1.6.5

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/History.txt CHANGED
@@ -1,3 +1,143 @@
1
+ == 1.6.5 (06/14/11)
2
+
3
+ - Works with RSpec up to 2.6.x
4
+ - GH #31: Better output formatting for RSpec 2 (Michael Giambalvo)
5
+ - Better ruby-test/TestUnit version support (amfranz)
6
+ - Prevent XML files from being overwritten (dpree)
7
+
8
+ == 1.6.4 (12/21/10)
9
+
10
+ - RSpec 2.2+ support (thanks emi)
11
+
12
+ == 1.6.3
13
+
14
+ - Thanks to yairgo and tylerkovacs for their assistance and prodding
15
+ for RSpec 2 support this release.
16
+ - GH #4: Updated for modern Cucumber (0.9.2 as of this writing)
17
+ - GH #6: Capture dynamically-named RSpec examples
18
+ - GH #7: RSpec 2.0.0 compatibility
19
+
20
+ == 1.6.2
21
+
22
+ - GH #1: Properly escape text in system-out and system-err tags (Matt Kanwisher)
23
+ - GH #2: Report rspec before(:all) failures (Edgars Beigarts)
24
+ - GH #3: Support for Omissions and Pending Tests from Test::Unit 2.0.x (Sam Hendley)
25
+
26
+ == 1.6.1
27
+
28
+ - Add 'skipped' flag for pending RSpec examples (Aaron Unger)
29
+
30
+ == 1.6.0
31
+
32
+ - Add support for Cucumber (tested against 0.3.0 - 0.3.2); (Graeme Mathieson)
33
+
34
+ == 1.5.3
35
+
36
+ - Compatibility with latest RSpec (1.2.4); (Paul Boone)
37
+
38
+ == 1.5.2
39
+
40
+ - Compatibility with latest RSpec (1.1.11 or so); use example
41
+ description method if available
42
+ - Remove dependency on rubygems when requiring builder (rescue
43
+ LoadError) (Jari Bakken)
44
+ - Source repository moved to github/git.caldersphere.net
45
+
46
+ == 1.5.1
47
+
48
+ - Fix silly load-path error that some had been seeing
49
+
50
+ == 1.5
51
+
52
+ - Support for RSpec 1.1.1 example groups (which broke ci_reporter 1.4)
53
+ - Change internal model to delegation instead of inheritance, allowing
54
+ ci_reporter to wrap different output formatters
55
+ - Add 'ci:setup:rspecdoc' task to output specdoc format instead of
56
+ progress
57
+ - Add support for pending examples; they will be listed in the report
58
+ XML as successful, but the name will have a '(PENDING)' tag appended
59
+ - Support for RSpec < 0.9 removed as promised; use 1.4 if you still
60
+ need to use an older version of RSpec
61
+
62
+ == 1.4
63
+
64
+ - Test::Unit tests that fail in multiple places (setup, test method,
65
+ and teardown) are now tracked (marcog)
66
+ - Explicit dependency requirement on Builder (>= 2.1.2)
67
+ - Use of RSpec < 0.9 is now deprecated; support will probably
68
+ disappear in the next version
69
+
70
+ == 1.3.5
71
+
72
+ - Change way we append to environment variables to appease windows
73
+ (Tracker #13998, Adam Anderson)
74
+
75
+ == 1.3.4
76
+
77
+ - Call #to_s on the object passed in as the test suite name;
78
+ compatibility fix for RSpec trunk which passes a
79
+ Spec::DSL::Description instead of a string
80
+ - Fix broken spec due to pending feature introduced in recent RSpec
81
+ - Fix compatibility for JRuby
82
+ - Add stub.rake file as another way to wrap existing Rakefile, with
83
+ note in README
84
+
85
+ == 1.3.3
86
+
87
+ - Use SPEC_OPTS instead of RSPECOPTS (Aslak Hellesøy)
88
+ - Add assertions attribute to individual test cases (Tracker #11563,
89
+ Andy Sipe)
90
+
91
+ == 1.3.2
92
+
93
+ - Fix bug trying to modify frozen environment strings
94
+ - Upgrade all specs to RSpec 1.0 style
95
+ - Add specs for rake tasks
96
+
97
+ == 1.3.1
98
+
99
+ - Fixed to be compatible with RSpec 1.0.x (added fourth parameter to
100
+ Formatter#dump_summary)
101
+
102
+ == 1.3
103
+
104
+ - Fixed to be compatible with RSpec 0.9
105
+ - Failure location text now contains both the exception message and
106
+ class name (in case the type and message attributes were truncated)
107
+
108
+ == 1.2.4
109
+
110
+ - Allow to report on RSpec specs when working with non-gem RSpec
111
+ - Note: CI::Reporter is only compatible with RSpec up to 0.8.2
112
+
113
+ == 1.2.3
114
+
115
+ - Append to TESTOPTS and RSPECOPTS environment variables (Bret
116
+ Pettichord) so that other apps can put values in them as well
117
+
118
+ == 1.2.2
119
+
120
+ - Responds to environment variable CI_CAPTURE: if set to "off",
121
+ stdout/stderr capture will be disabled.
122
+
123
+ == 1.2.1
124
+
125
+ - Add license and copyright information (finally)
126
+
127
+ == 1.2
128
+
129
+ - Capture standard output and standard error during each individual
130
+ test suite and include in the XML file in system-out and system-err
131
+ elements, respectively
132
+ (Tracker#9054[http://rubyforge.org/tracker/index.php?func=detail&aid=9054&group_id=2857&atid=11007])
133
+
134
+ == 1.1
135
+
136
+ - Add +assertions+ attribute to the +testsuite+ element that will
137
+ contain per-suite assertion counts when used with Test::Unit. Not
138
+ useful with applications that read Ant/JUnit XML, but custom
139
+ applications may wish to access it.
140
+
1
141
  == 1.0
2
142
 
3
- Initial Release.
143
+ - Initial Release.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person
4
+ # obtaining a copy of this software and associated documentation files
5
+ # (the "Software"), to deal in the Software without restriction,
6
+ # including without limitation the rights to use, copy, modify, merge,
7
+ # publish, distribute, sublicense, and/or sell copies of the Software,
8
+ # and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18
+ # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19
+ # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
data/Manifest.txt CHANGED
@@ -1,19 +1,29 @@
1
1
  History.txt
2
2
  Manifest.txt
3
3
  README.txt
4
+ LICENSE.txt
4
5
  Rakefile
6
+ stub.rake
5
7
  lib/ci/reporter/core.rb
8
+ lib/ci/reporter/cucumber.rb
6
9
  lib/ci/reporter/report_manager.rb
7
10
  lib/ci/reporter/rspec.rb
8
11
  lib/ci/reporter/test_suite.rb
9
12
  lib/ci/reporter/test_unit.rb
13
+ lib/ci/reporter/version.rb
14
+ lib/ci/reporter/rake/cucumber.rb
15
+ lib/ci/reporter/rake/cucumber_loader.rb
10
16
  lib/ci/reporter/rake/rspec.rb
11
17
  lib/ci/reporter/rake/rspec_loader.rb
12
18
  lib/ci/reporter/rake/test_unit.rb
13
19
  lib/ci/reporter/rake/test_unit_loader.rb
20
+ lib/ci/reporter/rake/utils.rb
14
21
  spec/spec_helper.rb
22
+ spec/ci/reporter/cucumber_spec.rb
23
+ spec/ci/reporter/output_capture_spec.rb
15
24
  spec/ci/reporter/report_manager_spec.rb
16
25
  spec/ci/reporter/rspec_spec.rb
17
26
  spec/ci/reporter/test_suite_spec.rb
18
27
  spec/ci/reporter/test_unit_spec.rb
28
+ spec/ci/reporter/rake/rake_tasks_spec.rb
19
29
  tasks/ci_reporter.rake
data/README.txt CHANGED
@@ -1,45 +1,65 @@
1
- CI::Reporter is an add-on to Test::Unit and RSpec that allows you to generate
2
- XML reports of your test and/or spec runs. The resulting files can be read by
3
- a continuous integration system that understands Ant's JUnit report XML
4
- format, thus allowing your CI system to track test/spec successes and
5
- failures.
6
-
7
- == Dependencies
8
-
9
- CI::Reporter has one required dependency on Builder, but since many will have a viable version of Builder via Rails' ActiveSupport gem, Builder is not a direct dependency of the project at the moment. Instead, ensure that you have either the +builder+ or +activesupport+ gem installed before continuing.
1
+ 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.
10
2
 
11
3
  == Installation
12
4
 
13
- CI::Reporter is available as a gem. To install the gem, use the usual gem command:
5
+ CI::Reporter is available as a gem. To install the gem, use the usual gem command:
14
6
 
15
7
  gem install ci_reporter
16
8
 
17
- To use CI::Reporter as a Rails plugin, first install the gem, and then install the plugin as follows:
18
-
19
- script/plugin install http://svn.caldersphere.net/svn/main/plugins/ci_reporter
20
-
21
9
  == Usage
22
10
 
23
- CI::Reporter works best with projects that use a +Rakefile+ along with the standard <code>Rake::TestTask</code> or <code>Spec::Rake::SpecTask</code> tasks for running tests or specs, 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.
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.
24
12
 
25
13
  1. To use CI::Reporter, simply add the following lines to your Rakefile:
26
14
 
27
15
  require 'rubygems'
28
- gem 'ci_reporter'
29
- require 'ci/reporter/rake/rspec' # use this if you're using RSpec
16
+ require 'ci/reporter/rake/rspec' # use this if you're using RSpec
17
+ require 'ci/reporter/rake/cucumber' # use this if you're using Cucumber
30
18
  require 'ci/reporter/rake/test_unit' # use this if you're using Test::Unit
31
19
 
32
- 2. Next, either modify your Rakefile to make the <code>ci:setup:rspec</code> or <code>ci:setup:testunit</code> task a dependency of your test tasks, or include them on the Rake command-line before the name of the task that runs the tests or specs.
20
+ 2. Next, either modify your Rakefile to make the <code>ci:setup:rspec</code>, <code>ci:setup:cucumber</code> or <code>ci:setup:testunit</code> task a dependency of your test tasks, or include them on the Rake command-line before the name of the task that runs the tests or specs.
33
21
 
34
22
  rake ci:setup:testunit test
35
23
 
24
+ 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.
25
+
36
26
  == Advanced Usage
37
27
 
38
- If for some reason you can't use the above technique to inject CI::Reporter, you'll have to do one of these:
28
+ 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:
29
+
30
+ rake -f GEM_PATH/stub.rake ci:setup:testunit test
31
+ rake -f GEM_PATH/stub.rake ci:setup:rspec spec
32
+ rake -f GEM_PATH/stub.rake ci:setup:cucumber features
33
+
34
+ If for some reason you can't use the above technique to inject CI::Reporter (e.g., you're not using Rake), you'll have to do one of these:
39
35
 
40
36
  1. If you're using <code>Test::Unit</code>, ensure the <code>ci/reporter/rake/test_unit_loader.rb</code> file is loaded or required at some point before the tests are run.
37
+
41
38
  2. If you're using +RSpec+, you'll need to pass the following arguments to the +spec+ command:
39
+
42
40
  --require GEM_PATH/lib/ci/reporter/rake/rspec_loader
43
41
  --format CI::Reporter::RSpec
44
42
 
45
- There's a bit of a chicken and egg problem because rubygems needs to be loaded before you can require any CI::Reporter files. If you cringe hard-coding a full path to a specific version of the gem, you can also copy the +rspec_loader+ file into your project and require it directly -- the contents are version-agnostic and are not likely to change in future releases.
43
+ 3. If you're using Cucumber, you'll need to cheat slightly so that Cucumber's step definition autoloading will still work. Instead of calling the +cucumber+ script directly, run:
44
+
45
+ ruby -r GEM_PATH/lib/ci/reporter/rake/cucumber_loader -S cucumber --format CI::Reporter::Cucumber
46
+
47
+ There's a bit of a chicken and egg problem because rubygems needs to be loaded before you can require any CI::Reporter files. If you cringe hard-coding a full path to a specific version of the gem, you can also copy the +cucumber_loader+ file into your project and require it directly -- the contents are version-agnostic and are not likely to change in future releases.
48
+
49
+ == Environment Variables
50
+
51
+ * +CI_REPORTS+: if set, points to a directory where report files will be written.
52
+ * +CI_CAPTURE+: if set to value "off", stdout/stderr capture will be disabled.
53
+
54
+ == Source
55
+
56
+ You can get the CI::Reporter source using Git, in any of the following ways:
57
+
58
+ git clone git://git.caldersphere.net/ci_reporter.git
59
+ git clone git://github.com/nicksieger/ci_reporter.git
60
+
61
+ You can also download a tarball of the latest CI::Reporter source at http://github.com/nicksieger/ci_reporter/.
62
+
63
+ == License
64
+
65
+ This software is released under an MIT license. For details, see the LICENSE.txt file included with the distribution. The software is copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>.
data/Rakefile CHANGED
@@ -1,34 +1,102 @@
1
- require 'spec/rake/spectask'
2
- require 'hoe'
3
-
4
- MANIFEST = FileList["History.txt", "Manifest.txt", "README.txt", "Rakefile",
5
- "lib/**/*.rb", "spec/**/*.rb", "tasks/**/*.rake"]
6
-
7
- Hoe.new("ci_reporter", "1.0") do |p|
8
- p.rubyforge_name = "caldersphere"
9
- p.url = "http://caldersphere.rubyforge.org/ci_reporter"
10
- p.author = "Nick Sieger"
11
- p.email = "nick@nicksieger.com"
12
- p.summary = "CI::Reporter allows you to generate reams of XML for use with continuous integration systems."
13
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
14
- p.description = p.paragraphs_of('README.txt', 0...1).join("\n\n")
15
- p.extra_deps.reject!{|d| d.first == "hoe"}
16
- p.test_globs = ["spec/**/*_spec.rb"]
17
- end.spec.files = MANIFEST
1
+ MANIFEST = FileList["History.txt", "Manifest.txt", "README.txt", "LICENSE.txt", "Rakefile",
2
+ "*.rake", "lib/**/*.rb", "spec/**/*.rb", "tasks/**/*.rake"]
3
+
4
+ begin
5
+ File.open("Manifest.txt", "w") {|f| MANIFEST.each {|n| f << "#{n}\n"} }
6
+ require 'hoe'
7
+ Hoe.plugin :rubyforge
8
+ require File.dirname(__FILE__) + '/lib/ci/reporter/version'
9
+ hoe = Hoe.spec("ci_reporter") do |p|
10
+ p.version = CI::Reporter::VERSION
11
+ p.rubyforge_name = "caldersphere"
12
+ p.url = "http://caldersphere.rubyforge.org/ci_reporter"
13
+ p.author = "Nick Sieger"
14
+ p.email = "nick@nicksieger.com"
15
+ p.summary = "CI::Reporter allows you to generate reams of XML for use with continuous integration systems."
16
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
17
+ p.description = p.paragraphs_of('README.txt', 0...1).join("\n\n")
18
+ p.extra_deps.reject!{|d| d.first == "hoe"}
19
+ p.test_globs = ["spec/**/*_spec.rb"]
20
+ p.extra_deps << ['builder', ">= 2.1.2"]
21
+ end
22
+ hoe.spec.files = MANIFEST
23
+ hoe.spec.rdoc_options += ["-SHN", "-f", "darkfish"]
24
+
25
+ task :gemspec do
26
+ File.open("#{hoe.name}.gemspec", "w") {|f| f << hoe.spec.to_ruby }
27
+ end
28
+ task :package => :gemspec
29
+ rescue LoadError
30
+ puts "You really need Hoe installed to be able to package this gem"
31
+ end
18
32
 
19
33
  # Hoe insists on setting task :default => :test
20
34
  # !@#$ no easy way to empty the default list of prerequisites
21
- Rake::Task['default'].send :instance_variable_set, "@prerequisites", FileList[]
35
+ # Leave my tasks alone, Hoe
36
+ %w(default spec rcov).each do |task|
37
+ next unless Rake::Task.task_defined?(task)
38
+ Rake::Task[task].prerequisites.clear
39
+ Rake::Task[task].actions.clear
40
+ end
22
41
 
23
- task :default => :spec
42
+ # No RCov on JRuby at the moment
43
+ if RUBY_PLATFORM =~ /java/
44
+ task :default => :spec
45
+ else
46
+ task :default => :rcov
47
+ end
24
48
 
25
- Spec::Rake::SpecTask.new do |t|
26
- t.spec_opts = ["--diff", "unified"]
49
+ RSpecTask = begin
50
+ require 'rspec/core/rake_task'
51
+ @spec_bin = 'rspec'
52
+ RSpec::Core::RakeTask
53
+ rescue LoadError
54
+ require 'spec/rake/spectask'
55
+ @spec_bin = 'spec'
56
+ Spec::Rake::SpecTask
27
57
  end
28
58
 
29
- # Automated manifest
30
- task :manifest do
31
- File.open("Manifest.txt", "w") {|f| MANIFEST.each {|n| f << "#{n}\n"} }
59
+ RSpecTask.new do |t|
60
+ end
61
+
62
+ RSpecTask.new("spec:rcov") do |t|
63
+ t.rcov_opts = ['--exclude gems/*']
64
+ t.rcov = true
65
+ end
66
+
67
+ begin
68
+ require 'spec/rake/verify_rcov'
69
+ # so we don't confuse autotest
70
+ RCov::VerifyTask.new(:rcov) do |t|
71
+ # Can't get threshold up to 100 unless RSpec backwards compatibility
72
+ # code is dropped
73
+ t.threshold = 95
74
+ t.require_exact_threshold = false
75
+ end
76
+ rescue LoadError
77
+ end
78
+
79
+ task "spec:rcov" do
80
+ rm_f "Manifest.txt"
81
+ end
82
+ task :rcov => "spec:rcov"
83
+
84
+ task :generate_output do
85
+ rm_rf "acceptance/reports"
86
+ ENV['CI_REPORTS'] = "acceptance/reports"
87
+ begin
88
+ `ruby -Ilib -rubygems -rci/reporter/rake/test_unit_loader acceptance/test_unit_example_test.rb` rescue puts "Warning: #{$!}"
89
+ `ruby -Ilib -rubygems -S #{@spec_bin} --require ci/reporter/rake/rspec_loader --format CI::Reporter::RSpec acceptance/rspec_example_spec.rb` rescue puts "Warning: #{$!}"
90
+ `ruby -Ilib -rubygems -rci/reporter/rake/cucumber_loader -S cucumber --format CI::Reporter::Cucumber acceptance/cucumber` rescue puts "Warning: #{$!}"
91
+ ensure
92
+ ENV.delete 'CI_REPORTS'
93
+ end
94
+ end
95
+ task :acceptance => :generate_output
96
+
97
+ RSpecTask.new(:acceptance_spec) do |t|
98
+ t.pattern = FileList['acceptance/verification_spec.rb']
32
99
  end
100
+ task :acceptance => :acceptance_spec
33
101
 
34
- task :package => :manifest
102
+ task :default => :acceptance
@@ -1,2 +1,6 @@
1
+ # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
1
5
  require 'ci/reporter/test_suite'
2
- require 'ci/reporter/report_manager'
6
+ require 'ci/reporter/report_manager'
@@ -0,0 +1,125 @@
1
+ # Copyright (c) 2006-2010 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
+ @test_case.failures << CucumberFailure.new(table_row) if table_row.failed?
120
+ test_suite.testcases << @test_case
121
+ @test_case = nil
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,19 @@
1
+ # Copyright (c) 2006-2010 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
+ cuke_opts = ["--require", CI::Reporter.maybe_quote_filename("#{File.dirname(__FILE__)}/cucumber_loader.rb"),
15
+ "--format", "CI::Reporter::Cucumber"].join(" ")
16
+ ENV["CUCUMBER_OPTS"] = "#{ENV['CUCUMBER_OPTS']} #{cuke_opts}"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,6 @@
1
+ # Copyright (c) 2006-2010 Nick Sieger <nicksieger@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/cucumber'
@@ -1,9 +1,25 @@
1
+ # Copyright (c) 2006-2010 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
+
1
7
  namespace :ci do
2
8
  namespace :setup do
3
- task :rspec do
9
+ task :spec_report_cleanup do
4
10
  rm_rf ENV["CI_REPORTS"] || "spec/reports"
5
- ENV["RSPECOPTS"] = ["--require", "#{File.dirname(__FILE__)}/rspec_loader.rb",
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"),
6
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}"
7
23
  end
8
24
  end
9
25
  end
@@ -1,7 +1,6 @@
1
- require 'rubygems'
2
- begin
3
- gem 'ci_reporter'
4
- rescue => e
5
- $: << File.dirname(__FILE__) + "/../../../lib"
6
- end
7
- require 'ci/reporter/rspec'
1
+ # Copyright (c) 2006-2010 Nick Sieger <nicksieger@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/rspec'
@@ -1,8 +1,15 @@
1
+ # Copyright (c) 2006-2010 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
+
1
7
  namespace :ci do
2
8
  namespace :setup do
3
9
  task :testunit do
4
10
  rm_rf ENV["CI_REPORTS"] || "test/reports"
5
- ENV["TESTOPTS"] = "#{File.dirname(__FILE__)}/test_unit_loader.rb"
11
+ test_loader = CI::Reporter.maybe_quote_filename "#{File.dirname(__FILE__)}/test_unit_loader.rb"
12
+ ENV["TESTOPTS"] = "#{ENV["TESTOPTS"]} #{test_loader}"
6
13
  end
7
14
  end
8
15
  end
@@ -1,11 +1,11 @@
1
- require 'rubygems'
2
- begin
3
- gem 'ci_reporter'
4
- rescue
5
- $: << File.dirname(__FILE__) + "/../../../lib"
6
- end
1
+ # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ $: << File.dirname(__FILE__) + "/../../.."
7
6
  require 'ci/reporter/test_unit'
8
7
 
8
+ # Intercepts mediator creation in ruby-test < 2.1
9
9
  module Test #:nodoc:all
10
10
  module Unit
11
11
  module UI
@@ -19,4 +19,18 @@ module Test #:nodoc:all
19
19
  end
20
20
  end
21
21
  end
22
- end
22
+ end
23
+
24
+ # Intercepts mediator creation in ruby-test >= 2.1
25
+ module Test #:nodoc:all
26
+ module Unit
27
+ module UI
28
+ class TestRunner
29
+ def setup_mediator
30
+ # swap in our custom mediator
31
+ @mediator = CI::Reporter::TestUnit.new(@suite)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end