fastlane-plugin-test_center 3.11.4 → 3.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/fastlane/plugin/test_center/actions/multi_scan.rb +34 -3
- data/lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb +16 -4
- data/lib/fastlane/plugin/test_center/helper/fastlane_core/device_manager/simulator_extensions.rb +16 -0
- data/lib/fastlane/plugin/test_center/helper/html_test_report.rb +17 -2
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/device_manager.rb +15 -2
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan_helper.rb +2 -2
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb +43 -6
- data/lib/fastlane/plugin/test_center/helper/scan_helper.rb +1 -1
- data/lib/fastlane/plugin/test_center/helper/test_collector.rb +74 -17
- data/lib/fastlane/plugin/test_center/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aad12d735ede09ec5252a46c7ce09dcdc146473c94562948a3bfb48298d3efc4
|
4
|
+
data.tar.gz: 91b490649264d9994bc9acbe7d0703e6bf2f800fe91555cee201c3a2dde491dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49b63536f6ce286c9db3743a07301713d574465a5ef68d02fda3c250f4244ff8cccdbeff9b3562c0eeefc9a0ac696704a356efb815104b3fd912280e29f3d207
|
7
|
+
data.tar.gz: be836edfc4eb671119ee7adb4752931454988fd53c861736598f708f2369ba15f6caf592a3a2749983855e268728249de97074e61ea3e52a0eec5615d2dc9907
|
data/README.md
CHANGED
@@ -7,6 +7,8 @@
|
|
7
7
|
|
8
8
|
Have you ever spent too much time trying to fix fragile tests only to give up with nothing real to show? Use the `fastlane` actions from `test_center` to remove the pain around your tests, so that you can focus on what makes 💰: features that customers love 😍.
|
9
9
|
|
10
|
+
> For those of you new to fastlane, I recommend that you read my article [Rescue Your Mobile Builds from Madness Using Fastlane](https://medium.com/appian-engineering/rescue-your-mobile-builds-from-madness-using-fastlane-cf123622f2d3).
|
11
|
+
|
10
12
|
<p align="center">
|
11
13
|
<a href="#features">Features</a> |
|
12
14
|
<a href="#installation">Installation</a> |
|
@@ -38,6 +40,7 @@ _read the documentation on each action by clicking on the action name_
|
|
38
40
|
| [`test_options_from_testplan`](docs/feature_details/test_options_from_testplan.md) | returns the tests and test code coverage configuration for a given testplan | ios, mac |
|
39
41
|
| [`testplans_from_scheme`](docs/feature_details/testplans_from_scheme.md) | returns the testplans that an Xcode Scheme references | ios, mac |
|
40
42
|
| [`tests_from_junit`](docs/feature_details/tests_from_junit.md) | returns the passing and failing tests in a Junit test report | ios, mac |
|
43
|
+
| [`tests_from_xcresult`](docs/feature_details/tests_from_xcresult.md) | returns the passing and failing tests in a xcresult bundle | ios, mac |
|
41
44
|
| [`tests_from_xctestrun`](docs/feature_details/tests_from_xctestrun.md) | returns a list of tests for each test target in a `xctestrun` file | ios, mac |
|
42
45
|
| [`collate_junit_reports`](docs/feature_details/collate_junit_reports.md) | combines multiple Junit test reports into one report | ios, mac |
|
43
46
|
| [`collate_html_reports`](docs/feature_details/collate_html_reports.md) | combines multiple HTML test reports into one report | ios, mac |
|
@@ -170,8 +170,10 @@ module Fastlane
|
|
170
170
|
reset_scan_config_to_defaults
|
171
171
|
use_scanfile_to_override_settings(scan_options)
|
172
172
|
turn_off_concurrent_workers(scan_options)
|
173
|
+
UI.important("Turning off :skip_build as it doesn't do anything with multi_scan") if scan_options[:skip_build]
|
174
|
+
scan_options.reject! { |k,v| k == :skip_build }
|
173
175
|
ScanHelper.remove_preexisting_simulator_logs(scan_options)
|
174
|
-
if scan_options[:test_without_building]
|
176
|
+
if scan_options[:test_without_building]
|
175
177
|
UI.verbose("Preparing Scan config options for multi_scan testing")
|
176
178
|
prepare_scan_config(scan_options)
|
177
179
|
else
|
@@ -231,11 +233,31 @@ module Fastlane
|
|
231
233
|
scan_options[:derived_data_path] = Scan.config[:derived_data_path]
|
232
234
|
end
|
233
235
|
|
236
|
+
def self.remove_xcresult_from_build_options(build_options)
|
237
|
+
# convert the :output_types comma separated string of types into an array with no whitespace
|
238
|
+
output_types = build_options[:output_types].to_s.split(',').map(&:strip)
|
239
|
+
xcresult_index = output_types.index('xcresult')
|
240
|
+
|
241
|
+
unless xcresult_index.nil?
|
242
|
+
output_types.delete_at(xcresult_index)
|
243
|
+
# set :output_types value to comma separated string of remaining output types
|
244
|
+
build_options[:output_types] = output_types.join(',')
|
245
|
+
|
246
|
+
if build_options[:output_files] # not always set
|
247
|
+
output_files = build_options[:output_files].split(',').map(&:strip)
|
248
|
+
output_files.delete_at(xcresult_index)
|
249
|
+
|
250
|
+
build_options[:output_files] = output_files.join(',')
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
234
255
|
def self.prepare_scan_options_for_build_for_testing(scan_options)
|
235
|
-
build_options = scan_options.merge(build_for_testing: true).reject { |k| %i[test_without_building
|
256
|
+
build_options = scan_options.merge(build_for_testing: true).reject { |k| %i[test_without_building testplan include_simulator_logs].include?(k) }
|
257
|
+
remove_xcresult_from_build_options(build_options)
|
236
258
|
Scan.config = FastlaneCore::Configuration.create(
|
237
259
|
Fastlane::Actions::ScanAction.available_options,
|
238
|
-
ScanHelper.scan_options_from_multi_scan_options(build_options)
|
260
|
+
ScanHelper.scan_options_from_multi_scan_options(build_options).merge(include_simulator_logs: false)
|
239
261
|
)
|
240
262
|
values = Scan.config.values(ask: false)
|
241
263
|
values[:xcode_path] = File.expand_path("../..", FastlaneCore::Helper.xcode_path)
|
@@ -357,6 +379,15 @@ module Fastlane
|
|
357
379
|
"because the number of tests is unknown")
|
358
380
|
end
|
359
381
|
),
|
382
|
+
FastlaneCore::ConfigItem.new(
|
383
|
+
key: :swift_test_prefix,
|
384
|
+
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`",
|
385
|
+
default_value: "test",
|
386
|
+
optional: true,
|
387
|
+
verify_block: proc do |swift_test_prefix|
|
388
|
+
UI.user_error!("Error: swift_test_prefix must be non-nil and non-empty") if swift_test_prefix.nil? || swift_test_prefix.empty?
|
389
|
+
end
|
390
|
+
),
|
360
391
|
FastlaneCore::ConfigItem.new(
|
361
392
|
key: :quit_simulators,
|
362
393
|
env_name: "FL_MULTI_SCAN_QUIT_SIMULATORS",
|
@@ -5,10 +5,10 @@ module Fastlane
|
|
5
5
|
class TestsFromXctestrunAction < Action
|
6
6
|
def self.run(params)
|
7
7
|
UI.verbose("Getting tests from xctestrun file at '#{params[:xctestrun]}'")
|
8
|
-
return xctestrun_tests(params[:xctestrun], params[:invocation_based_tests])
|
8
|
+
return xctestrun_tests(params[:xctestrun], params[:invocation_based_tests], swift_test_prefix: params[:swift_test_prefix])
|
9
9
|
end
|
10
10
|
|
11
|
-
def self.xctestrun_tests(xctestrun_path, invocation_based_tests)
|
11
|
+
def self.xctestrun_tests(xctestrun_path, invocation_based_tests, swift_test_prefix: "test")
|
12
12
|
xctestrun = Plist.parse_xml(xctestrun_path)
|
13
13
|
xctestrun_rootpath = File.dirname(xctestrun_path)
|
14
14
|
xctestrun_version = xctestrun.fetch('__xctestrun_metadata__', Hash.new).fetch('FormatVersion', 1)
|
@@ -17,12 +17,14 @@ module Fastlane
|
|
17
17
|
if xctestrun_version == 1
|
18
18
|
xctestrun.each do |testable_name, test_target_config|
|
19
19
|
next if ignoredTestables.include? testable_name
|
20
|
+
test_target_config['TestableName'] = testable_name
|
20
21
|
test_targets << test_target_config
|
21
22
|
end
|
22
23
|
else
|
23
24
|
test_configurations = xctestrun['TestConfigurations']
|
24
25
|
test_configurations.each do |configuration|
|
25
26
|
configuration['TestTargets'].each do |test_target|
|
27
|
+
test_target['TestableName'] = test_target['BlueprintName']
|
26
28
|
test_targets << test_target
|
27
29
|
end
|
28
30
|
end
|
@@ -30,14 +32,14 @@ module Fastlane
|
|
30
32
|
|
31
33
|
tests = Hash.new([])
|
32
34
|
test_targets.each do |xctestrun_config|
|
33
|
-
testable_name = xctestrun_config['
|
35
|
+
testable_name = xctestrun_config['TestableName']
|
34
36
|
xctest_path = xctest_bundle_path(xctestrun_rootpath, xctestrun_config)
|
35
37
|
test_identifiers = []
|
36
38
|
if xctestrun_config.key?('OnlyTestIdentifiers')
|
37
39
|
test_identifiers = xctestrun_config['OnlyTestIdentifiers']
|
38
40
|
UI.verbose("Identifiers after adding onlytest tests: #{test_identifiers.join("\n\t")}")
|
39
41
|
else
|
40
|
-
test_identifiers = XCTestList.tests(xctest_path)
|
42
|
+
test_identifiers = XCTestList.tests(xctest_path, swift_test_prefix: swift_test_prefix)
|
41
43
|
UI.verbose("Found the following tests: #{test_identifiers.join("\n\t")}")
|
42
44
|
end
|
43
45
|
if xctestrun_config.key?('SkipTestIdentifiers')
|
@@ -50,6 +52,7 @@ module Fastlane
|
|
50
52
|
if test_identifiers.empty? && !invocation_based_tests
|
51
53
|
UI.error("No tests found in '#{xctest_path}'!")
|
52
54
|
UI.important("Is the Build Setting, `ENABLE_TESTABILITY` enabled for the test target #{testable_name}?")
|
55
|
+
UI.message("If your Swift test method names use a prefix other than `test`, consider setting `:swift_test_prefix`.")
|
53
56
|
end
|
54
57
|
tests[testable_name] = test_identifiers.map do |test_identifier|
|
55
58
|
"#{testable_name}/#{test_identifier}"
|
@@ -114,6 +117,15 @@ module Fastlane
|
|
114
117
|
is_string: false,
|
115
118
|
default_value: false,
|
116
119
|
optional: true
|
120
|
+
),
|
121
|
+
FastlaneCore::ConfigItem.new(
|
122
|
+
key: :swift_test_prefix,
|
123
|
+
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`",
|
124
|
+
default_value: "test",
|
125
|
+
optional: true,
|
126
|
+
verify_block: proc do |swift_test_prefix|
|
127
|
+
UI.user_error!("Error: swift_test_prefix must be non-nil and non-empty") if swift_test_prefix.nil? || swift_test_prefix.empty?
|
128
|
+
end
|
117
129
|
)
|
118
130
|
]
|
119
131
|
end
|
data/lib/fastlane/plugin/test_center/helper/fastlane_core/device_manager/simulator_extensions.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
module FixedCopyLogarchiveFastlaneSimulator
|
3
|
+
def self.included(base)
|
4
|
+
base.instance_eval do
|
5
|
+
def copy_logarchive(device, log_identity, logs_destination_dir)
|
6
|
+
require 'shellwords'
|
7
|
+
FastlaneCore::UI.verbose("> FixedCopyLogarchiveFastlaneSimulator.copy_logarchive")
|
8
|
+
logarchive_dst = File.join(logs_destination_dir, "system_logs-#{log_identity}.logarchive")
|
9
|
+
FileUtils.rm_rf(logarchive_dst)
|
10
|
+
FileUtils.mkdir_p(File.expand_path("..", logarchive_dst))
|
11
|
+
command = "xcrun simctl spawn #{device.udid} log collect --output #{logarchive_dst.shellescape} 2>/dev/null"
|
12
|
+
FastlaneCore::CommandExecutor.execute(command: command, print_all: false, print_command: true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -181,11 +181,26 @@ module TestCenter
|
|
181
181
|
end
|
182
182
|
|
183
183
|
def remove_duplicate_testcases
|
184
|
-
|
184
|
+
# Get a list of all the testcases in the report's testsuite
|
185
|
+
# and reverse the order so that we'll get the tests that
|
186
|
+
# passed _after_ they failed first. That way, when
|
187
|
+
# uniq is called, it will grab the first non-repeated test
|
188
|
+
# it finds; for duplicated tests (tests that were re-run), it will
|
189
|
+
# actually grab the last test that was run of that set.
|
190
|
+
#
|
191
|
+
# For example, if `testcases` is
|
192
|
+
# `['a(passing)', 'b(passing)', 'c(passing)', 'dup1(failing)', 'dup2(failing)', 'dup1(passing)', 'dup2(passing)' ]`
|
193
|
+
# then, testcases.reverse will be
|
194
|
+
# `['dup2(passing)', 'dup1(passing)', 'dup2(failing)', 'dup1(failing)', 'c(passing)', 'b(passing)', 'a(passing)']`
|
195
|
+
# then `uniq_testcases` will be
|
196
|
+
# `['dup2(passing)', 'dup1(passing)', 'c(passing)', 'b(passing)', 'a(passing)']`
|
197
|
+
nonuniq_testcases = testcases.reverse
|
185
198
|
uniq_testcases = nonuniq_testcases.uniq { |tc| tc.title }
|
186
199
|
(nonuniq_testcases - uniq_testcases).each do |tc|
|
200
|
+
# here, we would be deleting ['dup2(failing)', 'dup1(failing)']
|
187
201
|
failure_details = tc.failure_details
|
188
|
-
|
202
|
+
# failure_details can be nil if this is a passing testcase
|
203
|
+
tc.root.parent.delete_element(failure_details) unless failure_details.nil?
|
189
204
|
tc.root.parent.delete_element(tc.root)
|
190
205
|
end
|
191
206
|
end
|
@@ -19,11 +19,24 @@ module FastlaneCore
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def boot
|
22
|
-
|
22
|
+
return unless is_simulator
|
23
|
+
return unless os_type == "iOS"
|
24
|
+
return if self.state == 'Booted'
|
25
|
+
|
26
|
+
UI.message("Booting #{self}")
|
27
|
+
|
28
|
+
`xcrun simctl boot #{self.udid} 2>/dev/null`
|
29
|
+
self.state = 'Booted'
|
23
30
|
end
|
24
31
|
|
25
32
|
def shutdown
|
26
|
-
|
33
|
+
return unless is_simulator
|
34
|
+
return unless os_type == "iOS"
|
35
|
+
return if self.state == 'Shutdown'
|
36
|
+
|
37
|
+
UI.message("Shutting down #{self.udid}")
|
38
|
+
`xcrun simctl shutdown #{self.udid} 2>/dev/null`
|
39
|
+
self.state = 'Shutdown'
|
27
40
|
end
|
28
41
|
end
|
29
42
|
end
|
@@ -29,7 +29,7 @@ module TestCenter
|
|
29
29
|
return unless @options[:quit_simulators]
|
30
30
|
|
31
31
|
@options.fetch(:destination).each do |destination|
|
32
|
-
if /id=(?<udid
|
32
|
+
if /id=(?<udid>[^,$]+)/ =~ destination
|
33
33
|
FastlaneCore::UI.verbose("Restarting Simulator #{udid}")
|
34
34
|
`xcrun simctl shutdown #{udid} 2>/dev/null`
|
35
35
|
`xcrun simctl boot #{udid} 2>/dev/null`
|
@@ -345,7 +345,7 @@ module TestCenter
|
|
345
345
|
new_logname = "#{batch_prefix}try-#{testrun_count}-#{File.basename(log_filepath)}"
|
346
346
|
new_log_filepath = "#{File.dirname(log_filepath)}/#{new_logname}"
|
347
347
|
FastlaneCore::UI.verbose("Moving simulator log '#{log_filepath}' to '#{new_log_filepath}'")
|
348
|
-
|
348
|
+
FileUtils.mv(log_filepath, new_log_filepath, force: true)
|
349
349
|
end
|
350
350
|
end
|
351
351
|
|
@@ -6,6 +6,7 @@ module TestCenter
|
|
6
6
|
require 'json'
|
7
7
|
require 'shellwords'
|
8
8
|
require 'snapshot/reset_simulators'
|
9
|
+
require_relative '../fastlane_core/device_manager/simulator_extensions'
|
9
10
|
|
10
11
|
class Runner
|
11
12
|
attr_reader :retry_total_count
|
@@ -21,6 +22,8 @@ module TestCenter
|
|
21
22
|
end
|
22
23
|
@batch_count = 1 # default count. Will be updated by setup_testcollector
|
23
24
|
setup_testcollector
|
25
|
+
setup_logcollection
|
26
|
+
FastlaneCore::UI.verbose("< done in TestCenter::Helper::MultiScanManager.initialize")
|
24
27
|
end
|
25
28
|
|
26
29
|
def update_options_to_use_xcresult_output
|
@@ -35,6 +38,27 @@ module TestCenter
|
|
35
38
|
@options.reject! { |k,_| k == :result_bundle }
|
36
39
|
end
|
37
40
|
|
41
|
+
def setup_logcollection
|
42
|
+
FastlaneCore::UI.verbose("> setup_logcollection")
|
43
|
+
return unless @options[:include_simulator_logs]
|
44
|
+
return if Scan::Runner.method_defined?(:prelaunch_simulators)
|
45
|
+
|
46
|
+
# We need to prelaunch the simulators so xcodebuild
|
47
|
+
# doesn't shut it down before we have a chance to get
|
48
|
+
# the logs.
|
49
|
+
FastlaneCore::UI.verbose("\t collecting devices to boot for log collection")
|
50
|
+
devices_to_shutdown = []
|
51
|
+
Scan.devices.each do |device|
|
52
|
+
devices_to_shutdown << device if device.state == "Shutdown"
|
53
|
+
device.boot
|
54
|
+
end
|
55
|
+
at_exit do
|
56
|
+
devices_to_shutdown.each(&:shutdown)
|
57
|
+
end
|
58
|
+
FastlaneCore::UI.verbose("\t fixing FastlaneCore::Simulator.copy_logarchive")
|
59
|
+
FastlaneCore::Simulator.send(:include, FixedCopyLogarchiveFastlaneSimulator)
|
60
|
+
end
|
61
|
+
|
38
62
|
def setup_testcollector
|
39
63
|
return if @options[:invocation_based_tests] && @options[:only_testing].nil?
|
40
64
|
return if @test_collector
|
@@ -42,6 +66,11 @@ module TestCenter
|
|
42
66
|
@test_collector = TestCollector.new(@options)
|
43
67
|
@options.reject! { |key| %i[testplan].include?(key) }
|
44
68
|
@batch_count = @test_collector.test_batches.size
|
69
|
+
tests = @test_collector.test_batches.flatten
|
70
|
+
if tests.size < @options[:parallel_testrun_count].to_i
|
71
|
+
FastlaneCore::UI.important(":parallel_testrun_count greater than the number of tests (#{tests.size}). Reducing to that number.")
|
72
|
+
@options[:parallel_testrun_count] = tests.size
|
73
|
+
end
|
45
74
|
end
|
46
75
|
|
47
76
|
def output_directory(batch_index = 0, test_batch = [])
|
@@ -73,9 +102,7 @@ module TestCenter
|
|
73
102
|
end
|
74
103
|
|
75
104
|
def should_run_tests_through_single_try?
|
76
|
-
|
77
|
-
should_run_for_skip_build = @options[:skip_build]
|
78
|
-
(should_run_for_invocation_tests || should_run_for_skip_build)
|
105
|
+
@options[:invocation_based_tests] && @options[:only_testing].nil?
|
79
106
|
end
|
80
107
|
|
81
108
|
|
@@ -182,11 +209,21 @@ module TestCenter
|
|
182
209
|
end
|
183
210
|
|
184
211
|
def scan_options_for_worker(test_batch, batch_index)
|
212
|
+
if @test_collector.test_batches.size > 1
|
213
|
+
# If there are more than 1 batch, then we want each batch result
|
214
|
+
# sent to a "batch index" output folder to be collated later
|
215
|
+
# into the requested output_folder.
|
216
|
+
# Otherwise, send the results from the one and only one batch
|
217
|
+
# to the requested output_folder
|
218
|
+
batch_index += 1
|
219
|
+
batch = batch_index
|
220
|
+
end
|
221
|
+
|
185
222
|
{
|
186
223
|
only_testing: test_batch.map(&:shellsafe_testidentifier),
|
187
|
-
output_directory: output_directory(batch_index
|
224
|
+
output_directory: output_directory(batch_index, test_batch),
|
188
225
|
try_count: @options[:try_count],
|
189
|
-
batch:
|
226
|
+
batch: batch
|
190
227
|
}
|
191
228
|
end
|
192
229
|
|
@@ -286,7 +323,7 @@ module TestCenter
|
|
286
323
|
).collate
|
287
324
|
logs_glog_pattern = "#{source_reports_directory_glob}/*system_logs-*.{log,logarchive}"
|
288
325
|
logs = Dir.glob(logs_glog_pattern)
|
289
|
-
FileUtils.mv(logs, absolute_output_directory)
|
326
|
+
FileUtils.mv(logs, absolute_output_directory, force: true)
|
290
327
|
FileUtils.rm_rf(Dir.glob(source_reports_directory_glob))
|
291
328
|
symlink_result_bundle_to_xcresult(absolute_output_directory, report_name_helper)
|
292
329
|
true
|
@@ -6,6 +6,7 @@ module TestCenter
|
|
6
6
|
|
7
7
|
class TestCollector
|
8
8
|
attr_reader :xctestrun_path
|
9
|
+
attr_reader :only_testing
|
9
10
|
|
10
11
|
def initialize(options)
|
11
12
|
unless options[:xctestrun] || options[:derived_data_path]
|
@@ -25,6 +26,8 @@ module TestCenter
|
|
25
26
|
if @batch_count == 1 && options[:parallel_testrun_count] > 1
|
26
27
|
@batch_count = options[:parallel_testrun_count]
|
27
28
|
end
|
29
|
+
|
30
|
+
@swift_test_prefix = options[:swift_test_prefix]
|
28
31
|
end
|
29
32
|
|
30
33
|
def only_testing_from_testplan(options)
|
@@ -88,30 +91,84 @@ module TestCenter
|
|
88
91
|
end
|
89
92
|
|
90
93
|
def xctestrun_known_tests
|
91
|
-
|
92
|
-
::
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
94
|
+
unless @known_tests
|
95
|
+
config = FastlaneCore::Configuration.create(
|
96
|
+
::Fastlane::Actions::TestsFromXctestrunAction.available_options,
|
97
|
+
{
|
98
|
+
xctestrun: @xctestrun_path,
|
99
|
+
invocation_based_tests: @invocation_based_tests,
|
100
|
+
swift_test_prefix: @swift_test_prefix
|
101
|
+
}
|
102
|
+
)
|
103
|
+
@known_tests = ::Fastlane::Actions::TestsFromXctestrunAction.run(config)
|
104
|
+
end
|
105
|
+
@known_tests
|
99
106
|
end
|
100
107
|
|
101
|
-
|
108
|
+
# The purpose of this method is to expand :only_testing
|
109
|
+
# that has elements that are just the 'testsuite' or
|
110
|
+
# are just the 'testable/testsuite'. We want to take
|
111
|
+
# those and expand them out to the individual testcases.
|
112
|
+
# 'testsuite' => [
|
113
|
+
# 'testable/testsuite/testcase1',
|
114
|
+
# . 'testable/testsuite/testcase2',
|
115
|
+
# . 'testable/testsuite/testcase3'
|
116
|
+
# ]
|
117
|
+
# OR
|
118
|
+
# 'testable/testsuite' => [
|
119
|
+
# 'testable/testsuite/testcase1',
|
120
|
+
# . 'testable/testsuite/testcase2',
|
121
|
+
# . 'testable/testsuite/testcase3'
|
122
|
+
# ]
|
123
|
+
def expand_testsuites_to_tests(testables_tests)
|
124
|
+
# Remember, testable_tests is of the format:
|
125
|
+
# {
|
126
|
+
# 'testable1' => [
|
127
|
+
# 'testsuite1/testcase1',
|
128
|
+
# 'testsuite1/testcase2',
|
129
|
+
# 'testsuite2/testcase1',
|
130
|
+
# 'testsuite2/testcase2',
|
131
|
+
# ...
|
132
|
+
# 'testsuiteN/testcase1', ... 'testsuiteN/testcaseM'
|
133
|
+
# ],
|
134
|
+
# ...
|
135
|
+
# 'testableO' => [
|
136
|
+
# 'testsuite1/testcase1',
|
137
|
+
# 'testsuite1/testcase2',
|
138
|
+
# 'testsuite2/testcase1',
|
139
|
+
# 'testsuite2/testcase2',
|
140
|
+
# ...
|
141
|
+
# 'testsuiteN/testcase1', ... 'testsuiteN/testcaseM'
|
142
|
+
# ]
|
143
|
+
# }
|
102
144
|
return if @invocation_based_tests
|
103
145
|
|
146
|
+
# iterate among all the test identifers for each testable
|
147
|
+
# A test identifier is seperated into components by '/'
|
148
|
+
# if a test identifier has only 2 separators, it probably is
|
149
|
+
# 'testable/testsuite' (but it could be 'testsuite/testcase' )
|
150
|
+
all_known_tests = nil
|
104
151
|
known_tests = []
|
105
|
-
|
152
|
+
testables_tests.each do |testable, tests|
|
106
153
|
tests.each_with_index do |test, index|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
154
|
+
test_components = test.split('/')
|
155
|
+
is_full_test_identifier = (test_components.size == 3)
|
156
|
+
next if is_full_test_identifier
|
157
|
+
|
158
|
+
all_known_tests ||= xctestrun_known_tests.clone
|
159
|
+
|
160
|
+
testsuite = ''
|
161
|
+
if test_components.size == 1
|
162
|
+
testsuite = test_components[0]
|
163
|
+
else
|
164
|
+
testsuite = test_components[1]
|
165
|
+
end
|
166
|
+
|
167
|
+
testables_tests[testable][index], all_known_tests[testable] = all_known_tests[testable].partition do |known_test|
|
168
|
+
known_test.split('/')[1] == testsuite
|
112
169
|
end
|
113
170
|
end
|
114
|
-
|
171
|
+
testables_tests[testable].flatten!
|
115
172
|
end
|
116
173
|
end
|
117
174
|
|
@@ -119,7 +176,7 @@ module TestCenter
|
|
119
176
|
unless @testables_tests
|
120
177
|
if @only_testing
|
121
178
|
@testables_tests = only_testing_to_testables_tests
|
122
|
-
expand_testsuites_to_tests
|
179
|
+
expand_testsuites_to_tests(@testables_tests)
|
123
180
|
else
|
124
181
|
@testables_tests = xctestrun_known_tests
|
125
182
|
if @skip_testing
|
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.
|
4
|
+
version: 3.13.2
|
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-
|
11
|
+
date: 2020-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.1
|
61
|
+
version: 1.2.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.1
|
68
|
+
version: 1.2.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: colorize
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -271,6 +271,7 @@ files:
|
|
271
271
|
- lib/fastlane/plugin/test_center/actions/testplans_from_scheme.rb
|
272
272
|
- lib/fastlane/plugin/test_center/actions/tests_from_junit.rb
|
273
273
|
- lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb
|
274
|
+
- lib/fastlane/plugin/test_center/helper/fastlane_core/device_manager/simulator_extensions.rb
|
274
275
|
- lib/fastlane/plugin/test_center/helper/html_test_report.rb
|
275
276
|
- lib/fastlane/plugin/test_center/helper/junit_helper.rb
|
276
277
|
- lib/fastlane/plugin/test_center/helper/multi_scan_manager.rb
|