xctest-runner 0.1.0
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.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +11 -0
- data/Guardfile +24 -0
- data/LICENSE.txt +20 -0
- data/README.md +57 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/bin/xctest-runner +31 -0
- data/lib/xctest-runner.rb +79 -0
- data/lib/xctest-runner/build-environment.rb +30 -0
- data/lib/xctest-runner/shell.rb +17 -0
- data/lib/xctest-runner/version.rb +5 -0
- data/spec/lib/xctest-runner_spec.rb +224 -0
- data/spec/spec_helper.rb +12 -0
- data/xctest-runner.gemspec +71 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e20d4737c7d79a3473f752177015b7ef9913c2f7
|
4
|
+
data.tar.gz: 17e3a16a2f66e2cc67664a5e87be769b9b8f8a03
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d3e0900e1c8954cdac3c01a5e4289de2fe21150aef4f67f17be311d45bba33a3d34467af994cae667db71684a1af2acbae8f7e3555daa543e0b5d1ca1f795c02
|
7
|
+
data.tar.gz: 0ed3bf2be0e336b2528ac90a93bdfa53a048072941586a1cb38e99df443a86794840079f31f50afdf7ee2097d925260ca2655040b472cfdaad1623bd6a89da64
|
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :rspec do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
|
17
|
+
# Capybara features specs
|
18
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
19
|
+
|
20
|
+
# Turnip features and steps
|
21
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
22
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
23
|
+
end
|
24
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 tokorom
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
xctest-runner
|
2
|
+
===================
|
3
|
+
|
4
|
+
The unit tests runner for xctest.
|
5
|
+
You can run only a specific test case in the CUI!
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
```shell
|
10
|
+
$ gem install xctest-runner
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
### If you would like to run a specific test case
|
16
|
+
|
17
|
+
```shell
|
18
|
+
$ xctest-runner -target YourTestsTarget -test SampleTests/testSample
|
19
|
+
```
|
20
|
+
|
21
|
+
### If you specify a scheme
|
22
|
+
|
23
|
+
```shell
|
24
|
+
$ xctest-runner -scheme YourScheme
|
25
|
+
```
|
26
|
+
|
27
|
+
### If you specify a workspace
|
28
|
+
|
29
|
+
```shell
|
30
|
+
$ xctest-runner -workspace Sample.xcworkspace -target YourTestsTarget
|
31
|
+
```
|
32
|
+
|
33
|
+
### If you specify a project
|
34
|
+
|
35
|
+
```shell
|
36
|
+
$ xctest-runner -workspace Sample.xcodeproj -target YourTestsTarget
|
37
|
+
```
|
38
|
+
|
39
|
+
## Advanced Usage
|
40
|
+
|
41
|
+
### If you would like to use [xcpretty](https://github.com/mneorr/XCPretty)
|
42
|
+
|
43
|
+
```shell
|
44
|
+
$ xctest-runner -target YourTestsTarget | xcpretty -c
|
45
|
+
```
|
46
|
+
|
47
|
+
### If you would like add your build options
|
48
|
+
|
49
|
+
```shell
|
50
|
+
$ xctest-runner -target YourTestsTarget -suffix "OBJROOT=."
|
51
|
+
```
|
52
|
+
|
53
|
+
## Copyright
|
54
|
+
|
55
|
+
Copyright (c) 2014 tokorom. See LICENSE.txt for
|
56
|
+
further details.
|
57
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "xctest-runner"
|
18
|
+
gem.homepage = "http://github.com/tokorom/xctest-runner"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = "The unit tests runner for xctest"
|
21
|
+
gem.description = "The unit tests runner for xctest"
|
22
|
+
gem.email = "tokorom@gmail.com"
|
23
|
+
gem.authors = ["tokorom"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'rdoc/task'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "xctest-runner #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
rdoc.options = ['--charset', 'utf-8', '--line-numbers']
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/xctest-runner
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
|
4
|
+
if $0 == __FILE__
|
5
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'xctest-runner'
|
9
|
+
require 'optparse'
|
10
|
+
|
11
|
+
opts = {}
|
12
|
+
opt = OptionParser.new
|
13
|
+
opt.on('--scheme NAME', 'build the scheme NAME') {|v| opts[:scheme] = v }
|
14
|
+
opt.on('--workspace NAME', 'build the workspace NAME') {|v| opts[:workspace] = v }
|
15
|
+
opt.on('--project NAME', 'build the project NAME') {|v| opts[:project] = v }
|
16
|
+
opt.on('--target NAME', 'build the target NAME') {|v| opts[:target] = v }
|
17
|
+
opt.on('--sdk SDK', 'use SDK as the name or path of the base SDK when building the project') {|v| opts[:sdk] = v }
|
18
|
+
opt.on('--arch ARCH', 'build each target for the architecture ARCH') {|v| opts[:arch] = v }
|
19
|
+
opt.on('--configuration NAME', 'use the build configuration NAME for building each target') {|v| opts[:configuration] = v }
|
20
|
+
opt.on('--test VAL', 'Self | All | None | <TestCaseClassName/testMethodName>') {|v| opts[:test] = v }
|
21
|
+
opt.on('--clean', 'run clean action before build') {|v| opts[:clean] = true }
|
22
|
+
opt.on('--suffix STRING', 'add STRING to build command and xctest command') {|v| opts[:suffix] = v }
|
23
|
+
opt.on_tail("-v", "--version", "Show version") { puts XCTestRunner::VERSION; exit }
|
24
|
+
|
25
|
+
argv = []
|
26
|
+
ARGV.each do |arg|
|
27
|
+
argv << arg.gsub(/^-(\w\w+)$/, '--\1')
|
28
|
+
end
|
29
|
+
opt.parse!(argv)
|
30
|
+
|
31
|
+
XCTestRunner.new(opts).run
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'xctest-runner/version'
|
4
|
+
require 'xctest-runner/build-environment'
|
5
|
+
require 'xctest-runner/shell'
|
6
|
+
|
7
|
+
class XCTestRunner
|
8
|
+
include BuildEnvironment
|
9
|
+
include Shell
|
10
|
+
|
11
|
+
def initialize(opts = {})
|
12
|
+
@clean = opts[:clean] || false
|
13
|
+
@scheme = opts[:scheme] || nil
|
14
|
+
@workspace = opts[:workspace] || nil
|
15
|
+
@project = opts[:project] || nil
|
16
|
+
@target = opts[:target] || nil
|
17
|
+
@sdk = opts[:sdk] || 'iphonesimulator'
|
18
|
+
@arch = opts[:arch] || 'x86_64'
|
19
|
+
@configuration = opts[:configuration] || 'Debug'
|
20
|
+
@test_class = opts[:test] || 'Self'
|
21
|
+
@suffix = opts[:suffix] || ''
|
22
|
+
|
23
|
+
@env = current_environment(build_command)
|
24
|
+
end
|
25
|
+
|
26
|
+
def xcodebuild
|
27
|
+
"xcodebuild"
|
28
|
+
end
|
29
|
+
|
30
|
+
def xctest
|
31
|
+
if @xctest.nil?
|
32
|
+
@xctest = "#{@env['SDK_DIR']}/Developer/usr/bin/xctest"
|
33
|
+
end
|
34
|
+
@xctest
|
35
|
+
end
|
36
|
+
|
37
|
+
def clean_command
|
38
|
+
"#{xcodebuild} clean #{xcodebuild_option}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def build_command
|
42
|
+
"#{xcodebuild} #{xcodebuild_option}"
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_command(test_class)
|
46
|
+
configure_environment(build_command)
|
47
|
+
additional_options = "-NSTreatUnknownArgumentsAsOpen NO -ApplePersistenceIgnoreState YES"
|
48
|
+
bundle_path = "#{@env['BUILT_PRODUCTS_DIR']}/#{@env['FULL_PRODUCT_NAME']}"
|
49
|
+
"#{xctest} -XCTest #{test_class} #{additional_options} #{bundle_path}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def xcodebuild_option
|
53
|
+
(@scheme ? "-scheme #{@scheme} " : '') +
|
54
|
+
(@workspace ? "-workspace #{@workspace} " : '') +
|
55
|
+
(@project ? "-project #{@project} " : '') +
|
56
|
+
(@target ? "-target #{@target} " : '') +
|
57
|
+
"-sdk #{@sdk} -arch #{@arch} -configuration #{@configuration}"
|
58
|
+
end
|
59
|
+
|
60
|
+
def clean
|
61
|
+
execute_command(clean_command, true)
|
62
|
+
end
|
63
|
+
|
64
|
+
def build
|
65
|
+
execute_command("#{build_command} #{@suffix}", true)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test(test_class = 'Self')
|
69
|
+
command = test_command(test_class)
|
70
|
+
execute_command("#{command} #{@suffix}", true)
|
71
|
+
end
|
72
|
+
|
73
|
+
def run
|
74
|
+
clean if @clean
|
75
|
+
build
|
76
|
+
test(@test_class)
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'xctest-runner/shell'
|
4
|
+
|
5
|
+
module BuildEnvironment
|
6
|
+
include Shell
|
7
|
+
|
8
|
+
def current_environment(build_command)
|
9
|
+
env = {}
|
10
|
+
settings = execute_command("#{build_command} -showBuildSettings test")
|
11
|
+
settings.each_line do |line|
|
12
|
+
if line =~ /^\s(.*)=(.*)/
|
13
|
+
variable, value = line.split('=')
|
14
|
+
variable = variable.strip
|
15
|
+
value = value.strip
|
16
|
+
env[variable] = value if (env[variable].nil? || env[variable].empty?)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
env
|
20
|
+
end
|
21
|
+
|
22
|
+
def configure_environment(build_command)
|
23
|
+
env = current_environment(build_command)
|
24
|
+
env.each do |key, value|
|
25
|
+
ENV[key] = value
|
26
|
+
end
|
27
|
+
ENV['DYLD_ROOT_PATH'] = ENV['SDK_DIR']
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'systemu'
|
4
|
+
|
5
|
+
module Shell
|
6
|
+
|
7
|
+
def execute_command(command, need_puts = false)
|
8
|
+
status, stdout, stderr = systemu command
|
9
|
+
if need_puts
|
10
|
+
puts "$ #{command}\n\n"
|
11
|
+
puts stdout
|
12
|
+
end
|
13
|
+
puts stderr
|
14
|
+
stdout
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,224 @@
|
|
1
|
+
require 'xctest-runner'
|
2
|
+
|
3
|
+
describe XCTestRunner do
|
4
|
+
class XCTestRunner
|
5
|
+
attr_accessor :last_command
|
6
|
+
|
7
|
+
def execute_command(command, need_puts = false)
|
8
|
+
@last_command = command
|
9
|
+
if command.include?('-showBuildSettings')
|
10
|
+
build_settings
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def build_settings
|
15
|
+
<<-EOS
|
16
|
+
Build settings from command line:
|
17
|
+
SDKROOT = iphonesimulator7.0
|
18
|
+
|
19
|
+
Build settings for action test and target Tests:
|
20
|
+
HOGE = "huga"
|
21
|
+
EOS
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
let(:opts) {
|
26
|
+
option = @runner.xcodebuild_option
|
27
|
+
opts = {}
|
28
|
+
option.scan(/(-\w+) (\w+)/) do |opt, value|
|
29
|
+
opts[opt] = value
|
30
|
+
end
|
31
|
+
opts
|
32
|
+
}
|
33
|
+
|
34
|
+
context 'Defaults' do
|
35
|
+
before(:each) do
|
36
|
+
@runner = XCTestRunner.new
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'runs xcodebuild with default options' do
|
40
|
+
expect(opts.count).to eq 3
|
41
|
+
expect(opts['-sdk']).to eq 'iphonesimulator'
|
42
|
+
expect(opts['-arch']).to eq 'x86_64'
|
43
|
+
expect(opts['-configuration']).to eq 'Debug'
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'doese not run clean command' do
|
47
|
+
@runner.should_not_receive(:clean)
|
48
|
+
@runner.should_receive(:build)
|
49
|
+
@runner.should_receive(:test).with('Self')
|
50
|
+
@runner.run
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context '-scheme option' do
|
55
|
+
before(:each) do
|
56
|
+
@runner = XCTestRunner.new({:scheme => 'Tests'})
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'has some build arguments' do
|
60
|
+
expect(opts.count).to eq 4
|
61
|
+
expect(opts['-scheme']).to eq 'Tests'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context '-workspace option' do
|
66
|
+
before(:each) do
|
67
|
+
@runner = XCTestRunner.new({:workspace => 'Sample'})
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'has some build arguments' do
|
71
|
+
expect(opts.count).to eq 4
|
72
|
+
expect(opts['-workspace']).to eq 'Sample'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context '-project option' do
|
77
|
+
before(:each) do
|
78
|
+
@runner = XCTestRunner.new({:project => 'Sample'})
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'has some build arguments' do
|
82
|
+
expect(opts.count).to eq 4
|
83
|
+
expect(opts['-project']).to eq 'Sample'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context '-target option' do
|
88
|
+
before(:each) do
|
89
|
+
@runner = XCTestRunner.new({:target => 'Tests'})
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'has some build arguments' do
|
93
|
+
expect(opts.count).to eq 4
|
94
|
+
expect(opts['-target']).to eq 'Tests'
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context '-sdk option' do
|
99
|
+
before(:each) do
|
100
|
+
@runner = XCTestRunner.new({:sdk => 'iphoneos'})
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'has some build arguments' do
|
104
|
+
expect(opts.count).to eq 3
|
105
|
+
expect(opts['-sdk']).to eq 'iphoneos'
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
context '-arch option' do
|
110
|
+
before(:each) do
|
111
|
+
@runner = XCTestRunner.new({:arch => 'armv7'})
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'has some build arguments' do
|
115
|
+
expect(opts.count).to eq 3
|
116
|
+
expect(opts['-arch']).to eq 'armv7'
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context '-configuration option' do
|
121
|
+
before(:each) do
|
122
|
+
@runner = XCTestRunner.new({:configuration => 'Release'})
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'has some build arguments' do
|
126
|
+
expect(opts.count).to eq 3
|
127
|
+
expect(opts['-configuration']).to eq 'Release'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
context '-test option' do
|
132
|
+
before(:each) do
|
133
|
+
@runner = XCTestRunner.new({:test => 'SampleTests/testCase'})
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'has some build arguments' do
|
137
|
+
expect(opts.count).to eq 3
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'run test command with the specific test case' do
|
141
|
+
@runner.run
|
142
|
+
expect(@runner.last_command).to include '-XCTest SampleTests/testCase'
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context '-clean option' do
|
147
|
+
before(:each) do
|
148
|
+
@runner = XCTestRunner.new({:clean => true})
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'has some build arguments' do
|
152
|
+
expect(opts.count).to eq 3
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'run clean command' do
|
156
|
+
@runner.should_receive(:clean)
|
157
|
+
@runner.should_receive(:build)
|
158
|
+
@runner.should_receive(:test).with('Self')
|
159
|
+
@runner.run
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
context '-suffix option' do
|
164
|
+
before(:each) do
|
165
|
+
@runner = XCTestRunner.new({:suffix => 'OBJROOT=.'})
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'has some build arguments' do
|
169
|
+
expect(opts.count).to eq 3
|
170
|
+
end
|
171
|
+
|
172
|
+
it 'run test command with the suffix' do
|
173
|
+
@runner.build
|
174
|
+
expect(@runner.last_command).to include ' OBJROOT=.'
|
175
|
+
@runner.test
|
176
|
+
expect(@runner.last_command).to include ' OBJROOT=.'
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
context 'Build environment' do
|
181
|
+
class XCTestRunner
|
182
|
+
def build_settings
|
183
|
+
<<-EOS
|
184
|
+
Build settings from command line:
|
185
|
+
SDKROOT = iphonesimulator7.0
|
186
|
+
|
187
|
+
Build settings for action test and target Tests:
|
188
|
+
SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk
|
189
|
+
SDK_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk
|
190
|
+
BUILT_PRODUCTS_DIR = /Users/tokorom/Library/Developer/Xcode/DerivedData/XCTestRunner-xxx/Build/Products/Debug-iphonesimulator
|
191
|
+
FULL_PRODUCT_NAME = Tests.xctest
|
192
|
+
|
193
|
+
Build settings for action test and target Demo:
|
194
|
+
SDKROOT = xxx
|
195
|
+
SDK_DIR = xxx
|
196
|
+
BUILT_PRODUCTS_DIR = xxx
|
197
|
+
FULL_PRODUCT_NAME = Demo.app
|
198
|
+
EOS
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
before(:each) do
|
203
|
+
@runner = XCTestRunner.new
|
204
|
+
end
|
205
|
+
|
206
|
+
context 'ENV' do
|
207
|
+
it 'contains DYLD_ROOT_PATH' do
|
208
|
+
@runner.configure_environment('xcodebuild -showBuildSettings test')
|
209
|
+
expect(ENV['SDKROOT']).to_not eq 'xxx'
|
210
|
+
expect(ENV['DYLD_ROOT_PATH']).to eq ENV['SDK_DIR']
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
context 'test command' do
|
215
|
+
it 'contains xctest command' do
|
216
|
+
expect(@runner.test_command('Self')).to include '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/Developer/usr/bin/xctest '
|
217
|
+
end
|
218
|
+
|
219
|
+
it 'contains test bundle' do
|
220
|
+
expect(@runner.test_command('Self')).to include ' /Users/tokorom/Library/Developer/Xcode/DerivedData/XCTestRunner-xxx/Build/Products/Debug-iphonesimulator/Tests.xctest'
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'xctest-runner'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "xctest-runner"
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["tokorom"]
|
12
|
+
s.date = "2014-01-13"
|
13
|
+
s.description = "The unit tests runner for xctest"
|
14
|
+
s.email = "tokorom@gmail.com"
|
15
|
+
s.executables = ["xctest-runner"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".rspec",
|
23
|
+
"Gemfile",
|
24
|
+
"Guardfile",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"bin/xctest-runner",
|
30
|
+
"lib/xctest-runner.rb",
|
31
|
+
"lib/xctest-runner/build-environment.rb",
|
32
|
+
"lib/xctest-runner/shell.rb",
|
33
|
+
"lib/xctest-runner/version.rb",
|
34
|
+
"spec/lib/xctest-runner_spec.rb",
|
35
|
+
"spec/spec_helper.rb",
|
36
|
+
"xctest-runner.gemspec"
|
37
|
+
]
|
38
|
+
s.homepage = "http://github.com/tokorom/xctest-runner"
|
39
|
+
s.licenses = ["MIT"]
|
40
|
+
s.require_paths = ["lib"]
|
41
|
+
s.rubygems_version = "2.0.14"
|
42
|
+
s.summary = "The unit tests runner for xctest"
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
s.specification_version = 4
|
46
|
+
|
47
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
48
|
+
s.add_runtime_dependency(%q<systemu>, [">= 0"])
|
49
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
50
|
+
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
51
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
52
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
53
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
54
|
+
else
|
55
|
+
s.add_dependency(%q<systemu>, [">= 0"])
|
56
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
57
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
58
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
59
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
60
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
61
|
+
end
|
62
|
+
else
|
63
|
+
s.add_dependency(%q<systemu>, [">= 0"])
|
64
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
65
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
66
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
67
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
68
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xctest-runner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- tokorom
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: systemu
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdoc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jeweler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: The unit tests runner for xctest
|
98
|
+
email: tokorom@gmail.com
|
99
|
+
executables:
|
100
|
+
- xctest-runner
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files:
|
103
|
+
- LICENSE.txt
|
104
|
+
- README.md
|
105
|
+
files:
|
106
|
+
- .document
|
107
|
+
- .rspec
|
108
|
+
- Gemfile
|
109
|
+
- Guardfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- VERSION
|
114
|
+
- bin/xctest-runner
|
115
|
+
- lib/xctest-runner.rb
|
116
|
+
- lib/xctest-runner/build-environment.rb
|
117
|
+
- lib/xctest-runner/shell.rb
|
118
|
+
- lib/xctest-runner/version.rb
|
119
|
+
- spec/lib/xctest-runner_spec.rb
|
120
|
+
- spec/spec_helper.rb
|
121
|
+
- xctest-runner.gemspec
|
122
|
+
homepage: http://github.com/tokorom/xctest-runner
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.0.14
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: The unit tests runner for xctest
|
146
|
+
test_files: []
|