fastlane-plugin-test_center 3.7.0.parallelizing.alpha.4 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fastlane/plugin/test_center.rb +1 -1
  3. data/lib/fastlane/plugin/test_center/actions/collate_test_result_bundles.rb +1 -1
  4. data/lib/fastlane/plugin/test_center/actions/multi_scan.rb +34 -89
  5. data/lib/fastlane/plugin/test_center/helper/correcting_scan_helper.rb +315 -0
  6. data/lib/fastlane/plugin/test_center/helper/reportname_helper.rb +6 -15
  7. data/lib/fastlane/plugin/test_center/helper/test_collector.rb +11 -48
  8. data/lib/fastlane/plugin/test_center/version.rb +1 -1
  9. metadata +11 -24
  10. data/lib/fastlane/plugin/test_center/actions/restart_core_simulator_service.rb +0 -38
  11. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager.rb +0 -5
  12. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/device_manager.rb +0 -30
  13. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/interstitial.rb +0 -143
  14. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/parallel_test_batch_worker.rb +0 -27
  15. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/report_collator.rb +0 -115
  16. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan.rb +0 -74
  17. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan_helper.rb +0 -255
  18. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb +0 -356
  19. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb +0 -49
  20. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_manager.rb +0 -317
  21. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/test_batch_worker.rb +0 -20
  22. data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/test_batch_worker_pool.rb +0 -129
  23. data/lib/fastlane/plugin/test_center/helper/xctestrun_info.rb +0 -42
@@ -64,12 +64,9 @@ module TestCenter
64
64
  numbered_filename(@output_files.to_s.split(',')[junit_index])
65
65
  end
66
66
 
67
- def junit_reportname(suffix = '')
67
+ def junit_reportname
68
68
  junit_index = @output_types.split(',').find_index('junit')
69
- report_name = @output_files.to_s.split(',')[junit_index]
70
- return report_name if suffix.empty?
71
-
72
- "#{File.basename(report_name, '.*')}-#{suffix}#{junit_filextension}"
69
+ @output_files.to_s.split(',')[junit_index]
73
70
  end
74
71
 
75
72
  def junit_filextension
@@ -93,12 +90,9 @@ module TestCenter
93
90
  numbered_filename(@output_files.to_s.split(',')[html_index])
94
91
  end
95
92
 
96
- def html_reportname(suffix = '')
93
+ def html_reportname
97
94
  html_index = @output_types.split(',').find_index('html')
98
- report_name = @output_files.to_s.split(',')[html_index]
99
- return report_name if suffix.empty?
100
-
101
- "#{File.basename(report_name, '.*')}-#{suffix}#{html_filextension}"
95
+ @output_files.to_s.split(',')[html_index]
102
96
  end
103
97
 
104
98
  def html_filextension
@@ -122,12 +116,9 @@ module TestCenter
122
116
  numbered_filename(@output_files.to_s.split(',')[json_index])
123
117
  end
124
118
 
125
- def json_reportname(suffix = '')
119
+ def json_reportname
126
120
  json_index = @output_types.split(',').find_index('json')
127
- report_name = @output_files.to_s.split(',')[json_index]
128
- return report_name if suffix.empty?
129
-
130
- "#{File.basename(report_name, '.*')}-#{suffix}#{json_filextension}"
121
+ @output_files.to_s.split(',')[json_index]
131
122
  end
132
123
 
133
124
  def json_filextension
@@ -5,8 +5,6 @@ module TestCenter
5
5
  require 'plist'
6
6
 
7
7
  class TestCollector
8
- attr_reader :xctestrun_path
9
-
10
8
  def initialize(options)
11
9
  unless options[:xctestrun] || options[:derived_data_path]
12
10
  options[:derived_data_path] = default_derived_data_path(options)
@@ -17,12 +15,10 @@ module TestCenter
17
15
  end
18
16
  @only_testing = options[:only_testing]
19
17
  @skip_testing = options[:skip_testing]
20
- @batch_count = options[:batch_count]
18
+ @invocation_based_tests = options[:invocation_based_tests]
21
19
  end
22
20
 
23
21
  def default_derived_data_path(options)
24
- # TODO: investigate if this is needed. I believe it should already have
25
- # been set in multi_scan
26
22
  Scan.project = FastlaneCore::Project.new(
27
23
  options.select { |k, v| %i[workspace project].include?(k) }
28
24
  )
@@ -39,8 +35,8 @@ module TestCenter
39
35
  if @only_testing
40
36
  @testables ||= only_testing_to_testables_tests.keys
41
37
  else
42
- @testables ||= Plist.parse_xml(@xctestrun_path).keys.reject do |key|
43
- key == '__xctestrun_metadata__'
38
+ @testables ||= Plist.parse_xml(@xctestrun_path).keys.reject do |retrievedTestable|
39
+ Fastlane::Actions::TestsFromXctestrunAction.ignoredTestables.include?(retrievedTestable)
44
40
  end
45
41
  end
46
42
  end
@@ -56,30 +52,19 @@ module TestCenter
56
52
  tests
57
53
  end
58
54
 
59
- def xctestrun_known_tests
60
- config = FastlaneCore::Configuration.create(::Fastlane::Actions::TestsFromXctestrunAction.available_options, xctestrun: @xctestrun_path)
61
- ::Fastlane::Actions::TestsFromXctestrunAction.run(config)
62
- end
63
-
64
55
  def testables_tests
65
56
  unless @testables_tests
66
57
  if @only_testing
67
- known_tests = nil
68
58
  @testables_tests = only_testing_to_testables_tests
69
-
70
- @testables_tests.each do |testable, tests|
71
- tests.each_with_index do |test, index|
72
- if test.count('/') < 2
73
- known_tests ||= xctestrun_known_tests[testable]
74
- test_components = test.split('/')
75
- testsuite = test_components.size == 1 ? test_components[0] : test_components[1]
76
- @testables_tests[testable][index] = known_tests.select { |known_test| known_test.include?(testsuite) }
77
- end
78
- end
79
- @testables_tests[testable].flatten!
80
- end
81
59
  else
82
- @testables_tests = xctestrun_known_tests
60
+ config = FastlaneCore::Configuration.create(
61
+ ::Fastlane::Actions::TestsFromXctestrunAction.available_options,
62
+ {
63
+ xctestrun: @xctestrun_path,
64
+ invocation_based_tests: @invocation_based_tests
65
+ }
66
+ )
67
+ @testables_tests = ::Fastlane::Actions::TestsFromXctestrunAction.run(config)
83
68
  if @skip_testing
84
69
  skipped_testable_tests = Hash.new { |h, k| h[k] = [] }
85
70
  @skip_testing.sort.each do |skipped_test_identifier|
@@ -92,30 +77,8 @@ module TestCenter
92
77
  end
93
78
  end
94
79
  end
95
-
96
80
  @testables_tests
97
81
  end
98
-
99
- def test_batches
100
- if @batches.nil?
101
- @batches = []
102
- testables.each do |testable|
103
- testable_tests = testables_tests[testable]
104
- next if testable_tests.empty?
105
-
106
- if @batch_count > 1
107
- slice_count = [(testable_tests.length / @batch_count.to_f).ceil, 1].max
108
- testable_tests.each_slice(slice_count).to_a.each do |tests_batch|
109
- @batches << tests_batch
110
- end
111
- else
112
- @batches << testable_tests
113
- end
114
- end
115
- end
116
-
117
- @batches
118
- end
119
82
  end
120
83
  end
121
84
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TestCenter
3
- VERSION = "3.7.0.parallelizing.alpha.4"
3
+ VERSION = "3.7.0"
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.7.0.parallelizing.alpha.4
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-12 00:00:00.000000000 Z
11
+ date: 2019-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -67,13 +67,13 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.1.7
69
69
  - !ruby/object:Gem::Dependency
70
- name: colorize
70
+ name: cocoapods
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
- type: :runtime
76
+ type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: cocoapods
84
+ name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: bundler
98
+ name: colorize
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 2.108.0
117
+ version: 2.56.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 2.108.0
124
+ version: 2.56.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: pry
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -249,29 +249,16 @@ files:
249
249
  - lib/fastlane/plugin/test_center/actions/collate_junit_reports.rb
250
250
  - lib/fastlane/plugin/test_center/actions/collate_test_result_bundles.rb
251
251
  - lib/fastlane/plugin/test_center/actions/multi_scan.rb
252
- - lib/fastlane/plugin/test_center/actions/restart_core_simulator_service.rb
253
252
  - lib/fastlane/plugin/test_center/actions/suppress_tests.rb
254
253
  - lib/fastlane/plugin/test_center/actions/suppress_tests_from_junit.rb
255
254
  - lib/fastlane/plugin/test_center/actions/suppressed_tests.rb
256
255
  - lib/fastlane/plugin/test_center/actions/tests_from_junit.rb
257
256
  - lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb
257
+ - lib/fastlane/plugin/test_center/helper/correcting_scan_helper.rb
258
258
  - lib/fastlane/plugin/test_center/helper/junit_helper.rb
259
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager.rb
260
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/device_manager.rb
261
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/interstitial.rb
262
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/parallel_test_batch_worker.rb
263
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/report_collator.rb
264
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan.rb
265
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan_helper.rb
266
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb
267
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb
268
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_manager.rb
269
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/test_batch_worker.rb
270
- - lib/fastlane/plugin/test_center/helper/multi_scan_manager/test_batch_worker_pool.rb
271
259
  - lib/fastlane/plugin/test_center/helper/reportname_helper.rb
272
260
  - lib/fastlane/plugin/test_center/helper/test_collector.rb
273
261
  - lib/fastlane/plugin/test_center/helper/xcodebuild_string.rb
274
- - lib/fastlane/plugin/test_center/helper/xctestrun_info.rb
275
262
  - lib/fastlane/plugin/test_center/version.rb
276
263
  homepage: https://github.com/lyndsey-ferguson/fastlane-plugin-test_center
277
264
  licenses:
@@ -288,9 +275,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
288
275
  version: '0'
289
276
  required_rubygems_version: !ruby/object:Gem::Requirement
290
277
  requirements:
291
- - - ">"
278
+ - - ">="
292
279
  - !ruby/object:Gem::Version
293
- version: 1.3.1
280
+ version: '0'
294
281
  requirements: []
295
282
  rubyforge_project:
296
283
  rubygems_version: 2.6.11
@@ -1,38 +0,0 @@
1
- module Fastlane
2
- module Actions
3
- class QuitCoreSimulatorServiceAction < Action
4
- def self.run(params)
5
- launchctl_list_count = 0
6
- commands = []
7
- while Actions.sh('launchctl list | grep com.apple.CoreSimulator.CoreSimulatorService || true', log: false) != ''
8
- UI.crash!('Unable to quit com.apple.CoreSimulator.CoreSimulatorService after 10 tries') if (launchctl_list_count += 1) > 10
9
- commands << Actions.sh('launchctl remove com.apple.CoreSimulator.CoreSimulatorService &> /dev/null || true', log: false)
10
- UI.verbose('Waiting for com.apple.CoreSimulator.CoreSimulatorService to quit')
11
- sleep(0.5)
12
- end
13
- commands
14
- end
15
-
16
- #####################################################
17
- # @!group Documentation
18
- #####################################################
19
-
20
- def self.description
21
- "Force-quits the com.apple.CoreSimulator.CoreSimulatorService."
22
- end
23
-
24
- def self.details
25
- "Sometimes the com.apple.CoreSimulator.CoreSimulatorService can hang. " \
26
- "Use this action to force-quit it."
27
- end
28
-
29
- def self.authors
30
- ["lyndsey-ferguson/@lyndseydf"]
31
- end
32
-
33
- def self.is_supported?(platform)
34
- platform == :ios
35
- end
36
- end
37
- end
38
- end
@@ -1,5 +0,0 @@
1
- require_relative 'multi_scan_manager/interstitial'
2
- require_relative 'multi_scan_manager/report_collator'
3
- require_relative 'multi_scan_manager/simulator_manager'
4
- require_relative 'multi_scan_manager/runner'
5
- require_relative 'xctestrun_info'
@@ -1,30 +0,0 @@
1
- module FastlaneCore
2
- class DeviceManager
3
- class Device
4
- def clone
5
- raise 'Can only clone iOS Simulators' unless self.is_simulator
6
- Device.new(
7
- name: self.name,
8
- udid: `xcrun simctl clone #{self.udid} '#{self.name}'`.chomp,
9
- os_type: self.os_type,
10
- os_version: self.os_version,
11
- state: self.state,
12
- is_simulator: self.is_simulator
13
- )
14
- end
15
-
16
- def rename(newname)
17
- `xcrun simctl rename #{self.udid} '#{newname}'`
18
- self.name = newname
19
- end
20
-
21
- def boot
22
- `xcrun simctl boot #{self.udid}`
23
- end
24
-
25
- def shutdown
26
- `xcrun simctl shutdown #{self.udid}` unless self.state == "Shutdown"
27
- end
28
- end
29
- end
30
- end
@@ -1,143 +0,0 @@
1
- module TestCenter
2
- module Helper
3
- module MultiScanManager
4
- class Interstitial
5
-
6
- attr_writer :output_directory
7
- attr_writer :batch
8
-
9
- def initialize(options)
10
- @output_directory = options[:output_directory]
11
- @testrun_completed_block = options[:testrun_completed_block]
12
- @result_bundle = options[:result_bundle]
13
- @scheme = options[:scheme]
14
- @batch = options[:batch]
15
- @reportnamer = options[:reportnamer]
16
- @xcpretty_json_file_output = ENV['XCPRETTY_JSON_FILE_OUTPUT']
17
- @parallelize = options[:parallelize]
18
-
19
- before_all
20
- end
21
-
22
- # TODO: Should we be creating a new interstitial for each batch? yes.
23
- # Should we clear out the result bundles before each batch? --> should
24
- # it not be done before all batches? Same with env var for json resports.
25
- def before_all
26
- if @result_bundle
27
- remove_preexisting_test_result_bundles
28
- end
29
- set_json_env_if_necessary
30
- if @parallelize
31
- @original_derived_data_path = ENV['SCAN_DERIVED_DATA_PATH']
32
- FileUtils.mkdir_p(@output_directory)
33
- ENV['SCAN_DERIVED_DATA_PATH'] = Dir.mktmpdir(nil, @output_directory)
34
- end
35
- end
36
-
37
- def after_all
38
- FastlaneCore::UI.message("resetting JSON ENV var to #{@xcpretty_json_file_output}")
39
- ENV['XCPRETTY_JSON_FILE_OUTPUT'] = @xcpretty_json_file_output
40
- if @parallelize
41
- ENV['SCAN_DERIVED_DATA_PATH'] = @original_derived_data_path
42
- end
43
- end
44
-
45
- def remove_preexisting_test_result_bundles
46
- glob_pattern = "#{@output_directory}/.*\.test_result"
47
- preexisting_test_result_bundles = Dir.glob(glob_pattern)
48
- FileUtils.rm_rf(preexisting_test_result_bundles)
49
- end
50
-
51
- def move_test_result_bundle_for_next_run
52
- if @result_bundle
53
- built_test_result, moved_test_result = test_result_bundlepaths
54
- FileUtils.mv(built_test_result, moved_test_result)
55
- end
56
- end
57
-
58
- def test_result_bundlepaths
59
- [
60
- File.join(@output_directory, @scheme) + '.test_result',
61
- File.join(@output_directory, @scheme) + "_#{@reportnamer.report_count}.test_result"
62
- ]
63
- end
64
-
65
- def reset_simulators
66
- destinations = Scan.config[:destination]
67
- simulators = FastlaneCore::DeviceManager.simulators('iOS')
68
- simulator_ids_to_reset = []
69
- destinations.each do |destination|
70
- destination.split(',').each do |destination_pair|
71
- key, value = destination_pair.split('=')
72
- if key == 'id'
73
- simulator_ids_to_reset << value
74
- end
75
- end
76
- end
77
- simulators_to_reset = simulators.each.select { |simulator| simulator_ids_to_reset.include?(simulator.udid) }
78
- simulators_to_reset.each do |simulator|
79
- simulator.reset
80
- end
81
- end
82
-
83
- def send_info_for_try(try_count)
84
- puts "in send_info_for_try for #{@batch}"
85
- return unless @testrun_completed_block
86
-
87
- report_filepath = File.join(@output_directory, @reportnamer.junit_last_reportname)
88
-
89
- config = FastlaneCore::Configuration.create(
90
- Fastlane::Actions::TestsFromJunitAction.available_options,
91
- {
92
- junit: File.absolute_path(report_filepath)
93
- }
94
- )
95
- junit_results = Fastlane::Actions::TestsFromJunitAction.run(config)
96
- info = {
97
- failed: junit_results[:failed],
98
- passing: junit_results[:passing],
99
- batch: @batch,
100
- try_count: try_count,
101
- report_filepath: report_filepath
102
- }
103
-
104
- if @reportnamer.includes_html?
105
- html_report_filepath = File.join(@output_directory, @reportnamer.html_last_reportname)
106
- info[:html_report_filepath] = html_report_filepath
107
- end
108
- if @reportnamer.includes_json?
109
- json_report_filepath = File.join(@output_directory, @reportnamer.json_last_reportname)
110
- info[:json_report_filepath] = json_report_filepath
111
- end
112
- if @result_bundle
113
- test_result_suffix = '.test_result'
114
- test_result_suffix.prepend("-#{@reportnamer.report_count}") unless @reportnamer.report_count.zero?
115
- test_result_bundlepath = File.join(@output_directory, @scheme) + test_result_suffix
116
- info[:test_result_bundlepath] = test_result_bundlepath
117
- end
118
- puts "interstitial about to call #{@testrun_completed_block} for batch #{@batch}"
119
- @testrun_completed_block.call(info)
120
- end
121
-
122
- def set_json_env_if_necessary
123
- if @reportnamer && @reportnamer.includes_json?
124
- ENV['XCPRETTY_JSON_FILE_OUTPUT'] = File.join(
125
- @output_directory,
126
- @reportnamer.json_last_reportname
127
- )
128
- end
129
- end
130
-
131
- def finish_try(try_count)
132
- send_info_for_try(try_count)
133
- reset_simulators
134
- ENV['SCAN_DERIVED_DATA_PATH'] = Dir.mktmpdir(nil, @output_directory) if @parallelize
135
- move_test_result_bundle_for_next_run
136
- set_json_env_if_necessary
137
- @reportnamer && @reportnamer.increment
138
- end
139
- end
140
- end
141
- end
142
- end
143
-