Skip to content

Commit c4e40ba

Browse files
author
Blake Watters
committed
Switch test automation to xctasks
1 parent 4be1629 commit c4e40ba

File tree

3 files changed

+22
-32
lines changed

3 files changed

+22
-32
lines changed

Gemfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ gem "bundler", "~> 1.6.1"
55
gem "sinatra", '~> 1.4.0'
66
gem "sinatra-contrib", '~> 1.4.0'
77
gem "thin", "~> 1.5.0"
8-
gem 'debugger', '~> 1.6.0'
98
gem 'cocoapods', '~> 0.33.1'
9+
gem 'xctasks', '~> 0.2.1'
10+
gem 'xcpretty', '~> 0.1.6'

Gemfile.lock

+4-8
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,7 @@ GEM
3434
netrc
3535
cocoapods-try (0.3.0)
3636
colored (1.2)
37-
columnize (0.3.6)
3837
daemons (1.1.9)
39-
debugger (1.6.2)
40-
columnize (>= 0.3.1)
41-
debugger-linecache (~> 1.2.0)
42-
debugger-ruby_core_source (~> 1.2.3)
43-
debugger-linecache (1.2.0)
44-
debugger-ruby_core_source (1.2.3)
4538
escape (0.0.4)
4639
eventmachine (1.0.3)
4740
fuzzy_match (2.0.4)
@@ -79,15 +72,18 @@ GEM
7972
xcodeproj (0.17.0)
8073
activesupport (~> 3.0)
8174
colored (~> 1.2)
75+
xcpretty (0.1.6)
76+
xctasks (0.2.1)
8277

8378
PLATFORMS
8479
ruby
8580

8681
DEPENDENCIES
8782
bundler (~> 1.6.1)
8883
cocoapods (~> 0.33.1)
89-
debugger (~> 1.6.0)
9084
rakeup (~> 1.1.0)
9185
sinatra (~> 1.4.0)
9286
sinatra-contrib (~> 1.4.0)
9387
thin (~> 1.5.0)
88+
xcpretty (~> 0.1.6)
89+
xctasks (~> 0.2.1)

Rakefile

+16-23
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
require 'rubygems'
22
require 'bundler/setup'
3+
Bundler.setup
4+
require 'xctasks/test_task'
35
require 'rakeup'
4-
require 'debugger'
56

67
RakeUp::ServerTask.new do |t|
78
t.port = 4567
@@ -10,39 +11,31 @@ RakeUp::ServerTask.new do |t|
1011
t.server = :thin
1112
end
1213

13-
namespace :test do
14-
task :prepare do
15-
system(%Q{mkdir -p "RestKit.xcworkspace/xcshareddata/xcschemes" && cp Tests/Schemes/*.xcscheme "RestKit.xcworkspace/xcshareddata/xcschemes/"})
16-
end
14+
XCTasks::TestTask.new(:test) do |t|
15+
t.workspace = 'RestKit.xcworkspace'
16+
t.schemes_dir = 'Tests/Schemes'
17+
t.runner = :xcpretty
18+
t.actions = %w{test}
1719

18-
desc "Run the unit tests for iOS"
19-
task :ios => :prepare do
20-
$ios_success = system("xctool -workspace RestKit.xcworkspace -scheme RestKitTests -sdk iphonesimulator test -test-sdk iphonesimulator ONLY_ACTIVE_ARCH=NO")
20+
t.subtask(ios: 'RestKitTests') do |s|
21+
s.sdk = :iphonesimulator
2122
end
2223

23-
desc "Run the unit tests for OS X"
24-
task :osx => :prepare do
25-
$osx_success = system("xctool -workspace RestKit.xcworkspace -scheme RestKitFrameworkTests -sdk macosx test -test-sdk macosx")
24+
t.subtask(osx: 'RestKitFrameworkTests') do |s|
25+
s.sdk = :macosx
2626
end
27-
27+
end
28+
29+
task default: 'test'
30+
31+
namespace :test do
2832
# Provides validation that RestKit continues to build without Core Data. This requires conditional compilation that is error prone
2933
task :building_without_core_data do
3034
system("cd Examples/RKTwitter && pod install")
3135
system("xctool -workspace Examples/RKTwitter/RKTwitter.xcworkspace -scheme RKTwitterCocoaPods -sdk iphonesimulator clean build ONLY_ACTIVE_ARCH=NO")
3236
end
3337
end
3438

35-
desc 'Run all the RestKit tests'
36-
task :test => ['test:ios', 'test:osx'] do
37-
puts "\033[0;31m!! iOS unit tests failed" unless $ios_success
38-
puts "\033[0;31m!! OS X unit tests failed" unless $osx_success
39-
if $ios_success && $osx_success
40-
puts "\033[0;32m** All tests executed successfully"
41-
else
42-
exit(-1)
43-
end
44-
end
45-
4639
task :default => ["server:autostart", :test, "server:autostop"]
4740

4841
def restkit_version

0 commit comments

Comments
 (0)