Class: XCKnife::TestDumperHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/xcknife/test_dumper.rb

Defined Under Namespace

Classes: TestSpecification

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(device_id, max_retry_count, debug, logger, dylib_logfile_path, naive_dump_bundle_names: [], skip_dump_bundle_names: []) ⇒ TestDumperHelper

Returns a new instance of TestDumperHelper.



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/xcknife/test_dumper.rb', line 152

def initialize(device_id, max_retry_count, debug, logger, dylib_logfile_path,
               naive_dump_bundle_names: [], skip_dump_bundle_names: [])
  @xcode_path = `xcode-select -p`.strip
  @simctl_path = `xcrun -f simctl`.strip
  @nm_path = `xcrun -f nm`.strip
  @swift_path = `xcrun -f swift`.strip
  @platforms_path = File.join(@xcode_path, "Platforms")
  @platform_path = File.join(@platforms_path, "iPhoneSimulator.platform")
  @sdk_path = File.join(@platform_path, "Developer/SDKs/iPhoneSimulator.sdk")
  @testroot = nil
  @device_id = device_id
  @max_retry_count = max_retry_count
  @logger = logger
  @debug = debug
  @dylib_logfile_path = dylib_logfile_path if dylib_logfile_path
  @naive_dump_bundle_names = naive_dump_bundle_names
  @skip_dump_bundle_names = skip_dump_bundle_names
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



150
151
152
# File 'lib/xcknife/test_dumper.rb', line 150

def logger
  @logger
end

Instance Method Details

#call(derived_data_folder, list_folder, extra_environment_variables = {}) ⇒ Object



171
172
173
174
175
176
177
178
179
180
# File 'lib/xcknife/test_dumper.rb', line 171

def call(derived_data_folder, list_folder, extra_environment_variables = {})
  @testroot = File.join(derived_data_folder, 'Build', 'Products')
  xctestrun_file = Dir[File.join(@testroot, '*.xctestrun')].first
  if xctestrun_file.nil?
    raise ArgumentError, "No xctestrun on #{@testroot}"
  end
  xctestrun_as_json = `plutil -convert json -o - "#{xctestrun_file}"`
  FileUtils.mkdir_p(list_folder)
  list_tests(JSON.load(xctestrun_as_json), list_folder, extra_environment_variables)
end