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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +22 -0
  3. data/.travis.yml +2 -6
  4. data/Gemfile +0 -9
  5. data/History.txt +0 -4
  6. data/LICENSE.txt +23 -21
  7. data/README.md +90 -0
  8. data/Rakefile +5 -99
  9. data/ci_reporter.gemspec +23 -52
  10. data/gemfiles/.gitignore +1 -0
  11. data/lib/ci/reporter/core.rb +0 -4
  12. data/lib/ci/reporter/internal.rb +31 -0
  13. data/lib/ci/reporter/rake/utils.rb +0 -4
  14. data/lib/ci/reporter/report_manager.rb +7 -11
  15. data/lib/ci/reporter/test_suite.rb +1 -9
  16. data/lib/ci/reporter/version.rb +1 -7
  17. data/spec/ci/reporter/output_capture_spec.rb +3 -7
  18. data/spec/ci/reporter/report_manager_spec.rb +6 -10
  19. data/spec/ci/reporter/test_suite_spec.rb +0 -4
  20. data/spec/spec_helper.rb +0 -7
  21. metadata +29 -138
  22. data/.gemtest +0 -0
  23. data/.hoerc +0 -2
  24. data/.travis.before_install.sh +0 -13
  25. data/Manifest.txt +0 -50
  26. data/README.rdoc +0 -111
  27. data/acceptance/cucumber/cucumber_example.feature +0 -19
  28. data/acceptance/cucumber/step_definitions/development_steps.rb +0 -40
  29. data/acceptance/minitest_example_test.rb +0 -17
  30. data/acceptance/rspec_example_spec.rb +0 -24
  31. data/acceptance/spinach/features/spinach_example.feature +0 -24
  32. data/acceptance/spinach/features/steps/example_spinach_feature.rb +0 -34
  33. data/acceptance/test_unit_example_test.rb +0 -23
  34. data/acceptance/verification_spec.rb +0 -185
  35. data/lib/ci/reporter/cucumber.rb +0 -127
  36. data/lib/ci/reporter/minitest.rb +0 -226
  37. data/lib/ci/reporter/rake/cucumber.rb +0 -17
  38. data/lib/ci/reporter/rake/cucumber_loader.rb +0 -6
  39. data/lib/ci/reporter/rake/minitest.rb +0 -15
  40. data/lib/ci/reporter/rake/minitest_loader.rb +0 -9
  41. data/lib/ci/reporter/rake/rspec.rb +0 -31
  42. data/lib/ci/reporter/rake/rspec_loader.rb +0 -6
  43. data/lib/ci/reporter/rake/spinach.rb +0 -19
  44. data/lib/ci/reporter/rake/spinach_loader.rb +0 -5
  45. data/lib/ci/reporter/rake/test_unit.rb +0 -15
  46. data/lib/ci/reporter/rake/test_unit_loader.rb +0 -38
  47. data/lib/ci/reporter/rspec.rb +0 -220
  48. data/lib/ci/reporter/spinach.rb +0 -80
  49. data/lib/ci/reporter/test_unit.rb +0 -163
  50. data/spec/ci/reporter/cucumber_spec.rb +0 -230
  51. data/spec/ci/reporter/rake/rake_tasks_spec.rb +0 -110
  52. data/spec/ci/reporter/rspec_spec.rb +0 -156
  53. data/spec/ci/reporter/test_unit_spec.rb +0 -152
  54. data/stub.rake +0 -16
  55. data/tasks/ci_reporter.rake +0 -20
data/.gemtest DELETED
File without changes
data/.hoerc DELETED
@@ -1,2 +0,0 @@
1
- ---
2
- exclude: !ruby/regexp /tmp$|CVS|TAGS|\.(svn|git|DS_Store)|Gemfile.lock/
@@ -1,13 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -x
4
-
5
- # Link to pre-built racc for JRuby
6
- [ "$TRAVIS_RUBY_VERSION" != "jruby" ] && exit 0
7
- rvm 1.9.3 do gem install racc
8
- GEMDIR=$(rvm 1.9.3 do gem env gemdir)
9
- JRUBY_GEMDIR=$(rvm jruby do gem env gemdir)
10
-
11
- rm -f $JRUBY_GEMDIR/{gems,specifications}/racc*
12
- ln -s $GEMDIR/gems/racc-* $JRUBY_GEMDIR/gems/
13
- ln -s $GEMDIR/specifications/racc-* $JRUBY_GEMDIR/specifications/
@@ -1,50 +0,0 @@
1
- .gemtest
2
- .hoerc
3
- .rspec
4
- .travis.before_install.sh
5
- .travis.yml
6
- Gemfile
7
- History.txt
8
- LICENSE.txt
9
- Manifest.txt
10
- README.rdoc
11
- Rakefile
12
- acceptance/cucumber/cucumber_example.feature
13
- acceptance/cucumber/step_definitions/development_steps.rb
14
- acceptance/minitest_example_test.rb
15
- acceptance/rspec_example_spec.rb
16
- acceptance/spinach/features/spinach_example.feature
17
- acceptance/spinach/features/steps/example_spinach_feature.rb
18
- acceptance/test_unit_example_test.rb
19
- acceptance/verification_spec.rb
20
- ci_reporter.gemspec
21
- lib/ci/reporter/core.rb
22
- lib/ci/reporter/cucumber.rb
23
- lib/ci/reporter/minitest.rb
24
- lib/ci/reporter/rake/cucumber.rb
25
- lib/ci/reporter/rake/cucumber_loader.rb
26
- lib/ci/reporter/rake/minitest.rb
27
- lib/ci/reporter/rake/minitest_loader.rb
28
- lib/ci/reporter/rake/rspec.rb
29
- lib/ci/reporter/rake/rspec_loader.rb
30
- lib/ci/reporter/rake/spinach.rb
31
- lib/ci/reporter/rake/spinach_loader.rb
32
- lib/ci/reporter/rake/test_unit.rb
33
- lib/ci/reporter/rake/test_unit_loader.rb
34
- lib/ci/reporter/rake/utils.rb
35
- lib/ci/reporter/report_manager.rb
36
- lib/ci/reporter/rspec.rb
37
- lib/ci/reporter/spinach.rb
38
- lib/ci/reporter/test_suite.rb
39
- lib/ci/reporter/test_unit.rb
40
- lib/ci/reporter/version.rb
41
- spec/ci/reporter/cucumber_spec.rb
42
- spec/ci/reporter/output_capture_spec.rb
43
- spec/ci/reporter/rake/rake_tasks_spec.rb
44
- spec/ci/reporter/report_manager_spec.rb
45
- spec/ci/reporter/rspec_spec.rb
46
- spec/ci/reporter/test_suite_spec.rb
47
- spec/ci/reporter/test_unit_spec.rb
48
- spec/spec_helper.rb
49
- stub.rake
50
- tasks/ci_reporter.rake
@@ -1,111 +0,0 @@
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
- == Installation
4
-
5
- CI::Reporter is available as a gem. To install the gem, use the usual gem command:
6
-
7
- gem install ci_reporter
8
-
9
- == Usage
10
-
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 skip to next section.
12
-
13
- 1. To use CI::Reporter, simply add one of the following lines to your Rakefile:
14
-
15
- require 'ci/reporter/rake/rspec' # use this if you're using RSpec
16
- require 'ci/reporter/rake/cucumber' # use this if you're using Cucumber
17
- require 'ci/reporter/rake/spinach' # use this if you're using Spinach
18
- require 'ci/reporter/rake/test_unit' # use this if you're using Test::Unit
19
- require 'ci/reporter/rake/minitest' # use this if you're using Ruby 1.9 or minitest
20
-
21
- Note: If you use both cucumber and spinach, you are likely to see strange errors, due to
22
- `gherkin` and `gherkin-ruby` both being loaded. So, you should choose only one of
23
- cucumber and spinach.
24
-
25
- 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:
26
-
27
- rake ci:setup:testunit test
28
- rake ci:setup:minitest test
29
- rake ci:setup:rspec spec
30
- rake ci:setup:cucumber features
31
- rake ci:setup:spinach features
32
-
33
- === Rails
34
-
35
- If you use rails-rspec gem all you need to do is to create new rake task lib/tasks/ci_reporter.rake:
36
-
37
- if ENV['GENERATE_REPORTS'] == 'true'
38
- require 'ci/reporter/rake/rspec'
39
- task :spec => 'ci:setup:rspec'
40
- end
41
-
42
- And then you can either inject this variable in your CI or simply call rspec passing this as one of the parameters:
43
-
44
- rspec ... GENERATE_REPORTS=true
45
-
46
- === RSpec Formatters
47
-
48
- CI::Reporter has seperate Rake tasks for each builtin RSpec formatter. Depending upon which formatter you would like, call the following corresponding task.
49
-
50
- Progress (default) :: ci:setup:rspec
51
- Base :: ci:setup:rspecbase
52
- Documentation :: ci:setup:rspecdoc
53
-
54
-
55
- == Jenkins setup
56
-
57
- 1. Tick the box labelled "Publish JUnit test result report" in the job configuration
58
-
59
- 2. Enter "test/reports/*.xml,spec/reports/*.xml" in the "Test report XMLs" field (adjust this to suit which tests you are running)
60
-
61
- 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.
62
-
63
-
64
- == Advanced Usage
65
-
66
- 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:
67
-
68
- rake -f GEM_PATH/stub.rake ci:setup:testunit test
69
- rake -f GEM_PATH/stub.rake ci:setup:minitest test
70
- rake -f GEM_PATH/stub.rake ci:setup:rspec spec
71
- rake -f GEM_PATH/stub.rake ci:setup:cucumber features
72
- rake -f GEM_PATH/stub.rake ci:setup:spinach features
73
-
74
- 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:
75
-
76
- 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.
77
-
78
- 2. If you're using +RSpec+, you'll need to pass the following arguments to the +spec+ command:
79
-
80
- --require GEM_PATH/lib/ci/reporter/rake/rspec_loader
81
- --format CI::Reporter::RSpec
82
-
83
- 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:
84
-
85
- ruby -r GEM_PATH/lib/ci/reporter/rake/cucumber_loader -S cucumber --format CI::Reporter::Cucumber
86
-
87
- 4. If you're using Spinach, you'll want to do this:
88
-
89
- ruby -r GEM_PATH/lib/ci/reporter/rake/spinach_loader -S spinach
90
-
91
- 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.
92
-
93
- == Environment Variables
94
-
95
- * +CI_REPORTS+: if set, points to a directory where report files will be written.
96
- * +CI_CAPTURE+: if set to value "off", stdout/stderr capture will be disabled.
97
-
98
- == Travis Build Status {<img src="https://secure.travis-ci.org/nicksieger/ci_reporter.png"/>}[http://travis-ci.org/#!/nicksieger/ci_reporter]
99
-
100
- == Source
101
-
102
- You can get the CI::Reporter source using Git, in any of the following ways:
103
-
104
- git clone git://git.caldersphere.net/ci_reporter.git
105
- git clone git://github.com/nicksieger/ci_reporter.git
106
-
107
- You can also download a tarball of the latest CI::Reporter source at http://github.com/nicksieger/ci_reporter/.
108
-
109
- == License
110
-
111
- 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>.
@@ -1,19 +0,0 @@
1
- Feature: Example Cucumber 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
@@ -1,40 +0,0 @@
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
@@ -1,17 +0,0 @@
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
@@ -1,24 +0,0 @@
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
@@ -1,24 +0,0 @@
1
- Feature: Example Spinach 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
20
-
21
- Scenario: Missing steps
22
- Given that I am a lazy hacker
23
- And I don't implement steps before I commit
24
- Then I should be fired
@@ -1,34 +0,0 @@
1
- require 'rspec'
2
-
3
- class Spinach::Features::ExampleSpinachFeature < Spinach::FeatureSteps
4
- include RSpec::Matchers
5
-
6
- step 'that I am a conscientious developer' do
7
- end
8
-
9
- step 'I write cucumber features' do
10
- end
11
-
12
- step 'I should see a green bar' do
13
- end
14
-
15
- step 'that I am a lazy hacker' do
16
- end
17
-
18
- step 'I don\'t bother writing cucumber features' do
19
- false.should be_true
20
- end
21
-
22
- step 'I should be fired' do
23
- end
24
-
25
- step 'that I can\'t code for peanuts' do
26
- end
27
-
28
- step 'I write step definitions that throw exceptions' do
29
- raise RuntimeError, "User error!"
30
- end
31
-
32
- step 'I shouldn\'t be allowed out in public' do
33
- end
34
- end
@@ -1,23 +0,0 @@
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
@@ -1,185 +0,0 @@
1
- #--
2
- # Copyright (c) 2006-2013 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 one XML file" do
113
- File.exist?(File.join(REPORTS_DIR, 'FEATURES-Example-Cucumber-feature.xml')).should == true
114
-
115
- Dir["#{REPORTS_DIR}/FEATURES-*Cucumber*.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-Cucumber-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
145
-
146
- describe "Spinach acceptance" do
147
- it "should generate one XML file" do
148
- File.exist?(File.join(REPORTS_DIR, 'FEATURES-Example-Spinach-feature.xml')).should == true
149
-
150
- Dir["#{REPORTS_DIR}/FEATURES-*Spinach*.xml"].length.should == 1
151
- end
152
-
153
- context "SPINACH report file" do
154
- before :each do
155
- @doc = File.open(File.join(REPORTS_DIR, 'FEATURES-Example-Spinach-feature.xml')) do |f|
156
- REXML::Document.new(f)
157
- end
158
- end
159
-
160
- it "should have three tests and two failures" do
161
- @doc.root.attributes["errors"].should == "2"
162
- @doc.root.attributes["failures"].should == "1"
163
- @doc.root.attributes["tests"].should == "4"
164
- @doc.root.elements.to_a("/testsuite/testcase").size.should == 4
165
- end
166
-
167
- it "should have one failure for the lazy hacker" do
168
- failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Lazy hacker']/failure")
169
- failures.size.should == 1
170
- failures.first.attributes["type"].should =~ /ExpectationNotMetError/
171
- end
172
-
173
- it "should have one failure for missing steps" do
174
- failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Missing steps']/failure")
175
- failures.size.should == 1
176
- failures.first.attributes["type"].should =~ /StepNotDefinedException/
177
- end
178
-
179
- it "should have one failure for the bad coder" do
180
- failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Bad coder']/failure")
181
- failures.size.should == 1
182
- failures.first.attributes["type"].should == "RuntimeError"
183
- end
184
- end
185
- end