fastlane-plugin-test_center 3.8.16 → 3.9.0.beta.1
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 +2 -1
- data/lib/fastlane/plugin/test_center/actions/collate_test_result_bundles.rb +1 -2
- data/lib/fastlane/plugin/test_center/actions/collate_xcresults.rb +111 -0
- data/lib/fastlane/plugin/test_center/actions/multi_scan.rb +24 -1
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/report_collator.rb +28 -0
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan.rb +1 -0
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan_helper.rb +8 -2
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb +53 -6
- data/lib/fastlane/plugin/test_center/helper/reportname_helper.rb +49 -0
- 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: 19b265ec81e64e97efa222fe6ebc0e0f712ba161f2f0765972fef18d24a0a59e
|
|
4
|
+
data.tar.gz: ce5a8cd92d09416c3fa0b224abc16084512a51f4511e57a4edd4000a6d690da4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1fd0f2e468e3e907e5b5cfdfbdcbfd547f8a2ab50ac30a0c46645e3b98f1d7a36f32c05ecff7cabd8555ff27b1489d219b627d26c3bf891866f40c24fa574cc9
|
|
7
|
+
data.tar.gz: 942b2b420fac25341a85a4a4245d8fbd62cb8ff39047ab70836e172e2cbd66ff7c9dd7a9694fe959383a9cc92512000b70b07cd38ded20443c04ddf96e1bc0c2
|
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
|
|
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
|
|
|
@@ -41,6 +41,7 @@ _read the documentation on each action by clicking on the action name_
|
|
|
41
41
|
| [`collate_html_reports`](docs/feature_details/collate_html_reports.md) | combines multiple HTML test reports into one report | ios, mac |
|
|
42
42
|
| [`collate_json_reports`](docs/feature_details/collate_json_reports.md) | combines multiple json test reports into one report | ios, mac |
|
|
43
43
|
| [`collate_test_result_bundles`](docs/feature_details/collate_test_result_bundles.md) | combines multiple test_result bundles into one test_result bundle | ios, mac |
|
|
44
|
+
| [`collate_xcresults`](docs/feature_details/collate_xcresults.md) | combines multiple xcresult bundles into one xcresult bundle | ios, mac |
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
## Installation
|
|
@@ -184,8 +184,7 @@ module Fastlane
|
|
|
184
184
|
"in the collated test_result bundle. " \
|
|
185
185
|
"This is done because it is assumed that fragile tests, when " \
|
|
186
186
|
"re-run will often succeed due to less interference from other " \
|
|
187
|
-
"tests and the subsequent test_result bundles will have fewer failing tests."
|
|
188
|
-
""
|
|
187
|
+
"tests and the subsequent test_result bundles will have fewer failing tests."
|
|
189
188
|
end
|
|
190
189
|
|
|
191
190
|
def self.available_options
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
module Fastlane
|
|
2
|
+
module Actions
|
|
3
|
+
class CollateXcresultsAction < Action
|
|
4
|
+
require 'tempfile'
|
|
5
|
+
|
|
6
|
+
def self.run(params)
|
|
7
|
+
unless FastlaneCore::Helper.xcode_at_least?(11)
|
|
8
|
+
FastlaneCore::UI.error("Error: Xcode 11 is required to run this action")
|
|
9
|
+
return
|
|
10
|
+
end
|
|
11
|
+
commands_run = ''
|
|
12
|
+
|
|
13
|
+
xcresult_bundlepaths = params[:xcresults]
|
|
14
|
+
base_xcresult_path = xcresult_bundlepaths[0]
|
|
15
|
+
|
|
16
|
+
tmp_collated_xcresult_bundle = Tempfile.new(['collated_result_', '.xcresult'])
|
|
17
|
+
tmp_collated_xcresult_bundlepath = tmp_collated_xcresult_bundle.path
|
|
18
|
+
tmp_collated_xcresult_bundle.unlink
|
|
19
|
+
|
|
20
|
+
if xcresult_bundlepaths.size > 1
|
|
21
|
+
command = [
|
|
22
|
+
'xcrun',
|
|
23
|
+
'xcresulttool',
|
|
24
|
+
'merge',
|
|
25
|
+
xcresult_bundlepaths.map(&:shellescape),
|
|
26
|
+
'--output-path',
|
|
27
|
+
tmp_collated_xcresult_bundlepath
|
|
28
|
+
].flatten
|
|
29
|
+
commands_run = sh(*command)
|
|
30
|
+
|
|
31
|
+
FileUtils.rm_rf(params[:collated_xcresult])
|
|
32
|
+
FileUtils.cp_r(tmp_collated_xcresult_bundlepath, params[:collated_xcresult])
|
|
33
|
+
elsif File.realdirpath(xcresult_bundlepaths.first) != File.realdirpath(params[:collated_xcresult])
|
|
34
|
+
FileUtils.rm_rf(params[:collated_xcresult])
|
|
35
|
+
FileUtils.cp_r(base_xcresult_path, params[:collated_xcresult])
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
UI.message("Finished collating xcresults to '#{params[:collated_xcresult]}'")
|
|
39
|
+
commands_run
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
#####################################################
|
|
43
|
+
# @!group Documentation
|
|
44
|
+
#####################################################
|
|
45
|
+
|
|
46
|
+
def self.description
|
|
47
|
+
"🔸 Combines multiple xcresult bundles into one xcresult bundle"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.details
|
|
51
|
+
"The first xcresult bundle is used as the base bundle. " \
|
|
52
|
+
"Testcases that failed in previous bundles that no longer appear in " \
|
|
53
|
+
"later bundles are assumed to have passed in a re-run, thus not appearing " \
|
|
54
|
+
"in the collated xcresult bundle. " \
|
|
55
|
+
"This is done because it is assumed that fragile tests, when " \
|
|
56
|
+
"re-run will often succeed due to less interference from other " \
|
|
57
|
+
"tests and the subsequent xcresult bundles will have fewer failing tests."
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def self.available_options
|
|
61
|
+
[
|
|
62
|
+
FastlaneCore::ConfigItem.new(
|
|
63
|
+
key: :xcresults,
|
|
64
|
+
env_name: 'COLLATE_XCRESULTS',
|
|
65
|
+
description: 'An array of xcresult bundles to collate',
|
|
66
|
+
optional: false,
|
|
67
|
+
type: Array,
|
|
68
|
+
verify_block: proc do |xcresult_bundles|
|
|
69
|
+
UI.user_error!('No xcresult bundles found') if xcresult_bundles.empty?
|
|
70
|
+
xcresult_bundles.each do |xcresult_bundle|
|
|
71
|
+
UI.user_error!("Error: xcresult bundle not found: '#{xcresult_bundle}'") unless Dir.exist?(xcresult_bundle)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
),
|
|
75
|
+
FastlaneCore::ConfigItem.new(
|
|
76
|
+
key: :collated_xcresult,
|
|
77
|
+
env_name: 'COLLATE_XCRESULTS',
|
|
78
|
+
description: 'The merged xcresult bundle',
|
|
79
|
+
optional: true,
|
|
80
|
+
default_value: 'result.xcresult',
|
|
81
|
+
type: String
|
|
82
|
+
)
|
|
83
|
+
]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def self.example_code
|
|
87
|
+
[
|
|
88
|
+
"
|
|
89
|
+
UI.important(
|
|
90
|
+
'example: ' \\
|
|
91
|
+
'collate the xcresult bundles to a temporary xcresult bundle \"result.xcresult\"'
|
|
92
|
+
)
|
|
93
|
+
xcresults = Dir['../spec/fixtures/*.xcresult'].map { |relpath| File.absolute_path(relpath) }
|
|
94
|
+
collate_xcresults(
|
|
95
|
+
xcresults: xcresults,
|
|
96
|
+
collated_xcresult: File.join('test_output', 'result.xcresult')
|
|
97
|
+
)
|
|
98
|
+
"
|
|
99
|
+
]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def self.authors
|
|
103
|
+
["lyndsey-ferguson/@lyndseydf"]
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self.is_supported?(platform)
|
|
107
|
+
[:ios, :mac].include?(platform)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -21,6 +21,13 @@ module Fastlane
|
|
|
21
21
|
params[:output_files] = params[:output_files].split(',').map(&:strip).join(',')
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
if FastlaneCore::Helper.xcode_at_least?('11.0.0')
|
|
25
|
+
if params[:result_bundle]
|
|
26
|
+
UI.important('As of Xcode 11, test_result bundles created in the output directory are actually symbolic links to an xcresult bundle')
|
|
27
|
+
end
|
|
28
|
+
elsif params[:output_types]&.include?('xcresult')
|
|
29
|
+
UI.important("The 'xcresult' :output_type is only supported for Xcode 11 and greater. You are using #{FastlaneCore::Helper.xcode_version}.")
|
|
30
|
+
end
|
|
24
31
|
print_multi_scan_parameters(params)
|
|
25
32
|
force_quit_simulator_processes if params[:quit_simulators]
|
|
26
33
|
|
|
@@ -73,6 +80,16 @@ module Fastlane
|
|
|
73
80
|
end
|
|
74
81
|
|
|
75
82
|
def self.run_summary(scan_options, tests_passed)
|
|
83
|
+
scan_options = scan_options.clone
|
|
84
|
+
|
|
85
|
+
if scan_options[:result_bundle]
|
|
86
|
+
updated_output_types, updated_output_files = ::TestCenter::Helper::ReportNameHelper.ensure_output_includes_xcresult(
|
|
87
|
+
scan_options[:output_types],
|
|
88
|
+
scan_options[:output_files]
|
|
89
|
+
)
|
|
90
|
+
scan_options[:output_types] = updated_output_types
|
|
91
|
+
scan_options[:output_files] = updated_output_files
|
|
92
|
+
end
|
|
76
93
|
reportnamer = ::TestCenter::Helper::ReportNameHelper.new(
|
|
77
94
|
scan_options[:output_types],
|
|
78
95
|
scan_options[:output_files],
|
|
@@ -110,6 +127,11 @@ module Fastlane
|
|
|
110
127
|
File.absolute_path(relative_test_result_bundle_filepath)
|
|
111
128
|
end
|
|
112
129
|
end
|
|
130
|
+
if reportnamer.includes_xcresult?
|
|
131
|
+
report_files += Dir.glob("#{scan_options[:output_directory]}/**/#{reportnamer.xcresult_fileglob}").map do |relative_bundlepath|
|
|
132
|
+
File.absolute_path(relative_bundlepath)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
113
135
|
{
|
|
114
136
|
result: tests_passed,
|
|
115
137
|
total_tests: passing_testcount + failed_tests.size,
|
|
@@ -188,6 +210,7 @@ module Fastlane
|
|
|
188
210
|
)
|
|
189
211
|
values = Scan.config.values(ask: false)
|
|
190
212
|
values[:xcode_path] = File.expand_path("../..", FastlaneCore::Helper.xcode_path)
|
|
213
|
+
Scan.config._values.delete(:result_bundle)
|
|
191
214
|
values
|
|
192
215
|
end
|
|
193
216
|
|
|
@@ -307,7 +330,7 @@ module Fastlane
|
|
|
307
330
|
key: :output_types,
|
|
308
331
|
short_option: "-f",
|
|
309
332
|
env_name: "SCAN_OUTPUT_TYPES",
|
|
310
|
-
description: "Comma separated list of the output types (e.g. html, junit, json, json-compilation-database)",
|
|
333
|
+
description: "Comma separated list of the output types (e.g. html, junit, json, json-compilation-database, xcresult)",
|
|
311
334
|
default_value: "html,junit"
|
|
312
335
|
),
|
|
313
336
|
FastlaneCore::ConfigItem.new(
|
|
@@ -5,12 +5,14 @@ module TestCenter
|
|
|
5
5
|
require_relative '../../actions/collate_html_reports'
|
|
6
6
|
require_relative '../../actions/collate_json_reports'
|
|
7
7
|
require_relative '../../actions/collate_test_result_bundles'
|
|
8
|
+
require_relative '../../actions/collate_xcresults'
|
|
8
9
|
|
|
9
10
|
class ReportCollator
|
|
10
11
|
CollateJunitReportsAction = Fastlane::Actions::CollateJunitReportsAction
|
|
11
12
|
CollateHtmlReportsAction = Fastlane::Actions::CollateHtmlReportsAction
|
|
12
13
|
CollateJsonReportsAction = Fastlane::Actions::CollateJsonReportsAction
|
|
13
14
|
CollateTestResultBundlesAction = Fastlane::Actions::CollateTestResultBundlesAction
|
|
15
|
+
CollateXcresultsAction = Fastlane::Actions::CollateXcresultsAction
|
|
14
16
|
|
|
15
17
|
def initialize(params)
|
|
16
18
|
@source_reports_directory_glob = params[:source_reports_directory_glob]
|
|
@@ -27,6 +29,7 @@ module TestCenter
|
|
|
27
29
|
collate_html_reports
|
|
28
30
|
collate_json_reports
|
|
29
31
|
collate_test_result_bundles
|
|
32
|
+
collate_xcresult_bundles
|
|
30
33
|
end
|
|
31
34
|
|
|
32
35
|
def sort_globbed_files(glob)
|
|
@@ -139,6 +142,31 @@ module TestCenter
|
|
|
139
142
|
FileUtils.mv(test_result_bundlepaths.first, collated_test_result_bundlepath)
|
|
140
143
|
end
|
|
141
144
|
end
|
|
145
|
+
|
|
146
|
+
def collate_xcresult_bundles
|
|
147
|
+
return unless @reportnamer.includes_xcresult?
|
|
148
|
+
|
|
149
|
+
test_xcresult_bundlepaths = sort_globbed_files("#{@source_reports_directory_glob}/#{@reportnamer.xcresult_fileglob}")
|
|
150
|
+
xcresult_bundlename_suffix = ''
|
|
151
|
+
xcresult_bundlename_suffix = "-#{@reportnamer.report_count}" if @reportnamer.report_count > 0
|
|
152
|
+
collated_xcresult_bundlepath = File.absolute_path("#{File.join(@output_directory, @reportnamer.xcresult_bundlename(@suffix))}")
|
|
153
|
+
if test_xcresult_bundlepaths.size > 1
|
|
154
|
+
FastlaneCore::UI.verbose("Collating xcresult bundles #{test_xcresult_bundlepaths}")
|
|
155
|
+
config = create_config(
|
|
156
|
+
CollateXcresultsAction,
|
|
157
|
+
{
|
|
158
|
+
xcresults: test_xcresult_bundlepaths,
|
|
159
|
+
collated_xcresult: collated_xcresult_bundlepath
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
CollateXcresultsAction.run(config)
|
|
163
|
+
FileUtils.rm_rf(test_xcresult_bundlepaths - [collated_xcresult_bundlepath])
|
|
164
|
+
elsif test_xcresult_bundlepaths.size == 1 && File.realdirpath(test_xcresult_bundlepaths.first) != File.realdirpath(collated_xcresult_bundlepath)
|
|
165
|
+
FastlaneCore::UI.verbose("Copying xcresult bundle from #{test_xcresult_bundlepaths.first} to #{collated_xcresult_bundlepath}")
|
|
166
|
+
FileUtils.mkdir_p(File.dirname(collated_xcresult_bundlepath))
|
|
167
|
+
FileUtils.mv(test_xcresult_bundlepaths.first, collated_xcresult_bundlepath)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
142
170
|
end
|
|
143
171
|
end
|
|
144
172
|
end
|
|
@@ -21,6 +21,7 @@ module TestCenter
|
|
|
21
21
|
# this allows multi_scan's `destination` option to be picked up by `scan`
|
|
22
22
|
scan_config._values.delete(:device)
|
|
23
23
|
scan_config._values.delete(:devices)
|
|
24
|
+
scan_config._values.delete(:result_bundle) if ReportNameHelper.includes_xcresult?(@options[:output_types])
|
|
24
25
|
scan_cache.clear
|
|
25
26
|
end
|
|
26
27
|
|
|
@@ -38,6 +38,8 @@ module TestCenter
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def delete_xcresults
|
|
41
|
+
return if @reportnamer.includes_xcresult?
|
|
42
|
+
|
|
41
43
|
derived_data_path = File.expand_path(@options[:derived_data_path] || Scan.config[:derived_data_path])
|
|
42
44
|
xcresults = Dir.glob("#{derived_data_path}/Logs/Test/*.xcresult")
|
|
43
45
|
if FastlaneCore::Helper.xcode_at_least?('11.0.0')
|
|
@@ -91,9 +93,13 @@ module TestCenter
|
|
|
91
93
|
retrying_scan_options = @reportnamer.scan_options.merge(
|
|
92
94
|
{
|
|
93
95
|
output_directory: output_directory,
|
|
94
|
-
xcargs: "#{xcargs} -parallel-testing-enabled NO"
|
|
96
|
+
xcargs: "#{xcargs} -parallel-testing-enabled NO "
|
|
95
97
|
}
|
|
96
98
|
)
|
|
99
|
+
if @reportnamer.includes_xcresult?
|
|
100
|
+
retrying_scan_options[:xcargs] += "-resultBundlePath '#{File.join(output_directory, @reportnamer.xcresult_last_bundlename)}' "
|
|
101
|
+
end
|
|
102
|
+
|
|
97
103
|
@options.select { |k,v| valid_scan_keys.include?(k) }
|
|
98
104
|
.merge(retrying_scan_options)
|
|
99
105
|
end
|
|
@@ -292,7 +298,7 @@ module TestCenter
|
|
|
292
298
|
|
|
293
299
|
def move_test_result_bundle_for_next_run
|
|
294
300
|
return unless @options[:result_bundle]
|
|
295
|
-
|
|
301
|
+
|
|
296
302
|
glob_pattern = "#{output_directory}/*.test_result"
|
|
297
303
|
preexisting_test_result_bundles = Dir.glob(glob_pattern)
|
|
298
304
|
unnumbered_test_result_bundles = preexisting_test_result_bundles.reject do |test_result|
|
|
@@ -16,10 +16,26 @@ module TestCenter
|
|
|
16
16
|
clean: false,
|
|
17
17
|
disable_concurrent_testing: true
|
|
18
18
|
)
|
|
19
|
+
@result_bundle_desired = !!@options[:result_bundle]
|
|
20
|
+
if @options[:result_bundle] && FastlaneCore::Helper.xcode_at_least?('11.0.0')
|
|
21
|
+
update_options_to_use_xcresult_output
|
|
22
|
+
end
|
|
19
23
|
@batch_count = 1 # default count. Will be updated by setup_testcollector
|
|
20
24
|
setup_testcollector
|
|
21
25
|
end
|
|
22
26
|
|
|
27
|
+
def update_options_to_use_xcresult_output
|
|
28
|
+
return @options unless @options[:result_bundle]
|
|
29
|
+
|
|
30
|
+
updated_output_types, updated_output_files = ReportNameHelper.ensure_output_includes_xcresult(
|
|
31
|
+
@options[:output_types],
|
|
32
|
+
@options[:output_files]
|
|
33
|
+
)
|
|
34
|
+
@options[:output_types] = updated_output_types
|
|
35
|
+
@options[:output_files] = updated_output_files
|
|
36
|
+
@options.reject! { |k,_| k == :result_bundle }
|
|
37
|
+
end
|
|
38
|
+
|
|
23
39
|
def setup_testcollector
|
|
24
40
|
return if @options[:invocation_based_tests] && @options[:only_testing].nil?
|
|
25
41
|
return if @test_collector
|
|
@@ -42,6 +58,7 @@ module TestCenter
|
|
|
42
58
|
def run
|
|
43
59
|
ScanHelper.remove_preexisting_simulator_logs(@options)
|
|
44
60
|
remove_preexisting_test_result_bundles
|
|
61
|
+
remote_preexisting_xcresult_bundles
|
|
45
62
|
|
|
46
63
|
tests_passed = false
|
|
47
64
|
if should_run_tests_through_single_try?
|
|
@@ -63,7 +80,7 @@ module TestCenter
|
|
|
63
80
|
|
|
64
81
|
|
|
65
82
|
def remove_preexisting_test_result_bundles
|
|
66
|
-
return unless @options[:result_bundle]
|
|
83
|
+
return unless @options[:result_bundle] || @options[:output_types]&.include?('xcresult')
|
|
67
84
|
|
|
68
85
|
glob_pattern = "#{output_directory}/**/*.test_result"
|
|
69
86
|
preexisting_test_result_bundles = Dir.glob(glob_pattern)
|
|
@@ -76,6 +93,20 @@ module TestCenter
|
|
|
76
93
|
end
|
|
77
94
|
end
|
|
78
95
|
|
|
96
|
+
def remote_preexisting_xcresult_bundles
|
|
97
|
+
return unless @options.fetch(:output_types, '').include?('xcresult')
|
|
98
|
+
|
|
99
|
+
glob_pattern = "#{output_directory}/**/*.xcresult"
|
|
100
|
+
preexisting_xcresult_bundles = Dir.glob(glob_pattern)
|
|
101
|
+
if preexisting_xcresult_bundles.size > 0
|
|
102
|
+
FastlaneCore::UI.verbose("Removing pre-existing xcresult bundles: ")
|
|
103
|
+
preexisting_xcresult_bundles.each do |test_result_bundle|
|
|
104
|
+
FastlaneCore::UI.verbose(" #{test_result_bundle}")
|
|
105
|
+
end
|
|
106
|
+
FileUtils.rm_rf(preexisting_xcresult_bundles)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
79
110
|
def run_tests_through_single_try
|
|
80
111
|
FastlaneCore::UI.verbose("Running invocation tests")
|
|
81
112
|
if @options[:invocation_based_tests]
|
|
@@ -108,6 +139,8 @@ module TestCenter
|
|
|
108
139
|
@options[:only_testing] = retrieve_failed_single_try_tests
|
|
109
140
|
@options[:only_testing] = @options[:only_testing].map(&:strip_testcase).uniq
|
|
110
141
|
|
|
142
|
+
symlink_result_bundle_to_xcresult(output_directory, reportnamer)
|
|
143
|
+
|
|
111
144
|
tests_passed
|
|
112
145
|
end
|
|
113
146
|
|
|
@@ -178,6 +211,17 @@ module TestCenter
|
|
|
178
211
|
FileUtils.rm_rf(report_files_dir)
|
|
179
212
|
end
|
|
180
213
|
|
|
214
|
+
def symlink_result_bundle_to_xcresult(output_dir, reportname_helper)
|
|
215
|
+
return unless @result_bundle_desired && reportname_helper.includes_xcresult?
|
|
216
|
+
|
|
217
|
+
xcresult_bundlename = reportname_helper.xcresult_bundlename
|
|
218
|
+
xcresult_bundlename_path = File.join(output_dir, xcresult_bundlename)
|
|
219
|
+
test_result_bundlename = File.basename(xcresult_bundlename, '.*') + '.test_result'
|
|
220
|
+
test_result_bundlename_path = File.join(output_dir, test_result_bundlename)
|
|
221
|
+
FileUtils.rm_rf(test_result_bundlename_path)
|
|
222
|
+
File.symlink(xcresult_bundlename_path, test_result_bundlename_path)
|
|
223
|
+
end
|
|
224
|
+
|
|
181
225
|
def collate_batched_reports_for_testable(testable)
|
|
182
226
|
FastlaneCore::UI.verbose("Collating results for all batches")
|
|
183
227
|
|
|
@@ -191,18 +235,21 @@ module TestCenter
|
|
|
191
235
|
given_output_types = @options[:output_types]
|
|
192
236
|
given_output_files = @options[:output_files]
|
|
193
237
|
|
|
238
|
+
report_name_helper = ReportNameHelper.new(
|
|
239
|
+
given_output_types,
|
|
240
|
+
given_output_files,
|
|
241
|
+
given_custom_report_file_name
|
|
242
|
+
)
|
|
243
|
+
|
|
194
244
|
TestCenter::Helper::MultiScanManager::ReportCollator.new(
|
|
195
245
|
source_reports_directory_glob: source_reports_directory_glob,
|
|
196
246
|
output_directory: absolute_output_directory,
|
|
197
|
-
reportnamer:
|
|
198
|
-
given_output_types,
|
|
199
|
-
given_output_files,
|
|
200
|
-
given_custom_report_file_name
|
|
201
|
-
),
|
|
247
|
+
reportnamer: report_name_helper,
|
|
202
248
|
scheme: @options[:scheme],
|
|
203
249
|
result_bundle: @options[:result_bundle]
|
|
204
250
|
).collate
|
|
205
251
|
FileUtils.rm_rf(Dir.glob(source_reports_directory_glob))
|
|
252
|
+
symlink_result_bundle_to_xcresult(absolute_output_directory, report_name_helper)
|
|
206
253
|
true
|
|
207
254
|
end
|
|
208
255
|
end
|
|
@@ -48,6 +48,10 @@ module TestCenter
|
|
|
48
48
|
files.delete_at(json_index)
|
|
49
49
|
types.delete_at(json_index)
|
|
50
50
|
end
|
|
51
|
+
if (xcresult_index = types.find_index('xcresult'))
|
|
52
|
+
files.delete_at(xcresult_index)
|
|
53
|
+
types.delete_at(xcresult_index)
|
|
54
|
+
end
|
|
51
55
|
files.map! do |filename|
|
|
52
56
|
filename.chomp
|
|
53
57
|
numbered_filename(filename)
|
|
@@ -141,6 +145,51 @@ module TestCenter
|
|
|
141
145
|
def json_numbered_fileglob
|
|
142
146
|
"#{File.basename(json_reportname, '.*')}-[1-9]*#{json_filextension}"
|
|
143
147
|
end
|
|
148
|
+
|
|
149
|
+
def self.ensure_output_includes_xcresult(output_types, output_files)
|
|
150
|
+
return [output_types, output_files] if includes_xcresult?(output_types) || output_types.nil?
|
|
151
|
+
|
|
152
|
+
output_types = output_types.split(',').push('xcresult').join(',')
|
|
153
|
+
if output_files
|
|
154
|
+
output_files = output_files.split(',').push('report.xcresult').join(',')
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
[output_types, output_files]
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def self.includes_xcresult?(output_types)
|
|
161
|
+
return false unless ::FastlaneCore::Helper.xcode_at_least?('11.0.0')
|
|
162
|
+
output_types && output_types.split(',').find_index('xcresult') != nil
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def includes_xcresult?
|
|
166
|
+
self.class.includes_xcresult?(@output_types)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def xcresult_last_bundlename
|
|
170
|
+
xcresult_index = @output_types.split(',').find_index('xcresult')
|
|
171
|
+
numbered_filename(@output_files.to_s.split(',')[xcresult_index])
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def xcresult_bundlename(suffix = '')
|
|
175
|
+
xcresult_index = @output_types.split(',').find_index('xcresult')
|
|
176
|
+
report_name = @output_files.to_s.split(',')[xcresult_index]
|
|
177
|
+
return report_name if suffix.empty?
|
|
178
|
+
|
|
179
|
+
"#{File.basename(report_name, '.*')}-#{suffix}#{xcresult_filextension}"
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def xcresult_filextension
|
|
183
|
+
File.extname(xcresult_bundlename)
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def xcresult_fileglob
|
|
187
|
+
"#{File.basename(xcresult_bundlename, '.*')}*#{xcresult_filextension}"
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def xcresult_numbered_fileglob
|
|
191
|
+
"#{File.basename(xcresult_bundlename, '.*')}-[1-9]*#{xcresult_filextension}"
|
|
192
|
+
end
|
|
144
193
|
|
|
145
194
|
def increment
|
|
146
195
|
@report_count += 1
|
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.9.0.beta.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lyndsey Ferguson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-02-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -261,6 +261,7 @@ files:
|
|
|
261
261
|
- lib/fastlane/plugin/test_center/actions/collate_json_reports.rb
|
|
262
262
|
- lib/fastlane/plugin/test_center/actions/collate_junit_reports.rb
|
|
263
263
|
- lib/fastlane/plugin/test_center/actions/collate_test_result_bundles.rb
|
|
264
|
+
- lib/fastlane/plugin/test_center/actions/collate_xcresults.rb
|
|
264
265
|
- lib/fastlane/plugin/test_center/actions/multi_scan.rb
|
|
265
266
|
- lib/fastlane/plugin/test_center/actions/quit_core_simulator_service.rb
|
|
266
267
|
- lib/fastlane/plugin/test_center/actions/suppress_tests.rb
|
|
@@ -301,9 +302,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
301
302
|
version: '0'
|
|
302
303
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
303
304
|
requirements:
|
|
304
|
-
- - "
|
|
305
|
+
- - ">"
|
|
305
306
|
- !ruby/object:Gem::Version
|
|
306
|
-
version:
|
|
307
|
+
version: 1.3.1
|
|
307
308
|
requirements: []
|
|
308
309
|
rubygems_version: 3.0.6
|
|
309
310
|
signing_key:
|