Class: Fastlane::Actions::MultiScanAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/test_center/actions/multi_scan.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



572
573
574
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 572

def self.authors
  ["lyndsey-ferguson/@lyndseydf"]
end

.available_optionsObject



342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 342

def self.available_options
  scan_options + [
    FastlaneCore::ConfigItem.new(
      key: :try_count,
      env_name: "FL_MULTI_SCAN_TRY_COUNT",
      description: "The number of times to retry running tests via scan",
      type: Integer,
      is_string: false,
      default_value: 1
    ),
    FastlaneCore::ConfigItem.new(
      key: :batch_count,
      env_name: "FL_MULTI_SCAN_BATCH_COUNT",
      description: "The number of test batches to run through scan. Can be combined with :try_count",
      type: Integer,
      is_string: false,
      default_value: 1,
      optional: true,
      verify_block: proc do |count|
        UI.user_error!("Error: Batch counts must be greater than zero") unless count > 0
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :retry_test_runner_failures,
      description: "Set to true If you want to treat build failures during testing, like 'Test runner exited before starting test execution', as 'all tests failed'",
      type: Boolean,
      default_value: false,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :invocation_based_tests,
      description: "Set to true If your test suit have invocation based tests like Kiwi",
      type: Boolean,
      is_string: false,
      default_value: false,
      optional: true,
      conflicting_options: [:batch_count],
      conflict_block: proc do |value|
        UI.user_error!(
          "Error: Can't use 'invocation_based_tests' and 'batch_count' options in one run, "\
          "because the number of tests is unknown")
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :swift_test_prefix,
      description: "The prefix used to find test methods. In standard XCTests, this is `test`. If you are using Quick with Swift, set this to `spec`",
      default_value: "test",
      optional: true,
      verify_block: proc do |swift_test_prefix|
        UI.user_error!("Error: swift_test_prefix must be non-nil and non-empty") if swift_test_prefix.nil? || swift_test_prefix.empty?
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :quit_simulators,
      env_name: "FL_MULTI_SCAN_QUIT_SIMULATORS",
      description: "If the simulators need to be killed before running the tests",
      type: Boolean,
      is_string: false,
      default_value: true,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :output_types,
      short_option: "-f",
      env_name: "SCAN_OUTPUT_TYPES",
      description: "Comma separated list of the output types (e.g. html, junit, json, json-compilation-database, xcresult)",
      default_value: "html,junit"
    ),
    FastlaneCore::ConfigItem.new(
      key: :collate_reports,
      description: "Whether or not to collate the reports generated by multiple retries, batches, and parallel test runs",
      default_value: true,
      is_string: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :parallel_testrun_count,
      description: 'Run simulators each batch of tests and/or each test target in parallel on its own Simulator',
      optional: true,
      is_string: false,
      default_value: 1,
      verify_block: proc do |count|
        UI.user_error!("Error: :parallel_testrun_count must be greater than zero") unless count > 0
        UI.important("Warning: the CoreSimulatorService may fail to connect to simulators if :parallel_testrun_count is greater than 6") if count > 6
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :pre_delete_cloned_simulators,
      description: 'Delete left over cloned simulators before running a parallel testrun',
      optional: true,
      is_string: false,
      default_value: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :testrun_completed_block,
      description: 'A block invoked each time a test run completes. When combined with :parallel_testrun_count, will be called separately in each child process',
      optional: true,
      is_string: false,
      default_value: nil,
      type: Proc
    )
  ]
end

.build_for_testing(scan_options) ⇒ Object



226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 226

def self.build_for_testing(scan_options)
  values = prepare_scan_options_for_build_for_testing(scan_options)
  ScanHelper.print_scan_parameters(values)

  remove_preexisting_xctestrun_files
  Scan::Runner.new.run
  update_xctestrun_after_build(scan_options)
  remove_build_report_files

  Scan.config._values.delete(:build_for_testing)
  scan_options[:derived_data_path] = Scan.config[:derived_data_path]
end

.categoryObject



576
577
578
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 576

def self.category
  :testing
end

.coerce_destination_to_array(params) ⇒ Object



75
76
77
78
79
80
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 75

def self.coerce_destination_to_array(params)
  destination = params[:destination] || Scan.config[:destination] || []
  unless destination.kind_of?(Array)
    params[:destination] = Scan.config[:destination] = [destination]
  end
end

.descriptionObject

:nocov:



313
314
315
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 313

def self.description
  "♻️ Uses scan to run Xcode tests a given number of times, with the option of batching and/or parallelizing them, only re-testing failing tests."
end

.detailsObject



317
318
319
320
321
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 317

def self.details
  "Use this action to run your tests if you have fragile tests that fail " \
  "sporadically, if you have a huge number of tests that should be " \
  "batched, or have multiple test targets and need meaningful junit reports."
end

.example_codeObject



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 445

def self.example_code
  [
    "
    UI.important(
      'example: ' \\
      'split the tests into 4 batches and run each batch of tests in ' \\
      'parallel up to 3 times if tests fail. Abort the testing early ' \\
      'if there are too many failing tests by passing in a ' \\
      ':testrun_completed_block that is called by :multi_scan ' \\
      'after each run of tests.'
    )
    test_run_block = lambda do |testrun_info|
      failed_test_count = testrun_info[:failed].size
      passed_test_count = testrun_info[:passing].size
      try_attempt = testrun_info[:try_count]
      batch = testrun_info[:batch]

      # UI.abort_with_message!('You could conditionally abort')
      UI.message(\"\\\u1F60A everything is fine, let's continue try \#{try_attempt + 1} for batch \#{batch}\")
    end

    multi_scan(
      project: File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj'),
      scheme: 'AtomicBoy',
      try_count: 3,
      batch_count: 4,
      fail_build: false,
      parallel_testrun_count: 4,
      testrun_completed_block: test_run_block
    )
    ",
    "
    UI.important(
      'example: ' \\
      'multi_scan also works with json.'
    )
    multi_scan(
      workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
      scheme: 'AtomicBoy',
      try_count: 3,
      output_types: 'json',
      output_files: 'report.json',
      fail_build: false
    )
    "
  ]
end

.force_quit_simulator_processesObject



303
304
305
306
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 303

def self.force_quit_simulator_processes
  # Silently execute and kill, verbose flags will show this command occurring
  Fastlane::Actions.sh("killall Simulator &> /dev/null || true", log: false)
end

.integration_testsObject



493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 493

def self.integration_tests
  [
    "
    UI.header('Basic test')
    multi_scan(
      workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
      scheme: 'AtomicBoy',
      fail_build: false,
      try_count: 2,
      disable_xcpretty: true
    )
    ",
    "
    UI.header('Basic test with 1 specific test')
    multi_scan(
      workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
      scheme: 'AtomicBoy',
      fail_build: false,
      try_count: 2,
      only_testing: ['AtomicBoyUITests/AtomicBoyUITests/testExample']
    )
    ",
    "
    UI.header('Basic test with test target expansion')
    multi_scan(
      workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
      scheme: 'AtomicBoy',
      fail_build: false,
      try_count: 2,
      only_testing: ['AtomicBoyUITests', 'AtomicBoyTests']
    )
    ",
    "
    UI.header('Parallel test run')
    multi_scan(
      workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
      scheme: 'AtomicBoy',
      fail_build: false,
      try_count: 2,
      parallel_testrun_count: 2
    )
    ",
    "
    UI.header('Parallel test run with fewer tests than parallel test runs')
    multi_scan(
      workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
      scheme: 'AtomicBoy',
      fail_build: false,
      try_count: 2,
      parallel_testrun_count: 4,
      only_testing: ['AtomicBoyUITests/AtomicBoyUITests/testExample']
    )
    ",
    "
    UI.header('Basic test with batches')
    multi_scan(
      workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
      scheme: 'AtomicBoy',
      fail_build: false,
      try_count: 2,
      batch_count: 2
    )
    ",
    "
    UI.header('Basic test with xcresult')
    multi_scan(
      workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
      scheme: 'AtomicBoy',
      output_types: 'xcresult',
      output_files: 'result.xcresult',
      collate_reports: false,
      fail_build: false,
      try_count: 2,
      batch_count: 2
    )
    "
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


580
581
582
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 580

def self.is_supported?(platform)
  i[ios mac].include?(platform)
end

.prepare_for_testing(scan_options) ⇒ Object



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 169

def self.prepare_for_testing(scan_options)
  reset_scan_config_to_defaults
  use_scanfile_to_override_settings(scan_options)
  turn_off_concurrent_workers(scan_options)
  UI.important("Turning off :skip_build as it doesn't do anything with multi_scan") if scan_options[:skip_build]
  if scan_options[:disable_xcpretty]
    UI.important("Turning off :disable_xcpretty as xcpretty is needed to generate junit reports for retrying failed tests")
  end
  scan_options.reject! { |k,v| i[skip_build disable_xcpretty].include?(k) }
  ScanHelper.remove_preexisting_simulator_logs(scan_options)
  if scan_options[:test_without_building]
    UI.verbose("Preparing Scan config options for multi_scan testing")
    prepare_scan_config(scan_options)
  else
    UI.verbose("Building the project in preparation for multi_scan testing")
    build_for_testing(scan_options)
  end
end

.prepare_scan_config(scan_options) ⇒ Object



219
220
221
222
223
224
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 219

def self.prepare_scan_config(scan_options)
  Scan.config ||= FastlaneCore::Configuration.create(
    Fastlane::Actions::ScanAction.available_options,
    ScanHelper.scan_options_from_multi_scan_options(scan_options)
  )
end

.prepare_scan_options_for_build_for_testing(scan_options) ⇒ Object



258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 258

def self.prepare_scan_options_for_build_for_testing(scan_options)
  build_options = scan_options.merge(build_for_testing: true).reject { |k| i[test_without_building testplan include_simulator_logs].include?(k) }
  remove_xcresult_from_build_options(build_options)
  Scan.config = FastlaneCore::Configuration.create(
    Fastlane::Actions::ScanAction.available_options,
    ScanHelper.scan_options_from_multi_scan_options(build_options).merge(include_simulator_logs: false)
  )
  values = Scan.config.values(ask: false)
  values[:xcode_path] = File.expand_path("../..", FastlaneCore::Helper.xcode_path)
  Scan.config._values.delete(:result_bundle)
  values
end


82
83
84
85
86
87
88
89
90
91
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 82

def self.print_multi_scan_parameters(params)
  return if Helper.test?
  # :nocov:
  scan_keys = Fastlane::Actions::ScanAction.available_options.map(&:key)
  FastlaneCore::PrintTable.print_values(
    config: params._values.reject { |k, _| scan_keys.include?(k) },
    title: "Summary for multi_scan (test_center v#{Fastlane::TestCenter::VERSION})"
  )
  # :nocov:
end


93
94
95
96
97
98
99
100
101
102
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 93

def self.print_run_summary(summary)
  return if Helper.test?

  # :nocov:
  FastlaneCore::PrintTable.print_values(
    config: summary,
    title: "multi_scan results"
  )
  # :nocov:
end

.remove_build_report_filesObject



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 287

def self.remove_build_report_files
  # When Scan builds, it generates empty report files. Trying to collate
  # subsequent, valid, report files with the empty report file will fail
  # because there is no shared XML elements
  report_options = Scan::XCPrettyReporterOptionsGenerator.generate_from_scan_config
  output_files = report_options.instance_variable_get(:@output_files)
  output_directory = report_options.instance_variable_get(:@output_directory)

  UI.verbose("Removing report files generated by the build")
  output_files.each do |output_file|
    report_file = File.join(output_directory, output_file)
    UI.verbose("  #{report_file}")
    FileUtils.rm_f(report_file)
  end
end

.remove_preexisting_xctestrun_filesObject



281
282
283
284
285
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 281

def self.remove_preexisting_xctestrun_files
  xctestrun_files = Dir.glob("#{Scan.config[:derived_data_path]}/Build/Products/*.xctestrun")
  UI.verbose("Before building, removing pre-existing xctestrun files: #{xctestrun_files}")
  FileUtils.rm_rf(xctestrun_files)
end

.remove_xcresult_from_build_options(build_options) ⇒ Object



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 239

def self.remove_xcresult_from_build_options(build_options)
  # convert the :output_types comma separated string of types into an array with no whitespace
  output_types = build_options[:output_types].to_s.split(',').map(&:strip)
  xcresult_index = output_types.index('xcresult')

  unless xcresult_index.nil?
    output_types.delete_at(xcresult_index)
    # set :output_types value to comma separated string of remaining output types
    build_options[:output_types] = output_types.join(',')

    if build_options[:output_files] # not always set
      output_files = build_options[:output_files].split(',').map(&:strip)
      output_files.delete_at(xcresult_index)

      build_options[:output_files] = output_files.join(',')
    end
  end
end

.reset_scan_config_to_defaultsObject



194
195
196
197
198
199
200
201
202
203
204
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 194

def self.reset_scan_config_to_defaults
  return unless Scan.config

  defaults = Hash[Fastlane::Actions::ScanAction.available_options.map { |i| [i.key, i.default_value] }]
  FastlaneCore::UI.verbose("MultiScanAction resetting Scan config to defaults")
  defaults.delete(:destination)

  Scan.config._values.each do |k,v|
    Scan.config.set(k, defaults[k]) if defaults.key?(k)
  end
end

.return_valueObject



323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 323

def self.return_value
  "Returns a Hash with the following value-key pairs:\n" \
  "- result: true if the final result of running the tests resulted in " \
  "passed tests. false if there was one or more tests that failed, even " \
  "after retrying them :try_count times.\n" \
  "- total_tests: the total number of tests visited.\n" \
  "- passing_testcount: the number of tests that passed.\n" \
  "- failed_testcount: the number of tests that failed, even after retrying them.\n" \
  "- failed_tests: an array of the test identifers that failed.\n" \
  "- total_retry_count: the total number of times a test 'run' was retried.\n" \
  "- report_files: the list of junit report files generated by multi_scan."
end

.run(params) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 15

def self.run(params)
  params[:quit_simulators] = params._values[:force_quit_simulator] if params._values[:force_quit_simulator]
  if params[:try_count] < 1
    UI.important('multi_scan will not test any if :try_count < 0, setting to 1')
    params[:try_count] = 1
  end

  strip_leading_and_trailing_whitespace_from_output_types(params)

  warn_of_xcode11_result_bundle_incompatability(params)
  warn_of_parallelism_with_circle_ci(params)

  print_multi_scan_parameters(params)
  force_quit_simulator_processes if params[:quit_simulators]

  prepare_for_testing(params.values)

  coerce_destination_to_array(params)
  platform = :mac
  platform = :ios_simulator if Scan.config[:destination].any? { |d| d.include?('platform=iOS Simulator') }

  runner_options = params.values.merge(platform: platform)
  runner = ::TestCenter::Helper::MultiScanManager::Runner.new(runner_options)
  tests_passed = runner.run

  summary = run_summary(params, tests_passed)
  print_run_summary(summary)

  if params[:fail_build] && !tests_passed
    raise UI.test_failure!('Tests have failed')
  end
  summary
end

.run_summary(scan_options, tests_passed) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 104

def self.run_summary(scan_options, tests_passed)
  scan_options = scan_options.clone

  if scan_options[:result_bundle]
    updated_output_types, updated_output_files = ::TestCenter::Helper::ReportNameHelper.ensure_output_includes_xcresult(
      scan_options[:output_types],
      scan_options[:output_files]
    )
    scan_options[:output_types] = updated_output_types
    scan_options[:output_files] = updated_output_files
  end
  reportnamer = ::TestCenter::Helper::ReportNameHelper.new(
    scan_options[:output_types],
    scan_options[:output_files],
    scan_options[:custom_report_file_name]
  )
  passing_testcount = 0
  failed_tests = []
  failure_details = {}
  report_files = Dir.glob("#{scan_options[:output_directory]}/**/#{reportnamer.junit_fileglob}").map do |relative_filepath|
    File.absolute_path(relative_filepath)
  end
  retry_total_count = 0
  report_files.each do |report_file|
    junit_results = other_action.tests_from_junit(junit: report_file)
    failed_tests.concat(junit_results[:failed])
    passing_testcount += junit_results[:passing].size
    failure_details.merge!(junit_results[:failure_details])

    report = REXML::Document.new(File.new(report_file))
    retry_total_count += (report.root.attribute('retries')&.value || 1).to_i
  end

  if reportnamer.includes_html?
    report_files += Dir.glob("#{scan_options[:output_directory]}/**/#{reportnamer.html_fileglob}").map do |relative_filepath|
      File.absolute_path(relative_filepath)
    end
  end
  if reportnamer.includes_json?
    report_files += Dir.glob("#{scan_options[:output_directory]}/**/#{reportnamer.json_fileglob}").map do |relative_filepath|
      File.absolute_path(relative_filepath)
    end
  end
  if scan_options[:result_bundle]
    report_files += Dir.glob("#{scan_options[:output_directory]}/**/*.test_result").map do |relative_test_result_bundle_filepath|
      File.absolute_path(relative_test_result_bundle_filepath)
    end
  end
  if reportnamer.includes_xcresult?
    report_files += Dir.glob("#{scan_options[:output_directory]}/**/#{reportnamer.xcresult_fileglob}").map do |relative_bundlepath|
      File.absolute_path(relative_bundlepath)
    end
  end
  {
    result: tests_passed,
    total_tests: passing_testcount + failed_tests.size,
    passing_testcount: passing_testcount,
    failed_testcount: failed_tests.size,
    failed_tests: failed_tests,
    failure_details: failure_details,
    total_retry_count: retry_total_count,
    report_files: report_files
  }
end

.scan_optionsObject



336
337
338
339
340
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 336

def self.scan_options
  # multi_scan has its own enhanced version of `output_types` and we want to provide
  # the help and validation for that new version.
  ScanAction.available_options.reject { |config| i[output_types].include?(config.key) }
end

.strip_leading_and_trailing_whitespace_from_output_types(params) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 56

def self.strip_leading_and_trailing_whitespace_from_output_types(params)
  if params[:output_types]
    params[:output_types] = params[:output_types].split(',').map(&:strip).join(',')
  end
  if params[:output_files]
    params[:output_files] = params[:output_files].split(',').map(&:strip).join(',')
  end
end

.turn_off_concurrent_workers(scan_options) ⇒ Object



188
189
190
191
192
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 188

def self.turn_off_concurrent_workers(scan_options)
  if Gem::Version.new(Fastlane::VERSION) >= Gem::Version.new('2.142.0')
    scan_options.delete(:concurrent_workers) if scan_options[:concurrent_workers].to_i > 0
  end
end

.update_xctestrun_after_build(scan_options) ⇒ Object



271
272
273
274
275
276
277
278
279
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 271

def self.update_xctestrun_after_build(scan_options)
  glob_pattern = "#{Scan.config[:derived_data_path]}/Build/Products/*.xctestrun"
  if scan_options[:testplan]
    glob_pattern = "#{Scan.config[:derived_data_path]}/Build/Products/*_#{scan_options[:testplan]}_*.xctestrun"
  end
  xctestrun_files = Dir.glob(glob_pattern)
  UI.verbose("After building, found xctestrun files #{xctestrun_files} (choosing 1st)")
  scan_options[:xctestrun] = xctestrun_files.first
end

.use_scanfile_to_override_settings(scan_options) ⇒ Object



206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 206

def self.use_scanfile_to_override_settings(scan_options)
  overridden_options = ScanHelper.options_from_configuration_file(
    ScanHelper.scan_options_from_multi_scan_options(scan_options)
  )

  unless overridden_options.empty?
    FastlaneCore::UI.important("Scanfile found: overriding multi_scan options with it's values.")
    overridden_options.each do |k,v|
      scan_options[k] = v
    end
  end
end

.warn_of_parallelism_with_circle_ci(params) ⇒ Object



49
50
51
52
53
54
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 49

def self.warn_of_parallelism_with_circle_ci(params)
  if params[:parallel_testrun_count] > 1 && Helper.is_circle_ci?
    UI.important("Warning: problems have occurreed when running parallel simulators on Circle CI.")
    UI.message("  See https://github.com/lyndsey-ferguson/fastlane-plugin-test_center/issues/179")
  end
end

.warn_of_xcode11_result_bundle_incompatability(params) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/fastlane/plugin/test_center/actions/multi_scan.rb', line 65

def self.warn_of_xcode11_result_bundle_incompatability(params)
  if FastlaneCore::Helper.xcode_at_least?('11.0.0')
    if params[:result_bundle]
      UI.important('As of Xcode 11, test_result bundles created in the output directory are actually symbolic links to an xcresult bundle')
    end
  elsif params[:output_types]&.include?('xcresult')
    UI.important("The 'xcresult' :output_type is only supported for Xcode 11 and greater. You are using #{FastlaneCore::Helper.xcode_version}.")
  end
end