xcoder 0.1.11 → 0.1.12
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/Rakefile +2 -0
- data/lib/xcode/builder.rb +32 -19
- data/lib/xcode/shell.rb +3 -1
- data/lib/xcode/test/parsers/ocunit_parser.rb +94 -0
- data/lib/xcode/test/report.rb +121 -0
- data/lib/xcode/test/report/suite_result.rb +67 -0
- data/lib/xcode/test/report/test_result.rb +49 -0
- data/lib/xcode/version.rb +1 -1
- data/lib/xcode/workspace.rb +6 -3
- data/spec/TestProject/{TestProjectTests/TestProjectTests-Info.plist → ApplicationTests/ApplicationTests-Info.plist} +0 -0
- data/spec/TestProject/ApplicationTests/ApplicationTests-Prefix.pch +8 -0
- data/spec/TestProject/ApplicationTests/ApplicationTests.h +13 -0
- data/spec/TestProject/ApplicationTests/ApplicationTests.m +32 -0
- data/spec/TestProject/{TestProjectTests → ApplicationTests}/en.lproj/InfoPlist.strings +0 -0
- data/spec/TestProject/{TestProjectTests → LogicTests}/AnotherTest.h +0 -0
- data/spec/TestProject/{TestProjectTests → LogicTests}/AnotherTest.m +0 -0
- data/spec/TestProject/LogicTests/TestProjectTests-Info.plist +22 -0
- data/spec/TestProject/{TestProjectTests → LogicTests}/TestProjectTests.h +0 -0
- data/spec/TestProject/{TestProjectTests → LogicTests}/TestProjectTests.m +0 -0
- data/spec/TestProject/LogicTests/en.lproj/InfoPlist.strings +2 -0
- data/spec/TestProject/TestProject.xcodeproj/project.pbxproj +1329 -556
- data/spec/TestProject/TestProject.xcodeproj/xcshareddata/xcschemes/TestProject.xcscheme +13 -2
- data/spec/TestWorkspace2.xcworkspace/contents.xcworkspacedata +7 -0
- data/spec/TestWorkspace2.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/spec/build_phase_spec.rb +2 -2
- data/spec/builder_spec.rb +51 -10
- data/spec/integration/builder_spec.rb +60 -4
- data/spec/ocunit_parser_spec.rb +164 -0
- data/spec/project_spec.rb +1 -1
- data/spec/workspace_spec.rb +8 -3
- metadata +44 -29
- data/lib/xcode/test/ocunit_report_parser.rb +0 -174
- data/lib/xcode/test/suite_result.rb +0 -39
- data/lib/xcode/test/test_result.rb +0 -43
- data/spec/test_report_spec.rb +0 -147
data/spec/test_report_spec.rb
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'xcoder'
|
3
|
-
|
4
|
-
describe Xcode::Test::OCUnitReportParser do
|
5
|
-
|
6
|
-
def example_report
|
7
|
-
t = Xcode::Test::OCUnitReportParser.new
|
8
|
-
yield(t) if block_given?
|
9
|
-
|
10
|
-
t << "Run test suite AnExampleTestSuite"
|
11
|
-
t << "Test Suite 'AnExampleTestSuite' started at 2012-02-10 00:37:04 +0000"
|
12
|
-
|
13
|
-
t << "Run test case anExampleTest1"
|
14
|
-
t << "Test Case '-[AnExampleTestSuite anExampleTest1]' started."
|
15
|
-
t << "Test Case '-[AnExampleTestSuite anExampleTest1]' passed (0.003 seconds)."
|
16
|
-
|
17
|
-
t << "Run test case anExampleTest2"
|
18
|
-
t << "Test Case '-[AnExampleTestSuite anExampleTest2]' started."
|
19
|
-
t << "Test Case '-[AnExampleTestSuite anExampleTest2]' passed (0.003 seconds)."
|
20
|
-
|
21
|
-
t << "Test Suite 'AnExampleTestSuite' finished at 2012-02-10 00:37:04 +0000."
|
22
|
-
t << "Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds"
|
23
|
-
|
24
|
-
t
|
25
|
-
end
|
26
|
-
|
27
|
-
def example_failing_report
|
28
|
-
t = Xcode::Test::OCUnitReportParser.new
|
29
|
-
t << "Run test suite AnExampleTestSuite"
|
30
|
-
t << "Test Suite 'AnExampleTestSuite' started at 2012-02-10 00:37:04 +0000"
|
31
|
-
t << "Test Case '-[AnExampleTestSuite aFailingTest]' started."
|
32
|
-
yield(t) if block_given?
|
33
|
-
t << "Test Case '-[AnExampleTestSuite aFailingTest]' failed (2 seconds)."
|
34
|
-
t << "Test Suite 'AnExampleTestSuite' finished at 2012-02-10 00:37:04 +0000."
|
35
|
-
t << "Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds"
|
36
|
-
t
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should capture output for a test case" do
|
40
|
-
t = example_failing_report do |parser|
|
41
|
-
parser << '2012-02-17 15:03:06.521 otest[24979:7803] line1'
|
42
|
-
parser << '2012-02-17 15:03:06.521 otest[24979:7803] line2'
|
43
|
-
parser << '2012-02-17 15:03:06.521 otest[24979:7803] line3'
|
44
|
-
parser << '2012-02-17 15:03:06.521 otest[24979:7803] line4'
|
45
|
-
parser << '/Some/Path/To/Test.m:1234: error: -[AnExampleTestSuite aFailingTest] : This is an error message'
|
46
|
-
end
|
47
|
-
|
48
|
-
failure = t.reports.first.tests[0]
|
49
|
-
failure.passed?.should==false
|
50
|
-
failure.errors.count.should==1
|
51
|
-
failure.errors[0][:data].count.should==4
|
52
|
-
failure.errors[0][:data][0].should=~/line1/
|
53
|
-
failure.errors[0][:data][1].should=~/line2/
|
54
|
-
failure.errors[0][:data][2].should=~/line3/
|
55
|
-
failure.errors[0][:data][3].should=~/line4/
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should capture errors reported during a test" do
|
59
|
-
t = example_failing_report do |parser|
|
60
|
-
parser << '/Some/Path/To/Test.m:1234: error: -[AnExampleTestSuite aFailingTest] : This is an error message'
|
61
|
-
end
|
62
|
-
|
63
|
-
failure = t.reports.first.tests[0]
|
64
|
-
failure.passed?.should==false
|
65
|
-
failure.errors.count.should==1
|
66
|
-
failure.errors[0][:message].should=='This is an error message'
|
67
|
-
failure.errors[0][:location].should=='/Some/Path/To/Test.m:1234'
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should create a test case" do
|
71
|
-
t = example_report
|
72
|
-
t.reports.count.should==1
|
73
|
-
t.reports.first.name.should=="AnExampleTestSuite"
|
74
|
-
t.reports.first.start_time.should==Time.parse("2012-02-10 00:37:04 +0000")
|
75
|
-
t.reports.first.end_time.should==Time.parse("2012-02-10 00:37:04 +0000")
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should detect a passing report" do
|
79
|
-
t = example_report
|
80
|
-
t.failed?.should==false
|
81
|
-
end
|
82
|
-
|
83
|
-
it "should detect a failing report" do
|
84
|
-
t = example_failing_report
|
85
|
-
t.failed?.should==true
|
86
|
-
end
|
87
|
-
|
88
|
-
it "should record a failure" do
|
89
|
-
t = example_failing_report
|
90
|
-
t.reports.first.total_failed_tests.should==1
|
91
|
-
end
|
92
|
-
|
93
|
-
it "should create a test case with some tests" do
|
94
|
-
t = example_report
|
95
|
-
|
96
|
-
t.reports.count.should==1
|
97
|
-
t.reports.first.tests.count.should==2
|
98
|
-
t.reports.first.tests[0].name.should=='anExampleTest1'
|
99
|
-
t.reports.first.tests[0].time.should==0.003
|
100
|
-
t.reports.first.tests[0].passed?.should==true
|
101
|
-
|
102
|
-
t.reports.first.tests[1].name.should=='anExampleTest2'
|
103
|
-
t.reports.first.tests[1].time.should==0.003
|
104
|
-
t.reports.first.tests[1].passed?.should==true
|
105
|
-
end
|
106
|
-
|
107
|
-
it "should capture failed build" do
|
108
|
-
t = Xcode::Test::OCUnitReportParser.new
|
109
|
-
t << "Run test suite AnExampleTestSuite"
|
110
|
-
t << "Test Suite 'AnExampleTestSuite' started at 2012-02-10 00:37:04 +0000"
|
111
|
-
t << "Run test case anExampleTest1"
|
112
|
-
t << "Test Case '-[AnExampleTestSuite anExampleTest1]' started."
|
113
|
-
t << "/Path/To/Project/Tests/YPKeywordSuggestHandlerTest.m:45: error: -[AnExampleTestSuite anExampleTest1] : 'An example test spec' [FAILED], mock received unexpected message -setSuspended: 1 "
|
114
|
-
t << "/Developer/Tools/RunPlatformUnitTests.include: line 415: 32225 Bus error: 10 \"${THIN_TEST_RIG}\" \"${OTHER_TEST_FLAGS}\" \"${TEST_BUNDLE_PATH}\""
|
115
|
-
t << "/Developer/Tools/RunPlatformUnitTests.include:451: error: Test rig '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/Developer/usr/bin/otest' exited abnormally with code 138 (it may have crashed)."
|
116
|
-
|
117
|
-
t.flush
|
118
|
-
t.failed?.should==true
|
119
|
-
t.finished?.should==true
|
120
|
-
failure = t.reports.first.tests[0]
|
121
|
-
failure.passed?.should==false
|
122
|
-
failure.data.count.should==2
|
123
|
-
failure.data[0].should=~/32225 Bus error: 10/
|
124
|
-
failure.data[1].should=~/Test rig/
|
125
|
-
end
|
126
|
-
|
127
|
-
context "Junit output" do
|
128
|
-
|
129
|
-
it "should write out reports in junit format" do
|
130
|
-
report_dir = "#{File.dirname(__FILE__)}/test-reports"
|
131
|
-
FileUtils.rm_rf report_dir
|
132
|
-
|
133
|
-
t = example_report do |t|
|
134
|
-
t.formatters = []
|
135
|
-
t.add_formatter :junit, report_dir
|
136
|
-
end
|
137
|
-
|
138
|
-
files = Dir["#{report_dir}/*.xml"]
|
139
|
-
files.count.should==1
|
140
|
-
files.first.should=~/TEST-AnExampleTestSuite.xml$/
|
141
|
-
|
142
|
-
# FIXME: parse the report
|
143
|
-
end
|
144
|
-
|
145
|
-
end
|
146
|
-
|
147
|
-
end
|