fastlane-plugin-test_center 3.14.4 → 3.14.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4364b9e3e49e3aa1a3bbd1e26feb07e449de72900bcd1ec3341ff8d1b0ca62ad
4
- data.tar.gz: f983745b33c34838839d546aff4c4e407673c8241e72ab14b695d288792bdac4
3
+ metadata.gz: 513eae983cc2a800cbfe418da79a22bbff3a89aa7511e3a76ea84e9c2a241df3
4
+ data.tar.gz: 0f0d063b2c0a2fb8276e8a7186a0726008fe28e50c1354d1c36c91810bad674b
5
5
  SHA512:
6
- metadata.gz: 1bb52a9bcc82781df58b2ab2b6dd33c1831da0b345b9b51842959b8a372e5341b773cf639e3cb884bccc426336dad01c8ff1e7fc418fad0baefe201e12c46bab
7
- data.tar.gz: 8d6e6a9321e13aada993f1099f45b7317f4d4c30e8bbdfa55a35a49a1a0dd3aa6c7e06c7dd244132e37d4c149ac0a6b9f94d9198d3f0bd8ee912853fa44f773d
6
+ metadata.gz: cab19007a6dd5782e59641d1ef22d5d0dd5a942b58be2c5a6e9129ddb41117b06ac6a93c60a778707b1ea6a45d99c4b05fd83774835903bc451443ed79177181
7
+ data.tar.gz: a09815bbfb934d8295972eaa10033ad9115039d56060bb85732d60feb56ef713dce449bc7de202393f7a2392234ea7562f67ffcbc53ef17f457ff0da39bb1ca2
@@ -28,16 +28,23 @@ module Fastlane
28
28
  force_quit_simulator_processes if params[:quit_simulators]
29
29
 
30
30
  prepare_for_testing(params.values)
31
+
32
+ tests_passed = true
33
+ summary = {}
34
+ if params[:build_for_testing]
35
+ summary = build_summary
36
+ else
37
+ coerce_destination_to_array(params)
38
+ platform = :mac
39
+ platform = :ios_simulator if Scan.config[:destination].any? { |d| d.include?('platform=iOS Simulator') }
31
40
 
32
- coerce_destination_to_array(params)
33
- platform = :mac
34
- platform = :ios_simulator if Scan.config[:destination].any? { |d| d.include?('platform=iOS Simulator') }
41
+ runner_options = params.values.merge(platform: platform)
42
+ runner = ::TestCenter::Helper::MultiScanManager::Runner.new(runner_options)
43
+ tests_passed = runner.run
35
44
 
36
- runner_options = params.values.merge(platform: platform)
37
- runner = ::TestCenter::Helper::MultiScanManager::Runner.new(runner_options)
38
- tests_passed = runner.run
45
+ summary = run_summary(params, tests_passed)
46
+ end
39
47
 
40
- summary = run_summary(params, tests_passed)
41
48
  print_run_summary(summary)
42
49
 
43
50
  if params[:fail_build] && !tests_passed
@@ -101,6 +108,16 @@ module Fastlane
101
108
  # :nocov:
102
109
  end
103
110
 
111
+ def self.build_summary
112
+ {
113
+ result: true,
114
+ total_tests: 0,
115
+ passing_testcount: 0,
116
+ failed_testcount: 0,
117
+ total_retry_count: 0
118
+ }
119
+ end
120
+
104
121
  def self.run_summary(scan_options, tests_passed)
105
122
  scan_options = scan_options.clone
106
123
 
@@ -41,6 +41,7 @@ module TestCenter
41
41
  def setup_logcollection
42
42
  FastlaneCore::UI.verbose("> setup_logcollection")
43
43
  return unless @options[:include_simulator_logs]
44
+ return unless @options[:platform] == :ios_simulator
44
45
  return if Scan::Runner.method_defined?(:prelaunch_simulators)
45
46
 
46
47
  # We need to prelaunch the simulators so xcodebuild
@@ -89,16 +90,46 @@ module TestCenter
89
90
  remove_preexisting_test_result_bundles
90
91
  remote_preexisting_xcresult_bundles
91
92
 
92
- tests_passed = false
93
+ test_results = [false]
93
94
  if should_run_tests_through_single_try?
94
- tests_passed = run_tests_through_single_try
95
+ test_results.clear
96
+ setup_run_tests_for_each_device do |device_name|
97
+ FastlaneCore::UI.message("Single try testing for device '#{device_name}'")
98
+ test_results << run_tests_through_single_try
99
+ end
95
100
  end
96
101
 
97
- unless tests_passed || @options[:try_count] < 1
102
+ unless test_results.all? || @options[:try_count] < 1
103
+ test_results.clear
98
104
  setup_testcollector
99
- tests_passed = run_test_batches
105
+ setup_run_tests_for_each_device do |device_name|
106
+ FastlaneCore::UI.message("Testing batches for device '#{device_name}'")
107
+ test_results << run_test_batches
108
+ end
100
109
  end
101
- tests_passed
110
+ test_results.all?
111
+ end
112
+
113
+ def setup_run_tests_for_each_device
114
+ original_output_directory = @options.fetch(:output_directory, 'test_results')
115
+ scan_destinations = Scan.config[:destination].clone
116
+ try_count = @options[:try_count]
117
+
118
+ scan_destinations.each_with_index do |destination, device_index|
119
+ @options[:try_count] = try_count
120
+ device_udid_match = destination.match(/id=(?<udid>[^,]+)/)
121
+ device_udid = device_udid_match[:udid] if device_udid_match
122
+ if scan_destinations.size > 1
123
+ @options[:output_directory] = File.join(original_output_directory, device_udid)
124
+ Scan.config[:destination].replace([destination])
125
+ end
126
+ command = "xcrun simctl list devices | grep #{device_udid}"
127
+ device_info = Fastlane::Actions.sh(command, log: false)
128
+
129
+ yield device_info.strip.gsub(/ \(#{device_udid}.*/, '')
130
+ end
131
+ Scan.config[:destination].replace(scan_destinations)
132
+ @options[:output_directory] = original_output_directory
102
133
  end
103
134
 
104
135
  def should_run_tests_through_single_try?
@@ -63,7 +63,9 @@ module TestCenter
63
63
  def parallel_scan_options(worker_index)
64
64
  options = @options.reject { |key| %i[device devices].include?(key) }
65
65
  options[:destination] = destination_for_worker(worker_index)
66
- options[:scan_devices_override] = simulator_devices_for_worker(worker_index)
66
+ if @options[:platform] == :ios_simulator
67
+ options[:scan_devices_override] = simulator_devices_for_worker(worker_index)
68
+ end
67
69
  options[:buildlog_path] = buildlog_path_for_worker(worker_index) if @options[:buildlog_path]
68
70
  options[:derived_data_path] = derived_data_path_for_worker(worker_index)
69
71
  options[:batch_index] = worker_index
@@ -89,6 +91,12 @@ module TestCenter
89
91
  clones.flatten.each(&:delete)
90
92
  end
91
93
 
94
+ def shutdown_cloned_simulators(clones)
95
+ return if clones.nil?
96
+
97
+ clones.flatten.each(&:shutdown)
98
+ end
99
+
92
100
  def setup_serial_workers
93
101
  serial_scan_options = @options.reject { |key| %i[device devices].include?(key) }
94
102
  serial_scan_options[:destination] ||= Scan&.config&.fetch(:destination)
@@ -125,6 +133,7 @@ module TestCenter
125
133
  busy_workers.map(&:pid).each do |pid|
126
134
  Process.wait(pid)
127
135
  end
136
+ shutdown_cloned_simulators(@clones)
128
137
  busy_workers.each { |w| w.process_results }
129
138
  end
130
139
  end
@@ -116,9 +116,9 @@ module TestCenter
116
116
  # with their own testCases.
117
117
  if all_known_tests[testable].to_a.empty?
118
118
  FastlaneCore::UI.verbose("Unable to expand #{testable} to constituent tests")
119
- expand_test_identifiers = [testable]
119
+ expanded_test_identifiers = [testable]
120
120
  else
121
- expand_test_identifiers = all_known_tests[testable]
121
+ expanded_test_identifiers = all_known_tests[testable]
122
122
  end
123
123
  else
124
124
  # this is a testable and a test suite, let's expand it out to all of
@@ -131,7 +131,7 @@ module TestCenter
131
131
  end
132
132
  end
133
133
  test_identifiers.delete_at(index)
134
- test_identifiers.insert(index, *expand_test_identifiers)
134
+ test_identifiers.insert(index, *expanded_test_identifiers)
135
135
  end
136
136
  end
137
137
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TestCenter
3
- VERSION = "3.14.4"
3
+ VERSION = "3.14.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-test_center
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.14.4
4
+ version: 3.14.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-05 00:00:00.000000000 Z
11
+ date: 2020-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json