fastlane-plugin-test_center 3.10.2 → 3.11.3
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.
- checksums.yaml +4 -4
- data/README.md +9 -2
- data/lib/fastlane/plugin/test_center/actions/multi_scan.rb +10 -2
- data/lib/fastlane/plugin/test_center/actions/test_options_from_testplan.rb +90 -0
- data/lib/fastlane/plugin/test_center/actions/testplans_from_scheme.rb +120 -0
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager.rb +2 -0
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan_helper.rb +15 -7
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb +38 -2
- data/lib/fastlane/plugin/test_center/helper/test_collector.rb +31 -1
- data/lib/fastlane/plugin/test_center/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d8ca5a9222720b8b5159174407b28d8675636e19c3cd9ee1e4950f37069acb50
|
|
4
|
+
data.tar.gz: 290ebef85ce82943353cbf4ca7593b431a2ab903c8dc552932705c61c3b11771
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 162eab51a51e48d16a0dc84c72de87c310fbecfd75e61ddb6a531dc3d3ee8047f17950a826e60f6cfc25d81f2b586132716d5d470c31f8308a72d4efaae3c145
|
|
7
|
+
data.tar.gz: 5070579e0c6b38115908238c3a5b6335edf3791c7cc44e62587138304199b439c875ebf2a3fb97cb798e81eb3cfaffd3a990215d8cf2b48d3fbfdb5c55bafc37
|
data/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Have you ever spent too much time trying to fix fragile tests only to give up wi
|
|
|
21
21
|
|
|
22
22
|
## Features
|
|
23
23
|
|
|
24
|
-
This plugin makes testing your iOS app easier by providing you actions that give you greater control over everything related to testing your app.
|
|
24
|
+
This plugin makes testing your iOS app easier by providing you actions that give you greater control over everything related to testing your app.
|
|
25
25
|
|
|
26
26
|
`multi_scan` began when I created an action to only re-run the failed tests in order to determine if they were truly failing, or if they were failing randomly due to a fragile infrastructure. This action morphed into an entire plugin with many actions in the testing category.
|
|
27
27
|
|
|
@@ -35,6 +35,8 @@ _read the documentation on each action by clicking on the action name_
|
|
|
35
35
|
| [`suppress_tests_from_junit`](docs/feature_details/suppress_tests_from_junit.md) | suppress tests in an Xcode Scheme using those in a Junit test report | ios, mac |
|
|
36
36
|
| [`suppress_tests`](docs/feature_details/suppress_tests.md) | suppress tests in an Xcode Scheme | ios, mac |
|
|
37
37
|
| [`suppressed_tests`](docs/feature_details/suppressed_tests.md) | returns a list of the suppressed tests in your Xcode Project or Scheme | ios, mac |
|
|
38
|
+
| [`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
|
+
| [`testplans_from_scheme`](docs/feature_details/testplans_from_scheme.md) | returns the testplans that an Xcode Scheme references | ios, mac |
|
|
38
40
|
| [`tests_from_junit`](docs/feature_details/tests_from_junit.md) | returns the passing and failing tests in a Junit test report | ios, mac |
|
|
39
41
|
| [`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 |
|
|
40
42
|
| [`collate_junit_reports`](docs/feature_details/collate_junit_reports.md) | combines multiple Junit test reports into one report | ios, mac |
|
|
@@ -62,7 +64,7 @@ The most popular action in the `test_center` plugin is `multi_scan`, and if you
|
|
|
62
64
|
multi_scan(
|
|
63
65
|
project: File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj'),
|
|
64
66
|
scheme: 'AtomicBoy',
|
|
65
|
-
try_count: 3, # retry _failing_ tests up to three times^1.
|
|
67
|
+
try_count: 3, # retry _failing_ tests up to three times^1.
|
|
66
68
|
fail_build: false,
|
|
67
69
|
parallel_testrun_count: 4 # run subsets of your tests on parallel simulators^2
|
|
68
70
|
)
|
|
@@ -91,6 +93,11 @@ For more information about how the `fastlane` plugin system works, check out the
|
|
|
91
93
|
|
|
92
94
|
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
|
93
95
|
|
|
96
|
+
## Supporters
|
|
97
|
+
|
|
98
|
+

|
|
99
|
+
[vdavydovHH](https://github.com/vdavydovHH)
|
|
100
|
+
|
|
94
101
|
## License
|
|
95
102
|
|
|
96
103
|
MIT
|
|
@@ -14,6 +14,10 @@ module Fastlane
|
|
|
14
14
|
class MultiScanAction < Action
|
|
15
15
|
def self.run(params)
|
|
16
16
|
params[:quit_simulators] = params._values[:force_quit_simulator] if params._values[:force_quit_simulator]
|
|
17
|
+
if params[:try_count] < 1
|
|
18
|
+
UI.important('multi_scan will not test any if :try_count < 0, setting to 1')
|
|
19
|
+
params[:try_count] = 1
|
|
20
|
+
end
|
|
17
21
|
|
|
18
22
|
strip_leading_and_trailing_whitespace_from_output_types(params)
|
|
19
23
|
|
|
@@ -228,7 +232,7 @@ module Fastlane
|
|
|
228
232
|
end
|
|
229
233
|
|
|
230
234
|
def self.prepare_scan_options_for_build_for_testing(scan_options)
|
|
231
|
-
build_options = scan_options.merge(build_for_testing: true).reject { |k| k
|
|
235
|
+
build_options = scan_options.merge(build_for_testing: true).reject { |k| %i[test_without_building, testplan].include?(k) }
|
|
232
236
|
Scan.config = FastlaneCore::Configuration.create(
|
|
233
237
|
Fastlane::Actions::ScanAction.available_options,
|
|
234
238
|
ScanHelper.scan_options_from_multi_scan_options(build_options)
|
|
@@ -240,7 +244,11 @@ module Fastlane
|
|
|
240
244
|
end
|
|
241
245
|
|
|
242
246
|
def self.update_xctestrun_after_build(scan_options)
|
|
243
|
-
|
|
247
|
+
glob_pattern = "#{Scan.config[:derived_data_path]}/Build/Products/*.xctestrun"
|
|
248
|
+
if scan_options[:testplan]
|
|
249
|
+
glob_pattern = "#{Scan.config[:derived_data_path]}/Build/Products/*_#{scan_options[:testplan]}_*.xctestrun"
|
|
250
|
+
end
|
|
251
|
+
xctestrun_files = Dir.glob(glob_pattern)
|
|
244
252
|
UI.verbose("After building, found xctestrun files #{xctestrun_files} (choosing 1st)")
|
|
245
253
|
scan_options[:xctestrun] = xctestrun_files.first
|
|
246
254
|
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
module Fastlane
|
|
4
|
+
module Actions
|
|
5
|
+
class TestOptionsFromTestplanAction < Action
|
|
6
|
+
def self.run(params)
|
|
7
|
+
testplan_path = params[:testplan]
|
|
8
|
+
|
|
9
|
+
testplan = JSON.load(File.open(testplan_path))
|
|
10
|
+
only_testing = []
|
|
11
|
+
UI.verbose("Examining testplan JSON: #{testplan}")
|
|
12
|
+
testplan['testTargets'].each do |test_target|
|
|
13
|
+
testable = test_target.dig('target', 'name')
|
|
14
|
+
if test_target.key?('selectedTests')
|
|
15
|
+
UI.verbose(" Found selectedTests")
|
|
16
|
+
test_identifiers = test_target['selectedTests'].each do |selected_test|
|
|
17
|
+
UI.verbose(" Found test: '#{selected_test}'")
|
|
18
|
+
only_testing << "#{testable}/#{selected_test.sub('\/', '/')}"
|
|
19
|
+
end
|
|
20
|
+
else
|
|
21
|
+
UI.verbose(" No selected tests, using testable '#{testable}'")
|
|
22
|
+
only_testing << testable
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
{
|
|
26
|
+
code_coverage: testplan.dig('defaultOptions', 'codeCoverage'),
|
|
27
|
+
only_testing: only_testing
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
#####################################################
|
|
32
|
+
# @!group Documentation
|
|
33
|
+
#####################################################
|
|
34
|
+
|
|
35
|
+
def self.description
|
|
36
|
+
"☑️ Gets test info from a given test plan"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.details
|
|
40
|
+
"Gets tests info consisting of tests to run and whether or not code coverage is enabled"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.available_options
|
|
44
|
+
[
|
|
45
|
+
FastlaneCore::ConfigItem.new(
|
|
46
|
+
key: :testplan,
|
|
47
|
+
optional: true,
|
|
48
|
+
env_name: "FL_TEST_OPTIONS_FROM_TESTPLAN_TESTPLAN",
|
|
49
|
+
description: "The Xcode testplan to read the test info from",
|
|
50
|
+
verify_block: proc do |test_plan|
|
|
51
|
+
UI.user_error!("Error: Xcode Test Plan '#{test_plan}' is not valid!") if test_plan and test_plan.empty?
|
|
52
|
+
UI.user_error!("Error: Test Plan does not exist at path '#{test_plan}'") unless File.exist?(test_plan)
|
|
53
|
+
end
|
|
54
|
+
)
|
|
55
|
+
]
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.return_value
|
|
59
|
+
"Returns a Hash with keys :code_coverage and :only_testing for the given testplan"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.example_code
|
|
63
|
+
[
|
|
64
|
+
"
|
|
65
|
+
UI.important(
|
|
66
|
+
'example: ' \\
|
|
67
|
+
'get the tests and the test coverage configuration from a given testplan'
|
|
68
|
+
)
|
|
69
|
+
test_options = test_options_from_testplan(
|
|
70
|
+
testplan: 'AtomicBoy/AtomicBoy_2.xctestplan'
|
|
71
|
+
)
|
|
72
|
+
UI.message(\"The AtomicBoy_2 testplan has the following tests: \#{test_options[:only_testing]}\")
|
|
73
|
+
"
|
|
74
|
+
]
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def self.authors
|
|
78
|
+
["lyndsey-ferguson/lyndseydf"]
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def self.category
|
|
82
|
+
:testing
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def self.is_supported?(platform)
|
|
86
|
+
%i[ios mac].include?(platform)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
module Fastlane
|
|
2
|
+
module Actions
|
|
3
|
+
class TestplansFromSchemeAction < Action
|
|
4
|
+
def self.run(params)
|
|
5
|
+
scheme = params[:scheme]
|
|
6
|
+
scheme_filepaths = schemes_from_project(params[:xcodeproj], scheme) || schemes_from_workspace(params[:workspace], scheme)
|
|
7
|
+
if scheme_filepaths.length.zero?
|
|
8
|
+
UI.user_error!("Error: cannot find any schemes in the Xcode project") if params[:xcodeproj]
|
|
9
|
+
UI.user_error!("Error: cannot find any schemes in the Xcode workspace") if params[:workspace]
|
|
10
|
+
end
|
|
11
|
+
testplan_paths = []
|
|
12
|
+
scheme_filepaths.each do |scheme_filepath|
|
|
13
|
+
UI.verbose("Looking in Scheme '#{scheme_filepath}' for any testplans")
|
|
14
|
+
xcscheme = Xcodeproj::XCScheme.new(scheme_filepath)
|
|
15
|
+
next if xcscheme.test_action.nil?
|
|
16
|
+
next if xcscheme.test_action.testables.to_a.empty?
|
|
17
|
+
next if xcscheme.test_action.testables[0].buildable_references.to_a.empty?
|
|
18
|
+
next if xcscheme.test_action.test_plans.to_a.empty?
|
|
19
|
+
|
|
20
|
+
xcodeproj = xcscheme.test_action.testables[0].buildable_references[0].target_referenced_container.sub('container:', '')
|
|
21
|
+
container_dir = scheme_filepath.sub(/#{xcodeproj}.*/, '')
|
|
22
|
+
xcscheme.test_action.test_plans.each do |testplan|
|
|
23
|
+
testplan_path = File.absolute_path(File.join(container_dir, testplan.target_referenced_container.sub('container:', '')))
|
|
24
|
+
UI.verbose(" found testplan '#{testplan_path}'")
|
|
25
|
+
testplan_paths << testplan_path
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
testplan_paths
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.schemes_from_project(project_path, scheme)
|
|
32
|
+
return nil unless project_path
|
|
33
|
+
|
|
34
|
+
Dir.glob("#{project_path}/{xcshareddata,xcuserdata}/**/xcschemes/#{scheme || '*'}.xcscheme")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.schemes_from_workspace(workspace_path, scheme)
|
|
38
|
+
return nil unless workspace_path
|
|
39
|
+
|
|
40
|
+
xcworkspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
|
|
41
|
+
scheme_filepaths = []
|
|
42
|
+
xcworkspace.file_references.each do |file_reference|
|
|
43
|
+
next if file_reference.path.include?('Pods/Pods.xcodeproj')
|
|
44
|
+
|
|
45
|
+
project_path = file_reference.absolute_path(File.dirname(workspace_path))
|
|
46
|
+
scheme_filepaths.concat(schemes_from_project(project_path, scheme))
|
|
47
|
+
end
|
|
48
|
+
scheme_filepaths
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def self.description
|
|
52
|
+
"☑️Gets all the testplans that a Scheme references"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def self.authors
|
|
56
|
+
["lyndsey-ferguson/lyndseydf"]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def self.available_options
|
|
60
|
+
[
|
|
61
|
+
FastlaneCore::ConfigItem.new(
|
|
62
|
+
key: :xcodeproj,
|
|
63
|
+
env_name: "FL_TESTPLANS_FROM_SCHEME_XCODE_PROJECT",
|
|
64
|
+
optional: true,
|
|
65
|
+
description: "The file path to the Xcode project file that references the Scheme",
|
|
66
|
+
verify_block: proc do |path|
|
|
67
|
+
path = File.expand_path(path.to_s)
|
|
68
|
+
UI.user_error!("Error: Xcode project file path not given!") unless path and !path.empty?
|
|
69
|
+
UI.user_error!("Error: Xcode project '#{path}' not found!") unless Dir.exist?(path)
|
|
70
|
+
end
|
|
71
|
+
),
|
|
72
|
+
FastlaneCore::ConfigItem.new(
|
|
73
|
+
key: :workspace,
|
|
74
|
+
env_name: "FL_TESTPLANS_FROM_SCHEME_XCODE_WORKSPACE",
|
|
75
|
+
optional: true,
|
|
76
|
+
description: "The file path to the Xcode workspace file that references the Scheme",
|
|
77
|
+
verify_block: proc do |value|
|
|
78
|
+
v = File.expand_path(value.to_s)
|
|
79
|
+
UI.user_error!("Error: Workspace file not found at path '#{v}'") unless Dir.exist?(v)
|
|
80
|
+
UI.user_error!("Error: Workspace file is not a workspace, must end with .xcworkspace") unless v.include?(".xcworkspace")
|
|
81
|
+
end
|
|
82
|
+
),
|
|
83
|
+
FastlaneCore::ConfigItem.new(
|
|
84
|
+
key: :scheme,
|
|
85
|
+
optional: true,
|
|
86
|
+
env_name: "FL_TESTPLANS_FROM_SCHEME_XCODE_SCHEME",
|
|
87
|
+
description: "The Xcode scheme referencing the testplan",
|
|
88
|
+
verify_block: proc do |scheme_name|
|
|
89
|
+
UI.user_error!("Error: Xcode Scheme '#{scheme_name}' is not valid!") if scheme_name and scheme_name.empty?
|
|
90
|
+
end
|
|
91
|
+
)
|
|
92
|
+
]
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def self.example_code
|
|
96
|
+
[
|
|
97
|
+
"
|
|
98
|
+
UI.important(
|
|
99
|
+
'example: ' \\
|
|
100
|
+
'get all the testplans that an Xcode Scheme references'
|
|
101
|
+
)
|
|
102
|
+
testplans = testplans_from_scheme(
|
|
103
|
+
xcodeproj: 'AtomicBoy/AtomicBoy.xcodeproj',
|
|
104
|
+
scheme: 'AtomicBoy'
|
|
105
|
+
)
|
|
106
|
+
UI.message(\"The AtomicBoy uses the following testplans: \#{testplans}\")
|
|
107
|
+
"
|
|
108
|
+
]
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def self.category
|
|
112
|
+
:testing
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def self.is_supported?(platform)
|
|
116
|
+
%i[ios mac].include?(platform)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
@@ -45,7 +45,7 @@ module TestCenter
|
|
|
45
45
|
|
|
46
46
|
derived_data_path = File.expand_path(@options[:derived_data_path] || Scan.config[:derived_data_path])
|
|
47
47
|
xcresults = Dir.glob("#{derived_data_path}/Logs/Test/*.xcresult")
|
|
48
|
-
if FastlaneCore::Helper.xcode_at_least?('11
|
|
48
|
+
if FastlaneCore::Helper.xcode_at_least?('11')
|
|
49
49
|
xcresults += Dir.glob("#{output_directory}/*.xcresult")
|
|
50
50
|
end
|
|
51
51
|
FastlaneCore::UI.verbose("Deleting xcresults:")
|
|
@@ -93,6 +93,10 @@ module TestCenter
|
|
|
93
93
|
FastlaneCore::UI.important(":xcargs, #{xcargs}, contained 'build-for-testing', removing it")
|
|
94
94
|
xcargs.slice!('build-for-testing')
|
|
95
95
|
end
|
|
96
|
+
if xcargs.include?('-quiet')
|
|
97
|
+
FastlaneCore::UI.important('Disabling -quiet as failing tests cannot be found with it enabled.')
|
|
98
|
+
xcargs.gsub!('-quiet', '')
|
|
99
|
+
end
|
|
96
100
|
xcargs.gsub!(/-parallel-testing-enabled(=|\s+)(YES|NO)/, '')
|
|
97
101
|
retrying_scan_options = @reportnamer.scan_options.merge(
|
|
98
102
|
{
|
|
@@ -245,7 +249,7 @@ module TestCenter
|
|
|
245
249
|
junit: File.absolute_path(report_filepath)
|
|
246
250
|
}
|
|
247
251
|
)
|
|
248
|
-
@options[:only_testing] = @options[:only_testing] - Fastlane::Actions::TestsFromJunitAction.run(config).fetch(:passing, Hash.new).map(&:shellsafe_testidentifier)
|
|
252
|
+
@options[:only_testing] = (@options[:only_testing] || []) - Fastlane::Actions::TestsFromJunitAction.run(config).fetch(:passing, Hash.new).map(&:shellsafe_testidentifier)
|
|
249
253
|
if @options[:invocation_based_tests]
|
|
250
254
|
@options[:only_testing] = @options[:only_testing].map(&:strip_testcase).uniq
|
|
251
255
|
end
|
|
@@ -288,7 +292,7 @@ module TestCenter
|
|
|
288
292
|
end
|
|
289
293
|
|
|
290
294
|
def retrieve_test_operation_failure(test_session_last_messages)
|
|
291
|
-
if FastlaneCore::Helper.xcode_at_least?(11)
|
|
295
|
+
if FastlaneCore::Helper.xcode_at_least?('11')
|
|
292
296
|
retrieve_test_operation_failure_post_xcode11(test_session_last_messages)
|
|
293
297
|
else
|
|
294
298
|
retrieve_test_operation_failure_pre_xcode11(test_session_last_messages)
|
|
@@ -302,6 +306,8 @@ module TestCenter
|
|
|
302
306
|
test_operation_failure = 'Test device locked'
|
|
303
307
|
elsif /Test runner exited before starting test execution/ =~ test_session_last_messages
|
|
304
308
|
test_operation_failure = 'Test runner exited before starting test execution'
|
|
309
|
+
else
|
|
310
|
+
test_operation_failure = 'Unknown test operation failure'
|
|
305
311
|
end
|
|
306
312
|
test_operation_failure
|
|
307
313
|
end
|
|
@@ -342,15 +348,17 @@ module TestCenter
|
|
|
342
348
|
def move_test_result_bundle_for_next_run
|
|
343
349
|
return unless @options[:result_bundle]
|
|
344
350
|
|
|
345
|
-
|
|
351
|
+
result_extension = FastlaneCore::Helper.xcode_at_least?('11') ? '.xcresult' : '.test_result'
|
|
352
|
+
|
|
353
|
+
glob_pattern = "#{output_directory}/*#{result_extension}"
|
|
346
354
|
preexisting_test_result_bundles = Dir.glob(glob_pattern)
|
|
347
355
|
unnumbered_test_result_bundles = preexisting_test_result_bundles.reject do |test_result|
|
|
348
|
-
test_result =~ /.*-\d
|
|
356
|
+
test_result =~ /.*-\d+\#{result_extension}/
|
|
349
357
|
end
|
|
350
358
|
src_test_bundle = unnumbered_test_result_bundles.first
|
|
351
359
|
dst_test_bundle_parent_dir = File.dirname(src_test_bundle)
|
|
352
|
-
dst_test_bundle_basename = File.basename(src_test_bundle,
|
|
353
|
-
dst_test_bundle = "#{dst_test_bundle_parent_dir}/#{dst_test_bundle_basename}-#{@testrun_count}
|
|
360
|
+
dst_test_bundle_basename = File.basename(src_test_bundle, result_extension)
|
|
361
|
+
dst_test_bundle = "#{dst_test_bundle_parent_dir}/#{dst_test_bundle_basename}-#{@testrun_count}#{result_extension}"
|
|
354
362
|
FastlaneCore::UI.verbose("Moving test_result '#{src_test_bundle}' to '#{dst_test_bundle}'")
|
|
355
363
|
File.rename(src_test_bundle, dst_test_bundle)
|
|
356
364
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
module TestCenter
|
|
3
2
|
module Helper
|
|
4
3
|
module MultiScanManager
|
|
@@ -40,7 +39,8 @@ module TestCenter
|
|
|
40
39
|
return if @options[:invocation_based_tests] && @options[:only_testing].nil?
|
|
41
40
|
return if @test_collector
|
|
42
41
|
|
|
43
|
-
@test_collector =
|
|
42
|
+
@test_collector = TestCollector.new(@options)
|
|
43
|
+
@options.reject! { |key| %i[testplan].include?(key) }
|
|
44
44
|
@batch_count = @test_collector.test_batches.size
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -207,10 +207,46 @@ module TestCenter
|
|
|
207
207
|
File.absolute_path(output_directory),
|
|
208
208
|
@test_collector.testables.first
|
|
209
209
|
)
|
|
210
|
+
merge_single_testable_xcresult_with_final_xcresult(report_files_dir, File.absolute_path(output_directory))
|
|
210
211
|
FileUtils.cp_r("#{report_files_dir}/.", File.absolute_path(output_directory))
|
|
211
212
|
FileUtils.rm_rf(report_files_dir)
|
|
212
213
|
end
|
|
213
214
|
|
|
215
|
+
def merge_single_testable_xcresult_with_final_xcresult(testable_output_dir, final_output_dir)
|
|
216
|
+
reportnamer = ReportNameHelper.new(
|
|
217
|
+
@options[:output_types],
|
|
218
|
+
@options[:output_files],
|
|
219
|
+
@options[:custom_report_file_name]
|
|
220
|
+
)
|
|
221
|
+
return unless reportnamer.includes_xcresult?
|
|
222
|
+
|
|
223
|
+
xcresult_bundlename = reportnamer.xcresult_bundlename
|
|
224
|
+
src_xcresult_bundlepath = File.join(testable_output_dir, xcresult_bundlename)
|
|
225
|
+
dst_xcresult_bundlepath = File.join(final_output_dir, xcresult_bundlename)
|
|
226
|
+
|
|
227
|
+
# if there is no destination bundle to merge to, skip it as any source bundle will be copied when complete.
|
|
228
|
+
return if !File.exist?(dst_xcresult_bundlepath)
|
|
229
|
+
# if there is no source bundle to merge, skip it as there is nothing to merge.
|
|
230
|
+
return if !File.exist?(src_xcresult_bundlepath)
|
|
231
|
+
|
|
232
|
+
config = FastlaneCore::Configuration.create(
|
|
233
|
+
Fastlane::Actions::CollateXcresultsAction.available_options,
|
|
234
|
+
{
|
|
235
|
+
xcresults: [src_xcresult_bundlepath, dst_xcresult_bundlepath],
|
|
236
|
+
collated_xcresult: dst_xcresult_bundlepath
|
|
237
|
+
}
|
|
238
|
+
)
|
|
239
|
+
FastlaneCore::UI.verbose("Merging xcresult '#{src_xcresult_bundlepath}' to '#{dst_xcresult_bundlepath}'")
|
|
240
|
+
Fastlane::Actions::CollateXcresultsAction.run(config)
|
|
241
|
+
FileUtils.rm_rf(src_xcresult_bundlepath)
|
|
242
|
+
if @result_bundle_desired
|
|
243
|
+
xcresult_bundlename = reportnamer.xcresult_bundlename
|
|
244
|
+
test_result_bundlename = File.basename(xcresult_bundlename, '.*') + '.test_result'
|
|
245
|
+
test_result_bundlename_path = File.join(testable_output_dir, test_result_bundlename)
|
|
246
|
+
FileUtils.rm_rf(test_result_bundlename_path)
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
|
|
214
250
|
def symlink_result_bundle_to_xcresult(output_dir, reportname_helper)
|
|
215
251
|
return unless @result_bundle_desired && reportname_helper.includes_xcresult?
|
|
216
252
|
|
|
@@ -15,7 +15,7 @@ module TestCenter
|
|
|
15
15
|
unless @xctestrun_path && File.exist?(@xctestrun_path)
|
|
16
16
|
FastlaneCore::UI.user_error!("Error: cannot find xctestrun file '#{@xctestrun_path}'")
|
|
17
17
|
end
|
|
18
|
-
@only_testing = options[:only_testing]
|
|
18
|
+
@only_testing = options[:only_testing] || only_testing_from_testplan(options)
|
|
19
19
|
if @only_testing.kind_of?(String)
|
|
20
20
|
@only_testing = @only_testing.split(',')
|
|
21
21
|
end
|
|
@@ -27,6 +27,36 @@ module TestCenter
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
def only_testing_from_testplan(options)
|
|
31
|
+
return unless options[:testplan] && options[:scheme]
|
|
32
|
+
|
|
33
|
+
config = FastlaneCore::Configuration.create(
|
|
34
|
+
Fastlane::Actions::TestplansFromSchemeAction.available_options,
|
|
35
|
+
{
|
|
36
|
+
workspace: options[:workspace],
|
|
37
|
+
xcodeproj: options[:project],
|
|
38
|
+
scheme: options[:scheme]
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
testplans = Fastlane::Actions::TestplansFromSchemeAction.run(config)
|
|
42
|
+
FastlaneCore::UI.verbose("TestCollector found testplans: #{testplans}")
|
|
43
|
+
testplan = testplans.find do |testplan_path|
|
|
44
|
+
%r{(.*/?#{ options[:testplan] })\.xctestplan}.match?(testplan_path)
|
|
45
|
+
end
|
|
46
|
+
FastlaneCore::UI.verbose(" using :testplan option, #{options[:testplan]}, using found one: #{testplan}")
|
|
47
|
+
|
|
48
|
+
return if testplan.nil?
|
|
49
|
+
|
|
50
|
+
config = FastlaneCore::Configuration.create(
|
|
51
|
+
Fastlane::Actions::TestOptionsFromTestplanAction.available_options,
|
|
52
|
+
{
|
|
53
|
+
testplan: testplan
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
test_options = Fastlane::Actions::TestOptionsFromTestplanAction.run(config)
|
|
57
|
+
return test_options[:only_testing]
|
|
58
|
+
end
|
|
59
|
+
|
|
30
60
|
def default_derived_data_path(options)
|
|
31
61
|
project_derived_data_path = Scan.project.build_settings(key: "BUILT_PRODUCTS_DIR")
|
|
32
62
|
File.expand_path("../../..", project_derived_data_path)
|
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.11.3
|
|
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-06-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -267,6 +267,8 @@ files:
|
|
|
267
267
|
- lib/fastlane/plugin/test_center/actions/suppress_tests.rb
|
|
268
268
|
- lib/fastlane/plugin/test_center/actions/suppress_tests_from_junit.rb
|
|
269
269
|
- lib/fastlane/plugin/test_center/actions/suppressed_tests.rb
|
|
270
|
+
- lib/fastlane/plugin/test_center/actions/test_options_from_testplan.rb
|
|
271
|
+
- lib/fastlane/plugin/test_center/actions/testplans_from_scheme.rb
|
|
270
272
|
- lib/fastlane/plugin/test_center/actions/tests_from_junit.rb
|
|
271
273
|
- lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb
|
|
272
274
|
- lib/fastlane/plugin/test_center/helper/html_test_report.rb
|