amfranz-ci_reporter 1.6.2

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.
@@ -0,0 +1,124 @@
1
+ == 1.6.2
2
+
3
+ - GH #1: Properly escape text in system-out and system-err tags (Matt Kanwisher)
4
+ - GH #2: Report rspec before(:all) failures (Edgars Beigarts)
5
+ - GH #3: Support for Omissions and Pending Tests from Test::Unit 2.0.x (Sam Hendley)
6
+
7
+ == 1.6.1
8
+
9
+ - Add 'skipped' flag for pending RSpec examples (Aaron Unger)
10
+
11
+ == 1.6.0
12
+
13
+ - Add support for Cucumber (tested against 0.3.0 - 0.3.2); (Graeme Mathieson)
14
+
15
+ == 1.5.3
16
+
17
+ - Compatibility with latest RSpec (1.2.4); (Paul Boone)
18
+
19
+ == 1.5.2
20
+
21
+ - Compatibility with latest RSpec (1.1.11 or so); use example
22
+ description method if available
23
+ - Remove dependency on rubygems when requiring builder (rescue
24
+ LoadError) (Jari Bakken)
25
+ - Source repository moved to github/git.caldersphere.net
26
+
27
+ == 1.5.1
28
+
29
+ - Fix silly load-path error that some had been seeing
30
+
31
+ == 1.5
32
+
33
+ - Support for RSpec 1.1.1 example groups (which broke ci_reporter 1.4)
34
+ - Change internal model to delegation instead of inheritance, allowing
35
+ ci_reporter to wrap different output formatters
36
+ - Add 'ci:setup:rspecdoc' task to output specdoc format instead of
37
+ progress
38
+ - Add support for pending examples; they will be listed in the report
39
+ XML as successful, but the name will have a '(PENDING)' tag appended
40
+ - Support for RSpec < 0.9 removed as promised; use 1.4 if you still
41
+ need to use an older version of RSpec
42
+
43
+ == 1.4
44
+
45
+ - Test::Unit tests that fail in multiple places (setup, test method,
46
+ and teardown) are now tracked (marcog)
47
+ - Explicit dependency requirement on Builder (>= 2.1.2)
48
+ - Use of RSpec < 0.9 is now deprecated; support will probably
49
+ disappear in the next version
50
+
51
+ == 1.3.5
52
+
53
+ - Change way we append to environment variables to appease windows
54
+ (Tracker #13998, Adam Anderson)
55
+
56
+ == 1.3.4
57
+
58
+ - Call #to_s on the object passed in as the test suite name;
59
+ compatibility fix for RSpec trunk which passes a
60
+ Spec::DSL::Description instead of a string
61
+ - Fix broken spec due to pending feature introduced in recent RSpec
62
+ - Fix compatibility for JRuby
63
+ - Add stub.rake file as another way to wrap existing Rakefile, with
64
+ note in README
65
+
66
+ == 1.3.3
67
+
68
+ - Use SPEC_OPTS instead of RSPECOPTS (Aslak Hellesøy)
69
+ - Add assertions attribute to individual test cases (Tracker #11563,
70
+ Andy Sipe)
71
+
72
+ == 1.3.2
73
+
74
+ - Fix bug trying to modify frozen environment strings
75
+ - Upgrade all specs to RSpec 1.0 style
76
+ - Add specs for rake tasks
77
+
78
+ == 1.3.1
79
+
80
+ - Fixed to be compatible with RSpec 1.0.x (added fourth parameter to
81
+ Formatter#dump_summary)
82
+
83
+ == 1.3
84
+
85
+ - Fixed to be compatible with RSpec 0.9
86
+ - Failure location text now contains both the exception message and
87
+ class name (in case the type and message attributes were truncated)
88
+
89
+ == 1.2.4
90
+
91
+ - Allow to report on RSpec specs when working with non-gem RSpec
92
+ - Note: CI::Reporter is only compatible with RSpec up to 0.8.2
93
+
94
+ == 1.2.3
95
+
96
+ - Append to TESTOPTS and RSPECOPTS environment variables (Bret
97
+ Pettichord) so that other apps can put values in them as well
98
+
99
+ == 1.2.2
100
+
101
+ - Responds to environment variable CI_CAPTURE: if set to "off",
102
+ stdout/stderr capture will be disabled.
103
+
104
+ == 1.2.1
105
+
106
+ - Add license and copyright information (finally)
107
+
108
+ == 1.2
109
+
110
+ - Capture standard output and standard error during each individual
111
+ test suite and include in the XML file in system-out and system-err
112
+ elements, respectively
113
+ (Tracker#9054[http://rubyforge.org/tracker/index.php?func=detail&aid=9054&group_id=2857&atid=11007])
114
+
115
+ == 1.1
116
+
117
+ - Add +assertions+ attribute to the +testsuite+ element that will
118
+ contain per-suite assertion counts when used with Test::Unit. Not
119
+ useful with applications that read Ant/JUnit XML, but custom
120
+ applications may wish to access it.
121
+
122
+ == 1.0
123
+
124
+ - Initial Release.
@@ -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.
@@ -0,0 +1,28 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ LICENSE.txt
5
+ Rakefile
6
+ stub.rake
7
+ lib/ci/reporter/rake/test_unit.rb
8
+ lib/ci/reporter/rake/rspec.rb
9
+ lib/ci/reporter/rake/rspec_loader.rb
10
+ lib/ci/reporter/rake/cucumber_loader.rb
11
+ lib/ci/reporter/rake/cucumber.rb
12
+ lib/ci/reporter/rake/test_unit_loader.rb
13
+ lib/ci/reporter/core.rb
14
+ lib/ci/reporter/test_suite.rb
15
+ lib/ci/reporter/test_unit.rb
16
+ lib/ci/reporter/rspec.rb
17
+ lib/ci/reporter/version.rb
18
+ lib/ci/reporter/cucumber.rb
19
+ lib/ci/reporter/report_manager.rb
20
+ spec/spec_helper.rb
21
+ spec/ci/reporter/rake/rake_tasks_spec.rb
22
+ spec/ci/reporter/rspec_spec.rb
23
+ spec/ci/reporter/test_unit_spec.rb
24
+ spec/ci/reporter/test_suite_spec.rb
25
+ spec/ci/reporter/output_capture_spec.rb
26
+ spec/ci/reporter/report_manager_spec.rb
27
+ spec/ci/reporter/cucumber_spec.rb
28
+ tasks/ci_reporter.rake
@@ -0,0 +1,70 @@
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.
2
+
3
+ == Dependencies
4
+
5
+ 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. CI::Reporter will raise an exception at runtime if it cannot locate Builder.
6
+
7
+ == Installation
8
+
9
+ CI::Reporter is available as a gem. To install the gem, use the usual gem command:
10
+
11
+ gem install ci_reporter
12
+
13
+ == Usage
14
+
15
+ 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 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.
16
+
17
+ 1. To use CI::Reporter, simply add the following lines to your Rakefile:
18
+
19
+ require 'rubygems'
20
+ gem 'ci_reporter'
21
+ require 'ci/reporter/rake/rspec' # use this if you're using RSpec
22
+ require 'ci/reporter/rake/cucumber' # use this if you're using Cucumber
23
+ require 'ci/reporter/rake/test_unit' # use this if you're using Test::Unit
24
+
25
+ 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.
26
+
27
+ rake ci:setup:testunit test
28
+
29
+ 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.
30
+
31
+ == Advanced Usage
32
+
33
+ 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:
34
+
35
+ rake -f GEM_PATH/stub.rake ci:setup:testunit test
36
+ rake -f GEM_PATH/stub.rake ci:setup:rspec spec
37
+ rake -f GEM_PATH/stub.rake ci:setup:cucumber features
38
+
39
+ 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:
40
+
41
+ 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.
42
+
43
+ 2. If you're using +RSpec+, you'll need to pass the following arguments to the +spec+ command:
44
+
45
+ --require GEM_PATH/lib/ci/reporter/rake/rspec_loader
46
+ --format CI::Reporter::RSpec
47
+
48
+ 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:
49
+
50
+ ruby -r GEM_PATH/lib/ci/reporter/rake/cucumber_loader -S cucumber --format CI::Reporter::Cucumber
51
+
52
+ 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.
53
+
54
+ == Environment Variables
55
+
56
+ * +CI_REPORTS+: if set, points to a directory where report files will be written.
57
+ * +CI_CAPTURE+: if set to value "off", stdout/stderr capture will be disabled.
58
+
59
+ == Source
60
+
61
+ You can get the CI::Reporter source using Git, in any of the following ways:
62
+
63
+ git clone git://git.caldersphere.net/ci_reporter.git
64
+ git clone git://github.com/nicksieger/ci_reporter.git
65
+
66
+ You can also download a tarball of the latest CI::Reporter source at http://github.com/nicksieger/ci_reporter/tree/master.
67
+
68
+ == License
69
+
70
+ 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>.
@@ -0,0 +1,89 @@
1
+ require 'spec/rake/spectask'
2
+ require 'spec/rake/verify_rcov'
3
+
4
+ MANIFEST = FileList["History.txt", "Manifest.txt", "README.txt", "LICENSE.txt", "Rakefile",
5
+ "*.rake", "lib/**/*.rb", "spec/**/*.rb", "tasks/**/*.rake"]
6
+
7
+ begin
8
+ File.open("Manifest.txt", "w") {|f| MANIFEST.each {|n| f << "#{n}\n"} }
9
+ require 'hoe'
10
+ require File.dirname(__FILE__) + '/lib/ci/reporter/version'
11
+ hoe = Hoe.spec("amfranz-ci_reporter") do |p|
12
+ p.version = CI::Reporter::VERSION
13
+ p.rubyforge_name = "caldersphere"
14
+ p.url = "http://caldersphere.rubyforge.org/ci_reporter"
15
+ p.author = "Nick Sieger"
16
+ p.email = "nick@nicksieger.com"
17
+ p.summary = "CI::Reporter allows you to generate reams of XML for use with continuous integration systems."
18
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
19
+ p.description = p.paragraphs_of('README.txt', 0...1).join("\n\n")
20
+ p.extra_deps.reject!{|d| d.first == "hoe"}
21
+ p.test_globs = ["spec/**/*_spec.rb"]
22
+ p.extra_deps << ['builder', ">= 2.1.2"]
23
+ end
24
+ hoe.spec.files = MANIFEST
25
+ hoe.spec.dependencies.delete_if { |dep| dep.name == "hoe" }
26
+ hoe.spec.rdoc_options += ["-SHN"]
27
+
28
+ task :gemspec do
29
+ File.open("#{hoe.name}.gemspec", "w") {|f| f << hoe.spec.to_ruby }
30
+ end
31
+ task :package => :gemspec
32
+ rescue LoadError
33
+ puts "You really need Hoe installed to be able to package this gem"
34
+ end
35
+
36
+ # Hoe insists on setting task :default => :test
37
+ # !@#$ no easy way to empty the default list of prerequisites
38
+ # Leave my tasks alone, Hoe
39
+ %w(default spec rcov).each do |task|
40
+ Rake::Task[task].prerequisites.clear
41
+ Rake::Task[task].actions.clear
42
+ end
43
+
44
+ # No RCov on JRuby at the moment
45
+ if RUBY_PLATFORM =~ /java/
46
+ task :default => :spec
47
+ else
48
+ task :default => :rcov
49
+ end
50
+
51
+ Spec::Rake::SpecTask.new do |t|
52
+ t.spec_opts = ["--diff", "unified"]
53
+ end
54
+
55
+ Spec::Rake::SpecTask.new("spec:rcov") do |t|
56
+ t.rcov_opts << '--exclude gems/*'
57
+ t.rcov = true
58
+ end
59
+ # so we don't confuse autotest
60
+ RCov::VerifyTask.new(:rcov) do |t|
61
+ # Can't get threshold up to 100 unless RSpec backwards compatibility
62
+ # code is dropped
63
+ t.threshold = 98
64
+ t.require_exact_threshold = false
65
+ end
66
+ task "spec:rcov" do
67
+ rm_f "Manifest.txt"
68
+ end
69
+ task :rcov => "spec:rcov"
70
+
71
+ task :generate_output do
72
+ rm_rf "acceptance/reports"
73
+ ENV['CI_REPORTS'] = "acceptance/reports"
74
+ begin
75
+ `ruby -Ilib acceptance/test_unit_example_test.rb` rescue nil
76
+ `ruby -Ilib -S spec --require ci/reporter/rake/rspec_loader --format CI::Reporter::RSpec acceptance/rspec_example_spec.rb` rescue nil
77
+ `ruby -Ilib -rci/reporter/rake/cucumber_loader -S cucumber --format CI::Reporter::Cucumber acceptance/cucumber` rescue nil
78
+ ensure
79
+ ENV.delete 'CI_REPORTS'
80
+ end
81
+ end
82
+ task :acceptance => :generate_output
83
+
84
+ Spec::Rake::SpecTask.new(:acceptance_spec) do |t|
85
+ t.spec_files = FileList['acceptance/verification_spec.rb']
86
+ end
87
+ task :acceptance => :acceptance_spec
88
+
89
+ task :default => :acceptance
@@ -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
+ require 'ci/reporter/test_suite'
6
+ require 'ci/reporter/report_manager'
@@ -0,0 +1,99 @@
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
+ tried_gem = false
7
+ begin
8
+ require 'cucumber'
9
+ require 'cucumber/ast/visitor'
10
+ rescue LoadError
11
+ unless tried_gem
12
+ tried_gem = true
13
+ require 'rubygems'
14
+ gem 'cucumber'
15
+ retry
16
+ end
17
+ end
18
+
19
+ module CI
20
+ module Reporter
21
+ class CucumberFailure
22
+ attr_reader :step
23
+
24
+ def initialize(step)
25
+ @step = step
26
+ end
27
+
28
+ def failure?
29
+ true
30
+ end
31
+
32
+ def error?
33
+ !failure?
34
+ end
35
+
36
+ def name
37
+ step.exception.class.name
38
+ end
39
+
40
+ def message
41
+ step.exception.message
42
+ end
43
+
44
+ def location
45
+ step.exception.backtrace.join("\n")
46
+ end
47
+ end
48
+
49
+ class Cucumber < ::Cucumber::Ast::Visitor
50
+
51
+ attr_accessor :test_suite, :report_manager, :feature_name
52
+
53
+ def initialize(step_mother, io, options)
54
+ self.report_manager = ReportManager.new("features")
55
+ super(step_mother)
56
+ end
57
+
58
+ def visit_feature_name(name)
59
+ self.feature_name = name.split("\n").first
60
+ super
61
+ end
62
+
63
+ def visit_feature_element(feature_element)
64
+ self.test_suite = TestSuite.new("#{feature_name} #{feature_element.instance_variable_get("@name")}")
65
+ test_suite.start
66
+
67
+ return_value = super
68
+
69
+ test_suite.finish
70
+ report_manager.write_report(test_suite)
71
+ self.test_suite = nil
72
+
73
+ return_value
74
+ end
75
+
76
+ def visit_step(step)
77
+ test_case = TestCase.new(step.name)
78
+ test_case.start
79
+
80
+ return_value = super
81
+
82
+ test_case.finish
83
+
84
+ case step.status
85
+ when :pending, :undefined
86
+ test_case.name = "#{test_case.name} (PENDING)"
87
+ when :skipped
88
+ test_case.name = "#{test_case.name} (SKIPPED)"
89
+ when :failed
90
+ test_case.failures << CucumberFailure.new(step)
91
+ end
92
+
93
+ test_suite.testcases << test_case
94
+
95
+ return_value
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,17 @@
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
+ namespace :ci do
6
+ namespace :setup do
7
+ task :cucumber_report_cleanup do
8
+ rm_rf ENV["CI_REPORTS"] || "features/reports"
9
+ end
10
+
11
+ task :cucumber => :cucumber_report_cleanup do
12
+ spec_opts = ["--require", "#{File.dirname(__FILE__)}/cucumber_loader.rb",
13
+ "--format", "CI::Reporter::Cucumber"].join(" ")
14
+ ENV["CUCUMBER_OPTS"] = "#{ENV['CUCUMBER_OPTS']} #{spec_opts}"
15
+ end
16
+ end
17
+ end