Class: XctoolRunner
- Inherits:
-
Object
- Object
- XctoolRunner
- Defined in:
- lib/xctool_runner.rb
Overview
Instance Method Summary collapse
-
#build ⇒ Object
Builds the tests target through xctool.
-
#buildArgument ⇒ Object
Returns the main argument for xctool to build the project/workspace.
-
#initialize(configuration) ⇒ XctoolRunner
constructor
Creates a new instance given a GAConfiguration object.
-
#prepareForFile(filename) ⇒ Object
Tells the runner to prepare the environment for a subsequent test run.
-
#test(filename) ⇒ Object
Runs tests for the specified file.
Constructor Details
#initialize(configuration) ⇒ XctoolRunner
Creates a new instance given a GAConfiguration object
8 9 10 |
# File 'lib/xctool_runner.rb', line 8 def initialize(configuration) @configuration=configuration end |
Instance Method Details
#build ⇒ Object
This method supports both workspace- and project-based environments
Builds the tests target through xctool
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/xctool_runner.rb', line 25 def build() workspace = @configuration.workspace scheme = @configuration.scheme target = @configuration.target project = @configuration.project xctool = @configuration.xctool_path building = workspace building = project if workspace.nil? GALogger.log("Building " + building + " with scheme " + scheme + "...") toBuild = buildArgument() system(xctool + toBuild + ' -scheme ' + scheme + ' -sdk iphonesimulator' + ' build-tests', out: $stdout, err: :out) end |
#buildArgument ⇒ Object
Returns the main argument for xctool to build the project/workspace
Example: -workspace ‘MyWorkspace.xcworkspace’ or -project ‘MyProject.xcodeproj’
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/xctool_runner.rb', line 50 def buildArgument() workspace = @configuration.workspace scheme = @configuration.scheme project = @configuration.project toBuild = '' if workspace.nil? toBuild = " -project '" + project + ".xcodeproj'" else toBuild = " -workspace '" + workspace + ".xcworkspace'" end return toBuild end |
#prepareForFile(filename) ⇒ Object
since xctool needs to build the tests every time, this method just calls build
Tells the runner to prepare the environment for a subsequent test run
(see #build)
18 19 20 |
# File 'lib/xctool_runner.rb', line 18 def prepareForFile(filename) build() end |
#test(filename) ⇒ Object
This method supports both workspace- and project-based environments
Runs tests for the specified file
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/xctool_runner.rb', line 69 def test(filename) scheme = @configuration.scheme target = @configuration.target xctool = @configuration.xctool_path reporter = @configuration.reporter suffix = @configuration.suffix GALogger.log("Running tests for file " + filename + '...') toBuild = buildArgument() system(xctool + toBuild + ' -scheme ' + scheme + ' -sdk iphonesimulator' + ' run-tests' + ' only ' + target + ':' + filename + suffix + ' -reporter ' + reporter, out: $stdout, err: :out) end |