Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 104 lines (90 sloc) 4.098 kB
6da80dc @nicksieger Add start of acceptance tests
nicksieger authored
1 require 'rexml/document'
2
930f7d6 @nicksieger Add three acceptance tests for Test::Unit, and one TODO for RSpec
nicksieger authored
3 REPORTS_DIR = File.dirname(__FILE__) + '/reports'
4
6da80dc @nicksieger Add start of acceptance tests
nicksieger authored
5 describe "Test::Unit acceptance" do
6 it "should generate two XML files" do
930f7d6 @nicksieger Add three acceptance tests for Test::Unit, and one TODO for RSpec
nicksieger authored
7 File.exist?(File.join(REPORTS_DIR, 'TEST-TestUnitExampleTestOne.xml')).should == true
8 File.exist?(File.join(REPORTS_DIR, 'TEST-TestUnitExampleTestTwo.xml')).should == true
9 end
10
11 it "should have one error and one failure for TestUnitExampleTestOne" do
12 doc = File.open(File.join(REPORTS_DIR, 'TEST-TestUnitExampleTestOne.xml')) do |f|
13 REXML::Document.new(f)
14 end
15 doc.root.attributes["errors"].should == "1"
16 doc.root.attributes["failures"].should == "1"
17 doc.root.attributes["assertions"].should == "1"
18 doc.root.attributes["tests"].should == "1"
7e50b59 @nicksieger Finished acceptance tests
nicksieger authored
19 doc.root.elements.to_a("/testsuite/testcase").size.should == 1
6902ef5 @jorgenpt Add support for JUnit <skipped /> and <error />.
jorgenpt authored
20 doc.root.elements.to_a("/testsuite/testcase/error").size.should == 1
21 doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 1
a5d3b65 @nicksieger GH #1: Fix output in system-out/system-err
nicksieger authored
22 doc.root.elements.to_a("/testsuite/system-out").first.texts.inject("") do |c,e|
23 c << e.value; c
24 end.strip.should == "Some <![CDATA[on stdout]]>"
930f7d6 @nicksieger Add three acceptance tests for Test::Unit, and one TODO for RSpec
nicksieger authored
25 end
26
27 it "should have no errors or failures for TestUnitExampleTestTwo" do
28 doc = File.open(File.join(REPORTS_DIR, 'TEST-TestUnitExampleTestTwo.xml')) do |f|
29 REXML::Document.new(f)
30 end
31 doc.root.attributes["errors"].should == "0"
32 doc.root.attributes["failures"].should == "0"
33 doc.root.attributes["assertions"].should == "1"
34 doc.root.attributes["tests"].should == "1"
7e50b59 @nicksieger Finished acceptance tests
nicksieger authored
35 doc.root.elements.to_a("/testsuite/testcase").size.should == 1
36 doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 0
930f7d6 @nicksieger Add three acceptance tests for Test::Unit, and one TODO for RSpec
nicksieger authored
37 end
38 end
39
40 describe "RSpec acceptance" do
28d371d @nicksieger Tagging 1.5.1
nicksieger authored
41 it "should generate two XML files" do
7e50b59 @nicksieger Finished acceptance tests
nicksieger authored
42 File.exist?(File.join(REPORTS_DIR, 'SPEC-RSpec-example.xml')).should == true
28d371d @nicksieger Tagging 1.5.1
nicksieger authored
43 File.exist?(File.join(REPORTS_DIR, 'SPEC-RSpec-example-nested.xml')).should == true
7e50b59 @nicksieger Finished acceptance tests
nicksieger authored
44 end
45
46 it "should have two tests and one failure" do
47 doc = File.open(File.join(REPORTS_DIR, 'SPEC-RSpec-example.xml')) do |f|
48 REXML::Document.new(f)
49 end
50 doc.root.attributes["errors"].should == "0"
51 doc.root.attributes["failures"].should == "1"
28d371d @nicksieger Tagging 1.5.1
nicksieger authored
52 doc.root.attributes["tests"].should == "3"
53 doc.root.elements.to_a("/testsuite/testcase").size.should == 3
7e50b59 @nicksieger Finished acceptance tests
nicksieger authored
54 failures = doc.root.elements.to_a("/testsuite/testcase/failure")
55 failures.size.should == 1
423e7b5 @nicksieger The RSpec 2 upgrade. First pass, tests running under RSpec 1 and 2
nicksieger authored
56 failures.first.attributes["type"].should =~ /ExpectationNotMetError/
6da80dc @nicksieger Add start of acceptance tests
nicksieger authored
57 end
28d371d @nicksieger Tagging 1.5.1
nicksieger authored
58
59 it "should have one test in the nested example report" do
60 doc = File.open(File.join(REPORTS_DIR, 'SPEC-RSpec-example-nested.xml')) do |f|
61 REXML::Document.new(f)
62 end
63 doc.root.attributes["errors"].should == "0"
64 doc.root.attributes["failures"].should == "0"
65 doc.root.attributes["tests"].should == "1"
66 doc.root.elements.to_a("/testsuite/testcase").size.should == 1
67 end
7e50b59 @nicksieger Finished acceptance tests
nicksieger authored
68 end
ebfd936 @mathie Acceptance tests for cucumber integration.
mathie authored
69
70 describe "Cucumber acceptance" do
8df0657 @mathie Accept (and demonstrate) that Cucumber doesn't differentiate between …
mathie authored
71 it "should generate three XML files" do
fc3cef0 @nicksieger Get working with modern Cucumber, drop support for 0.3
nicksieger authored
72 File.exist?(File.join(REPORTS_DIR, 'FEATURES-Example-feature.xml')).should == true
8df0657 @mathie Accept (and demonstrate) that Cucumber doesn't differentiate between …
mathie authored
73
fc3cef0 @nicksieger Get working with modern Cucumber, drop support for 0.3
nicksieger authored
74 Dir["#{REPORTS_DIR}/FEATURES-*.xml"].length.should == 1
ebfd936 @mathie Acceptance tests for cucumber integration.
mathie authored
75 end
76
fc3cef0 @nicksieger Get working with modern Cucumber, drop support for 0.3
nicksieger authored
77 context "FEATURES report file" do
78 before :each do
79 @doc = File.open(File.join(REPORTS_DIR, 'FEATURES-Example-feature.xml')) do |f|
80 REXML::Document.new(f)
81 end
ebfd936 @mathie Acceptance tests for cucumber integration.
mathie authored
82 end
83
fc3cef0 @nicksieger Get working with modern Cucumber, drop support for 0.3
nicksieger authored
84 it "should have three tests and two failures" do
85 @doc.root.attributes["errors"].should == "0"
86 @doc.root.attributes["failures"].should == "2"
87 @doc.root.attributes["tests"].should == "3"
88 @doc.root.elements.to_a("/testsuite/testcase").size.should == 3
ebfd936 @mathie Acceptance tests for cucumber integration.
mathie authored
89 end
8df0657 @mathie Accept (and demonstrate) that Cucumber doesn't differentiate between …
mathie authored
90
fc3cef0 @nicksieger Get working with modern Cucumber, drop support for 0.3
nicksieger authored
91 it "should have one failure for the lazy hacker" do
92 failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Lazy hacker']/failure")
93 failures.size.should == 1
423e7b5 @nicksieger The RSpec 2 upgrade. First pass, tests running under RSpec 1 and 2
nicksieger authored
94 failures.first.attributes["type"].should =~ /ExpectationNotMetError/
8df0657 @mathie Accept (and demonstrate) that Cucumber doesn't differentiate between …
mathie authored
95 end
96
fc3cef0 @nicksieger Get working with modern Cucumber, drop support for 0.3
nicksieger authored
97 it "should have one failure for the bad coder" do
98 failures = @doc.root.elements.to_a("/testsuite/testcase[@name='Bad coder']/failure")
99 failures.size.should == 1
100 failures.first.attributes["type"].should == "RuntimeError"
101 end
8df0657 @mathie Accept (and demonstrate) that Cucumber doesn't differentiate between …
mathie authored
102 end
ebfd936 @mathie Acceptance tests for cucumber integration.
mathie authored
103 end
Something went wrong with that request. Please try again.