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: [], simctl_timeout: 0) ⇒ TestDumperHelper

rubocop:disable Metrics/ParameterLists


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

def initialize(device_id, max_retry_count, debug, logger, dylib_logfile_path,
               naive_dump_bundle_names: [], skip_dump_bundle_names: [], simctl_timeout: 0)
  @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
  @simctl_timeout = simctl_timeout
  @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


147
148
149
# File 'lib/xcknife/test_dumper.rb', line 147

def logger
  @logger
end

Instance Method Details

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

rubocop:enable Metrics/ParameterLists

Raises:

  • (ArgumentError)

171
172
173
174
175
176
177
178
179
# 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
  raise ArgumentError, "No xctestrun on #{@testroot}" if xctestrun_file.nil?

  xctestrun_as_json = `plutil -convert json -o - "#{xctestrun_file}"`
  FileUtils.mkdir_p(list_folder)
  list_tests(JSON.parse(xctestrun_as_json), list_folder, extra_environment_variables)
end