GICodeWarrior-ci_reporter 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ module CI
2
+ module Reporter
3
+ VERSION = "1.5.3"
4
+ end
5
+ end
@@ -0,0 +1,57 @@
1
+ # (c) Copyright 2006-2007 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
6
+ require 'rexml/document'
7
+
8
+ describe "Output capture" do
9
+ before(:each) do
10
+ @suite = CI::Reporter::TestSuite.new "test"
11
+ end
12
+
13
+ it "should save stdout and stderr messages written during the test run" do
14
+ @suite.start
15
+ puts "Hello"
16
+ $stderr.print "Hi"
17
+ @suite.finish
18
+ @suite.stdout.should == "Hello\n"
19
+ @suite.stderr.should == "Hi"
20
+ end
21
+
22
+ it "should include system-out and system-err elements in the xml output" do
23
+ @suite.start
24
+ puts "Hello"
25
+ $stderr.print "Hi"
26
+ @suite.finish
27
+
28
+ root = REXML::Document.new(@suite.to_xml).root
29
+ root.elements.to_a('//system-out').length.should == 1
30
+ root.elements.to_a('//system-err').length.should == 1
31
+ root.elements.to_a('//system-out').first.cdatas.first.to_s.should == "Hello\n"
32
+ root.elements.to_a('//system-err').first.cdatas.first.to_s.should == "Hi"
33
+ end
34
+
35
+ it "should return $stdout and $stderr to original value after finish" do
36
+ out, err = $stdout, $stderr
37
+ @suite.start
38
+ $stdout.object_id.should_not == out.object_id
39
+ $stderr.object_id.should_not == err.object_id
40
+ @suite.finish
41
+ $stdout.object_id.should == out.object_id
42
+ $stderr.object_id.should == err.object_id
43
+ end
44
+
45
+ it "should capture only during run of owner test suite" do
46
+ $stdout.print "A"
47
+ $stderr.print "A"
48
+ @suite.start
49
+ $stdout.print "B"
50
+ $stderr.print "B"
51
+ @suite.finish
52
+ $stdout.print "C"
53
+ $stderr.print "C"
54
+ @suite.stdout.should == "B"
55
+ @suite.stderr.should == "B"
56
+ end
57
+ end
@@ -0,0 +1,73 @@
1
+ # (c) Copyright 2006-2007 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ require File.dirname(__FILE__) + "/../../../spec_helper.rb"
6
+ require 'rake'
7
+
8
+ def save_env(v)
9
+ ENV["PREV_#{v}"] = ENV[v]
10
+ end
11
+ def restore_env(v)
12
+ ENV[v] = ENV["PREV_#{v}"]
13
+ ENV.delete("PREV_#{v}")
14
+ end
15
+
16
+ describe "ci_reporter ci:setup:testunit task" do
17
+ before(:each) do
18
+ @rake = Rake::Application.new
19
+ Rake.application = @rake
20
+ load CI_REPORTER_LIB + '/ci/reporter/rake/test_unit.rb'
21
+ save_env "CI_REPORTS"
22
+ save_env "TESTOPTS"
23
+ ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf"
24
+ end
25
+ after(:each) do
26
+ restore_env "TESTOPTS"
27
+ restore_env "CI_REPORTS"
28
+ Rake.application = nil
29
+ end
30
+
31
+ it "should set ENV['TESTOPTS'] to include test/unit setup file" do
32
+ @rake["ci:setup:testunit"].invoke
33
+ ENV["TESTOPTS"].should =~ /test_unit_loader/
34
+ end
35
+
36
+ it "should append to ENV['TESTOPTS'] if it already contains a value" do
37
+ ENV["TESTOPTS"] = "somevalue".freeze
38
+ @rake["ci:setup:testunit"].invoke
39
+ ENV["TESTOPTS"].should =~ /somevalue.*test_unit_loader/
40
+ end
41
+ end
42
+
43
+ describe "ci_reporter ci:setup:rspec task" do
44
+ before(:each) do
45
+ @rake = Rake::Application.new
46
+ Rake.application = @rake
47
+ load CI_REPORTER_LIB + '/ci/reporter/rake/rspec.rb'
48
+ save_env "CI_REPORTS"
49
+ save_env "SPEC_OPTS"
50
+ ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf"
51
+ end
52
+ after(:each) do
53
+ restore_env "SPEC_OPTS"
54
+ restore_env "CI_REPORTS"
55
+ Rake.application = nil
56
+ end
57
+
58
+ it "should set ENV['SPEC_OPTS'] to include rspec formatter args" do
59
+ @rake["ci:setup:rspec"].invoke
60
+ ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
61
+ end
62
+
63
+ it "should set ENV['SPEC_OPTS'] to include rspec doc formatter if task is ci:setup:rspecdoc" do
64
+ @rake["ci:setup:rspecdoc"].invoke
65
+ ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpecDoc/
66
+ end
67
+
68
+ it "should append to ENV['SPEC_OPTS'] if it already contains a value" do
69
+ ENV["SPEC_OPTS"] = "somevalue".freeze
70
+ @rake["ci:setup:rspec"].invoke
71
+ ENV["SPEC_OPTS"].should =~ /somevalue.*--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
72
+ end
73
+ end
@@ -0,0 +1,39 @@
1
+ # (c) Copyright 2006-2007 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
6
+
7
+ describe "The ReportManager" do
8
+ before(:each) do
9
+ @reports_dir = REPORTS_DIR
10
+ end
11
+
12
+ after(:each) do
13
+ FileUtils.rm_rf @reports_dir
14
+ ENV["CI_REPORTS"] = nil
15
+ end
16
+
17
+ it "should create the report directory according to the given prefix" do
18
+ CI::Reporter::ReportManager.new("spec")
19
+ File.directory?(@reports_dir).should be_true
20
+ end
21
+
22
+ it "should create the report directory based on CI_REPORTS environment variable if set" do
23
+ @reports_dir = "#{Dir.getwd}/dummy"
24
+ ENV["CI_REPORTS"] = @reports_dir
25
+ CI::Reporter::ReportManager.new("spec")
26
+ File.directory?(@reports_dir).should be_true
27
+ end
28
+
29
+ it "should write reports based on name and xml content of a test suite" do
30
+ reporter = CI::Reporter::ReportManager.new("spec")
31
+ suite = mock("test suite")
32
+ suite.should_receive(:name).and_return("some test suite name")
33
+ suite.should_receive(:to_xml).and_return("<xml></xml>")
34
+ reporter.write_report(suite)
35
+ filename = "#{REPORTS_DIR}/SPEC-some-test-suite-name.xml"
36
+ File.exist?(filename).should be_true
37
+ File.open(filename) {|f| f.read.should == "<xml></xml>"}
38
+ end
39
+ end
@@ -0,0 +1,108 @@
1
+ # (c) Copyright 2006-2008 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
6
+ require 'stringio'
7
+
8
+ describe "The RSpec reporter" do
9
+ before(:each) do
10
+ @error = mock("error")
11
+ @error.stub!(:expectation_not_met?).and_return(false)
12
+ @error.stub!(:pending_fixed?).and_return(false)
13
+ @report_mgr = mock("report manager")
14
+ @options = mock("options")
15
+ @args = [@options, StringIO.new("")]
16
+ @args.shift if Spec::VERSION::MAJOR == 1 && Spec::VERSION::MINOR < 1
17
+ @fmt = CI::Reporter::RSpec.new *@args
18
+ @fmt.report_manager = @report_mgr
19
+ @formatter = mock("formatter")
20
+ @fmt.formatter = @formatter
21
+ end
22
+
23
+ it "should use a progress bar formatter by default" do
24
+ fmt = CI::Reporter::RSpec.new *@args
25
+ fmt.formatter.should be_instance_of(Spec::Runner::Formatter::ProgressBarFormatter)
26
+ end
27
+
28
+ it "should use a specdoc formatter for RSpecDoc" do
29
+ fmt = CI::Reporter::RSpecDoc.new *@args
30
+ fmt.formatter.should be_instance_of(Spec::Runner::Formatter::SpecdocFormatter)
31
+ end
32
+
33
+ it "should create a test suite with one success, one failure, and one pending" do
34
+ @report_mgr.should_receive(:write_report).and_return do |suite|
35
+ suite.testcases.length.should == 3
36
+ suite.testcases[0].should_not be_failure
37
+ suite.testcases[0].should_not be_error
38
+ suite.testcases[1].should be_error
39
+ suite.testcases[2].name.should =~ /\(PENDING\)/
40
+ end
41
+
42
+ example_group = mock "example group"
43
+ example_group.stub!(:description).and_return "A context"
44
+
45
+ @formatter.should_receive(:start).with(3)
46
+ @formatter.should_receive(:example_group_started).with(example_group)
47
+ @formatter.should_receive(:example_started).exactly(3).times
48
+ @formatter.should_receive(:example_passed).once
49
+ @formatter.should_receive(:example_failed).once
50
+ @formatter.should_receive(:example_pending).once
51
+ @formatter.should_receive(:start_dump).once
52
+ @formatter.should_receive(:dump_failure).once
53
+ @formatter.should_receive(:dump_summary).once
54
+ @formatter.should_receive(:dump_pending).once
55
+ @formatter.should_receive(:close).once
56
+
57
+ @fmt.start(3)
58
+ @fmt.example_group_started(example_group)
59
+ @fmt.example_started("should pass")
60
+ @fmt.example_passed("should pass")
61
+ @fmt.example_started("should fail")
62
+ @fmt.example_failed("should fail", 1, @error)
63
+ @fmt.example_started("should be pending")
64
+ @fmt.example_pending("A context", "should be pending", "Not Yet Implemented")
65
+ @fmt.start_dump
66
+ @fmt.dump_failure(1, mock("failure"))
67
+ @fmt.dump_summary(0.1, 3, 1, 1)
68
+ @fmt.dump_pending
69
+ @fmt.close
70
+ end
71
+
72
+ it "should support RSpec 1.0.8 #add_behavior" do
73
+ @formatter.should_receive(:start)
74
+ @formatter.should_receive(:add_behaviour).with("A context")
75
+ @formatter.should_receive(:example_started).once
76
+ @formatter.should_receive(:example_passed).once
77
+ @formatter.should_receive(:dump_summary)
78
+ @report_mgr.should_receive(:write_report)
79
+
80
+ @fmt.start(2)
81
+ @fmt.add_behaviour("A context")
82
+ @fmt.example_started("should pass")
83
+ @fmt.example_passed("should pass")
84
+ @fmt.dump_summary(0.1, 1, 0, 0)
85
+ end
86
+
87
+ it "should use the example #description method when available" do
88
+ group = mock "example group"
89
+ group.stub!(:description).and_return "group description"
90
+ example = mock "example"
91
+ example.stub!(:description).and_return "should do something"
92
+
93
+ @formatter.should_receive(:start)
94
+ @formatter.should_receive(:example_group_started).with(group)
95
+ @formatter.should_receive(:example_started).with(example).once
96
+ @formatter.should_receive(:example_passed).once
97
+ @formatter.should_receive(:dump_summary)
98
+ @report_mgr.should_receive(:write_report).and_return do |suite|
99
+ suite.testcases.last.name.should == "should do something"
100
+ end
101
+
102
+ @fmt.start(2)
103
+ @fmt.example_group_started(group)
104
+ @fmt.example_started(example)
105
+ @fmt.example_passed(example)
106
+ @fmt.dump_summary(0.1, 1, 0, 0)
107
+ end
108
+ end
@@ -0,0 +1,150 @@
1
+ # (c) Copyright 2006-2007 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
6
+ require 'rexml/document'
7
+
8
+ describe "A TestSuite" do
9
+ before(:each) do
10
+ @suite = CI::Reporter::TestSuite.new("example suite")
11
+ end
12
+
13
+ it "should collect timings when start and finish are invoked in sequence" do
14
+ @suite.start
15
+ @suite.finish
16
+ @suite.time.should >= 0
17
+ end
18
+
19
+ it "should aggregate tests" do
20
+ @suite.start
21
+ @suite.testcases << CI::Reporter::TestCase.new("example test")
22
+ @suite.finish
23
+ @suite.tests.should == 1
24
+ end
25
+
26
+ it "should stringify the name for cases when the object passed in is not a string" do
27
+ name = Object.new
28
+ def name.to_s; "object name"; end
29
+ CI::Reporter::TestSuite.new(name).name.should == "object name"
30
+ end
31
+
32
+ it "should indicate number of failures and errors" do
33
+ failure = mock("failure")
34
+ failure.stub!(:failure?).and_return true
35
+ failure.stub!(:error?).and_return false
36
+
37
+ error = mock("error")
38
+ error.stub!(:failure?).and_return false
39
+ error.stub!(:error?).and_return true
40
+
41
+ @suite.start
42
+ @suite.testcases << CI::Reporter::TestCase.new("example test")
43
+ @suite.testcases << CI::Reporter::TestCase.new("failure test")
44
+ @suite.testcases.last.failures << failure
45
+ @suite.testcases << CI::Reporter::TestCase.new("error test")
46
+ @suite.testcases.last.failures << error
47
+ @suite.finish
48
+ @suite.tests.should == 3
49
+ @suite.failures.should == 1
50
+ @suite.errors.should == 1
51
+ end
52
+ end
53
+
54
+ describe "TestSuite xml" do
55
+ before(:each) do
56
+ @suite = CI::Reporter::TestSuite.new("example suite")
57
+ @suite.assertions = 11
58
+ begin
59
+ raise StandardError, "an exception occurred"
60
+ rescue => e
61
+ @exception = e
62
+ end
63
+ end
64
+
65
+ it "should contain Ant/JUnit-formatted description of entire suite" do
66
+ failure = mock("failure")
67
+ failure.stub!(:failure?).and_return true
68
+ failure.stub!(:error?).and_return false
69
+ failure.stub!(:name).and_return "failure"
70
+ failure.stub!(:message).and_return "There was a failure"
71
+ failure.stub!(:location).and_return @exception.backtrace.join("\n")
72
+
73
+ error = mock("error")
74
+ error.stub!(:failure?).and_return false
75
+ error.stub!(:error?).and_return true
76
+ error.stub!(:name).and_return "error"
77
+ error.stub!(:message).and_return "There was a error"
78
+ error.stub!(:location).and_return @exception.backtrace.join("\n")
79
+
80
+ @suite.start
81
+ @suite.testcases << CI::Reporter::TestCase.new("example test")
82
+ @suite.testcases << CI::Reporter::TestCase.new("failure test")
83
+ @suite.testcases.last.failures << failure
84
+ @suite.testcases << CI::Reporter::TestCase.new("error test")
85
+ @suite.testcases.last.failures << error
86
+ @suite.finish
87
+
88
+ xml = @suite.to_xml
89
+ doc = REXML::Document.new(xml)
90
+ testsuite = doc.root.elements.to_a("/testsuite")
91
+ testsuite.length.should == 1
92
+ testsuite = testsuite.first
93
+ testsuite.attributes["name"].should == "example suite"
94
+ testsuite.attributes["assertions"].should == "11"
95
+
96
+ testcases = testsuite.elements.to_a("testcase")
97
+ testcases.length.should == 3
98
+ end
99
+
100
+ it "should contain full exception type and message in location element" do
101
+ failure = mock("failure")
102
+ failure.stub!(:failure?).and_return true
103
+ failure.stub!(:error?).and_return false
104
+ failure.stub!(:name).and_return "failure"
105
+ failure.stub!(:message).and_return "There was a failure"
106
+ failure.stub!(:location).and_return @exception.backtrace.join("\n")
107
+
108
+ @suite.start
109
+ @suite.testcases << CI::Reporter::TestCase.new("example test")
110
+ @suite.testcases << CI::Reporter::TestCase.new("failure test")
111
+ @suite.testcases.last.failures << failure
112
+ @suite.finish
113
+
114
+ xml = @suite.to_xml
115
+ doc = REXML::Document.new(xml)
116
+ elem = doc.root.elements.to_a("/testsuite/testcase[@name='failure test']/failure").first
117
+ location = elem.texts.join
118
+ location.should =~ Regexp.new(failure.message)
119
+ location.should =~ Regexp.new(failure.name)
120
+ end
121
+
122
+ it "should filter attributes properly for invalid characters" do
123
+ failure = mock("failure")
124
+ failure.stub!(:failure?).and_return true
125
+ failure.stub!(:error?).and_return false
126
+ failure.stub!(:name).and_return "failure"
127
+ failure.stub!(:message).and_return "There was a <failure>\nReason: blah"
128
+ failure.stub!(:location).and_return @exception.backtrace.join("\n")
129
+
130
+ @suite.start
131
+ @suite.testcases << CI::Reporter::TestCase.new("failure test")
132
+ @suite.testcases.last.failures << failure
133
+ @suite.finish
134
+
135
+ xml = @suite.to_xml
136
+ xml.should =~ %r/message="There was a &lt;failure&gt;\.\.\."/
137
+ end
138
+ end
139
+
140
+ describe "A TestCase" do
141
+ before(:each) do
142
+ @tc = CI::Reporter::TestCase.new("example test")
143
+ end
144
+
145
+ it "should collect timings when start and finish are invoked in sequence" do
146
+ @tc.start
147
+ @tc.finish
148
+ @tc.time.should >= 0
149
+ end
150
+ end
@@ -0,0 +1,152 @@
1
+ # (c) Copyright 2006-2007 Nick Sieger <nicksieger@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ require File.dirname(__FILE__) + "/../../spec_helper.rb"
6
+
7
+ describe "The TestUnit reporter" do
8
+ before(:each) do
9
+ @report_mgr = mock("report manager")
10
+ @testunit = CI::Reporter::TestUnit.new(nil, @report_mgr)
11
+ @result = mock("result")
12
+ @result.stub!(:assertion_count).and_return(7)
13
+ end
14
+
15
+ it "should build suites based on adjacent tests with the same class name" do
16
+ @suite = nil
17
+ @report_mgr.should_receive(:write_report).once.and_return {|suite| @suite = suite }
18
+
19
+ @testunit.started(@result)
20
+ @testunit.test_started("test_one(TestCaseClass)")
21
+ @testunit.test_finished("test_one(TestCaseClass)")
22
+ @testunit.test_started("test_two(TestCaseClass)")
23
+ @testunit.test_finished("test_two(TestCaseClass)")
24
+ @testunit.finished(10)
25
+
26
+ @suite.name.should == "TestCaseClass"
27
+ @suite.testcases.length.should == 2
28
+ @suite.testcases.first.name.should == "test_one"
29
+ @suite.testcases.first.should_not be_failure
30
+ @suite.testcases.first.should_not be_error
31
+ @suite.testcases.last.name.should == "test_two"
32
+ @suite.testcases.last.should_not be_failure
33
+ @suite.testcases.last.should_not be_error
34
+ end
35
+
36
+ it "should build two suites when encountering different class names" do
37
+ @suites = []
38
+ @report_mgr.should_receive(:write_report).twice.and_return {|suite| @suites << suite }
39
+
40
+ @testunit.started(@result)
41
+ @testunit.test_started("test_one(TestCaseClass)")
42
+ @testunit.test_finished("test_one(TestCaseClass)")
43
+ @testunit.test_started("test_two(AnotherTestCaseClass)")
44
+ @testunit.test_finished("test_two(AnotherTestCaseClass)")
45
+ @testunit.finished(10)
46
+
47
+ @suites.first.name.should == "TestCaseClass"
48
+ @suites.first.testcases.length.should == 1
49
+ @suites.first.testcases.first.name.should == "test_one"
50
+ @suites.first.testcases.first.assertions.should == 7
51
+
52
+ @suites.last.name.should == "AnotherTestCaseClass"
53
+ @suites.last.testcases.length.should == 1
54
+ @suites.last.testcases.first.name.should == "test_two"
55
+ @suites.last.testcases.first.assertions.should == 0
56
+ end
57
+
58
+ it "should record assertion counts during test run" do
59
+ @suite = nil
60
+ @report_mgr.should_receive(:write_report).and_return {|suite| @suite = suite }
61
+
62
+ @testunit.started(@result)
63
+ @testunit.test_started("test_one(TestCaseClass)")
64
+ @testunit.test_finished("test_one(TestCaseClass)")
65
+ @testunit.finished(10)
66
+
67
+ @suite.assertions.should == 7
68
+ @suite.testcases.last.assertions.should == 7
69
+ end
70
+
71
+ it "should add failures to testcases when encountering a fault" do
72
+ @failure = Test::Unit::Failure.new("test_one(TestCaseClass)", "somewhere:10", "it failed")
73
+
74
+ @suite = nil
75
+ @report_mgr.should_receive(:write_report).once.and_return {|suite| @suite = suite }
76
+
77
+ @testunit.started(@result)
78
+ @testunit.test_started("test_one(TestCaseClass)")
79
+ @testunit.fault(@failure)
80
+ @testunit.test_finished("test_one(TestCaseClass)")
81
+ @testunit.finished(10)
82
+
83
+ @suite.name.should == "TestCaseClass"
84
+ @suite.testcases.length.should == 1
85
+ @suite.testcases.first.name.should == "test_one"
86
+ @suite.testcases.first.should be_failure
87
+ end
88
+
89
+ it "should add errors to testcases when encountering a fault" do
90
+ begin
91
+ raise StandardError, "error"
92
+ rescue => e
93
+ @error = Test::Unit::Error.new("test_two(TestCaseClass)", e)
94
+ end
95
+
96
+ @suite = nil
97
+ @report_mgr.should_receive(:write_report).once.and_return {|suite| @suite = suite }
98
+
99
+ @testunit.started(@result)
100
+ @testunit.test_started("test_one(TestCaseClass)")
101
+ @testunit.test_finished("test_one(TestCaseClass)")
102
+ @testunit.test_started("test_two(TestCaseClass)")
103
+ @testunit.fault(@error)
104
+ @testunit.test_finished("test_two(TestCaseClass)")
105
+ @testunit.finished(10)
106
+
107
+ @suite.name.should == "TestCaseClass"
108
+ @suite.testcases.length.should == 2
109
+ @suite.testcases.first.name.should == "test_one"
110
+ @suite.testcases.first.should_not be_failure
111
+ @suite.testcases.first.should_not be_error
112
+ @suite.testcases.last.name.should == "test_two"
113
+ @suite.testcases.last.should_not be_failure
114
+ @suite.testcases.last.should be_error
115
+ end
116
+
117
+ it "should add multiple failures to a testcase" do
118
+ @failure1 = Test::Unit::Failure.new("test_one(TestCaseClass)", "somewhere:10", "it failed")
119
+ @failure2 = Test::Unit::Failure.new("test_one(TestCaseClass)", "somewhere:12", "it failed again in teardown")
120
+
121
+ @suite = nil
122
+ @report_mgr.should_receive(:write_report).once.and_return {|suite| @suite = suite }
123
+
124
+ @testunit.started(@result)
125
+ @testunit.test_started("test_one(TestCaseClass)")
126
+ @testunit.fault(@failure1)
127
+ @testunit.fault(@failure2)
128
+ @testunit.test_finished("test_one(TestCaseClass)")
129
+ @testunit.finished(10)
130
+
131
+ @suite.name.should == "TestCaseClass"
132
+ @suite.testcases.length.should == 1
133
+ @suite.testcases.first.name.should == "test_one"
134
+ @suite.testcases.first.should be_failure
135
+ @suite.testcases.first.failures.size.should == 2
136
+ @suite.failures.should == 2
137
+ end
138
+
139
+ it "should count test case names that don't conform to the standard pattern" do
140
+ @suite = nil
141
+ @report_mgr.should_receive(:write_report).once.and_return {|suite| @suite = suite }
142
+
143
+ @testunit.started(@result)
144
+ @testunit.test_started("some unknown test")
145
+ @testunit.test_finished("some unknown test")
146
+ @testunit.finished(10)
147
+
148
+ @suite.name.should == "unknown-1"
149
+ @suite.testcases.length.should == 1
150
+ @suite.testcases.first.name.should == "some unknown test"
151
+ end
152
+ end