fastlane-plugin-try_scan 0.1.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -19
- data/lib/fastlane/plugin/try_scan/actions/try_scan_action.rb +35 -60
- data/lib/fastlane/plugin/try_scan/helper/scan_helper.rb +1 -35
- data/lib/fastlane/plugin/try_scan/helper/try_scan_runner.rb +89 -98
- data/lib/fastlane/plugin/try_scan/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6423da17416a0d0718726d80c011463f8c11763bea4305c77db114fdca0bac98
|
4
|
+
data.tar.gz: a6650bda5beb09a03105ee929904c8c2b25b9df3faf69e4dbe3db9cccba97f90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9e2661f541ba9b72aa57317e3d9b5cea705086b0360827cbd56722361bf1f56a480b23fdbcaad520070b2bdade410680af2ac6de2d3791cb3e77057d604f2a8
|
7
|
+
data.tar.gz: 22ced8f5d7bc59bfa915557f1febb8b9fdf46556feb555063210f15d6658f423f73d8fe79d9a2afc8b1182a0dafc4fcb0fb8efac6dfac0fabedca4edf58fa5f8
|
data/README.md
CHANGED
@@ -2,36 +2,37 @@
|
|
2
2
|
|
3
3
|
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-try_scan)
|
4
4
|
|
5
|
+
## About try_scan
|
6
|
+
|
7
|
+
The easiest way to rerun tests of your iOS and Mac app 🚀
|
8
|
+
|
9
|
+
Under the hood `try_scan` uses official [`fastlane scan action`](https://docs.fastlane.tools/actions/scan/), it means that you are able to provide any `scan` options and use `Scanfile` as before — everything will work like a charm, `try_scan` just brings couple of new amazing options:
|
10
|
+
|
11
|
+
| Option | Description | Default |
|
12
|
+
| ------- |------------ | ------- |
|
13
|
+
| try_count | Number of times to try to get your tests green | 1 |
|
14
|
+
| try_parallel | Should first run be executed in parallel? Equivalent to `-parallel-testing-enabled` | true |
|
15
|
+
| retry_parallel | Should subsequent runs be executed in parallel? Required `try_parallel: true` | true |
|
16
|
+
| parallel_workers | Specify the exact number of test runners that will be spawned during parallel testing. Equivalent to `-parallel-testing-worker-count` and `concurrent_workers` | |
|
17
|
+
|
18
|
+
## Requirements
|
19
|
+
|
20
|
+
* Xcode 11.x or greater. Download it at the [Apple Developer - Downloads](https://developer.apple.com/downloads) or the [Mac App Store](https://apps.apple.com/us/app/xcode/id497799835?mt=12).
|
21
|
+
|
5
22
|
## Getting Started
|
6
23
|
|
7
|
-
|
24
|
+
To get started with `try_scan`, add it to your project by running:
|
8
25
|
|
9
26
|
```bash
|
10
|
-
fastlane add_plugin try_scan
|
27
|
+
$ fastlane add_plugin try_scan
|
11
28
|
```
|
12
29
|
|
13
|
-
## About try_scan
|
14
|
-
|
15
|
-
Simple way to retry your scan action 🚀
|
16
|
-
|
17
30
|
## Usage
|
18
31
|
|
19
32
|
```ruby
|
20
33
|
try_scan(
|
21
34
|
workspace: "Example.xcworkspace",
|
22
|
-
devices: ["iPhone
|
35
|
+
devices: ["iPhone 7", "iPad Air"],
|
23
36
|
try_count: 3
|
24
37
|
)
|
25
38
|
```
|
26
|
-
|
27
|
-
## Issues and Feedback
|
28
|
-
|
29
|
-
For any other issues and feedback about this plugin, please submit it to this repository.
|
30
|
-
|
31
|
-
## Troubleshooting
|
32
|
-
|
33
|
-
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
34
|
-
|
35
|
-
## About _fastlane_
|
36
|
-
|
37
|
-
_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).
|
@@ -10,61 +10,16 @@ module Fastlane
|
|
10
10
|
|
11
11
|
class TryScanAction < Action
|
12
12
|
def self.run(params)
|
13
|
-
|
14
|
-
|
13
|
+
if Helper.xcode_at_least?('11.0.0')
|
14
|
+
params[:destination] = [params[:destination]] if params[:destination] && !params[:destination].kind_of?(Array)
|
15
|
+
success = TryScanManager::Runner.new(params.values).run
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
def self.prepare_for_testing(params)
|
20
|
-
warn_of_xcode11_result_bundle_incompatability(params)
|
21
|
-
use_scanfile_to_override_settings(params.values)
|
22
|
-
turn_off_concurrent_workers(params.values)
|
23
|
-
prepare_scan_config(params.values)
|
24
|
-
coerce_destination_to_array(params)
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.warn_of_xcode11_result_bundle_incompatability(params)
|
28
|
-
if FastlaneCore::Helper.xcode_at_least?('11.0.0')
|
29
|
-
if params[:result_bundle]
|
30
|
-
FastlaneCore::UI.important('As of Xcode 11, test_result bundles created in the output directory are actually symbolic links to an xcresult bundle')
|
31
|
-
end
|
32
|
-
elsif params[:output_types]&.include?('xcresult')
|
33
|
-
FastlaneCore::UI.important("The 'xcresult' :output_type is only supported for Xcode 11 and greater. You are using #{FastlaneCore::Helper.xcode_version}.")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.coerce_destination_to_array(params)
|
38
|
-
destination = params[:destination] || Scan.config[:destination] || []
|
39
|
-
unless destination.kind_of?(Array)
|
40
|
-
params[:destination] = Scan.config[:destination] = [destination]
|
17
|
+
raise FastlaneCore::UI.test_failure!('Tests have failed') if params[:fail_build] && !success
|
18
|
+
else
|
19
|
+
raise FastlaneCore::UI.user_error!("Minimum supported Xcode: `v11.0.0` (used: `v#{Helper.xcode_version}`)")
|
41
20
|
end
|
42
21
|
end
|
43
22
|
|
44
|
-
def self.turn_off_concurrent_workers(scan_options)
|
45
|
-
if Gem::Version.new(Fastlane::VERSION) >= Gem::Version.new('2.142.0')
|
46
|
-
scan_options.delete(:concurrent_workers) if scan_options[:concurrent_workers].to_i > 0
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.use_scanfile_to_override_settings(scan_options)
|
51
|
-
overridden_options = FastlaneScanHelper.options_from_configuration_file(
|
52
|
-
FastlaneScanHelper.scan_options_from_try_scan_options(scan_options)
|
53
|
-
)
|
54
|
-
|
55
|
-
unless overridden_options.empty?
|
56
|
-
FastlaneCore::UI.important("Scanfile found: overriding try_scan options with it's values.")
|
57
|
-
overridden_options.each { |key, val| scan_options[key] = val }
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.prepare_scan_config(scan_options)
|
62
|
-
Scan.config ||= FastlaneCore::Configuration.create(
|
63
|
-
Fastlane::Actions::ScanAction.available_options,
|
64
|
-
FastlaneScanHelper.scan_options_from_try_scan_options(scan_options)
|
65
|
-
)
|
66
|
-
end
|
67
|
-
|
68
23
|
#####################################################
|
69
24
|
# Documentation #
|
70
25
|
#####################################################
|
@@ -77,20 +32,40 @@ module Fastlane
|
|
77
32
|
["Alexey Alter-Pesotskiy"]
|
78
33
|
end
|
79
34
|
|
80
|
-
def self.scan_options
|
81
|
-
ScanAction.available_options.reject { |config| %i[output_types].include?(config.key) }
|
82
|
-
end
|
83
|
-
|
84
35
|
def self.available_options
|
85
|
-
|
86
|
-
scan_options + [
|
36
|
+
ScanAction.available_options + [
|
87
37
|
FastlaneCore::ConfigItem.new(
|
88
38
|
key: :try_count,
|
89
39
|
env_name: "FL_TRY_SCAN_TRY_COUNT",
|
90
|
-
description: "
|
40
|
+
description: "Number of times to try to get your tests green",
|
41
|
+
type: Integer,
|
42
|
+
is_string: false,
|
43
|
+
optional: true,
|
44
|
+
default_value: 1
|
45
|
+
),
|
46
|
+
FastlaneCore::ConfigItem.new(
|
47
|
+
key: :try_parallel,
|
48
|
+
env_name: "FL_TRY_SCAN_TRY_PARALLEL",
|
49
|
+
description: "Should first run be executed in parallel? Equivalent to -parallel-testing-enabled",
|
50
|
+
is_string: false,
|
51
|
+
optional: true,
|
52
|
+
default_value: true
|
53
|
+
),
|
54
|
+
FastlaneCore::ConfigItem.new(
|
55
|
+
key: :retry_parallel,
|
56
|
+
env_name: "FL_TRY_SCAN_RETRY_PARALLEL",
|
57
|
+
description: "Should subsequent runs be executed in parallel? Required :try_parallel: true",
|
58
|
+
is_string: false,
|
59
|
+
optional: true,
|
60
|
+
default_value: true
|
61
|
+
),
|
62
|
+
FastlaneCore::ConfigItem.new(
|
63
|
+
key: :parallel_workers,
|
64
|
+
env_name: "FL_TRY_SCAN_PARALLEL_WORKERS",
|
65
|
+
description: "Specify the exact number of test runners that will be spawned during parallel testing. Equivalent to -parallel-testing-worker-count and :concurrent_workers",
|
91
66
|
type: Integer,
|
92
67
|
is_string: false,
|
93
|
-
|
68
|
+
optional: true
|
94
69
|
)
|
95
70
|
]
|
96
71
|
end
|
@@ -100,7 +75,7 @@ module Fastlane
|
|
100
75
|
end
|
101
76
|
|
102
77
|
def self.is_supported?(platform)
|
103
|
-
[:ios].include?(platform)
|
78
|
+
[:ios, :mac].include?(platform)
|
104
79
|
end
|
105
80
|
end
|
106
81
|
end
|
@@ -19,31 +19,9 @@ module TryScanManager
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.scan_options_from_try_scan_options(params)
|
22
|
-
valid_scan_keys = Fastlane::Actions::ScanAction.available_options.map(&:key)
|
23
22
|
params.select { |key, _| valid_scan_keys.include?(key) }
|
24
23
|
end
|
25
24
|
|
26
|
-
def self.options_from_configuration_file(params)
|
27
|
-
config = FastlaneCore::Configuration.create(
|
28
|
-
Fastlane::Actions::ScanAction.available_options,
|
29
|
-
params
|
30
|
-
)
|
31
|
-
config_file = config.load_configuration_file(Scan.scanfile_name, nil, true)
|
32
|
-
overridden_options = config_file ? config_file.options : {}
|
33
|
-
|
34
|
-
FastlaneCore::Project.detect_projects(config)
|
35
|
-
project = FastlaneCore::Project.new(config)
|
36
|
-
|
37
|
-
imported_path = File.expand_path(Scan.scanfile_name)
|
38
|
-
Dir.chdir(File.expand_path("..", project.path)) do
|
39
|
-
if File.expand_path(Scan.scanfile_name) != imported_path
|
40
|
-
config_file = config.load_configuration_file(Scan.scanfile_name, nil, true)
|
41
|
-
end
|
42
|
-
overridden_options.merge!(config_file.options) if config_file
|
43
|
-
end
|
44
|
-
overridden_options
|
45
|
-
end
|
46
|
-
|
47
25
|
def self.remove_preexisting_simulator_logs(params)
|
48
26
|
return unless params[:include_simulator_logs]
|
49
27
|
|
@@ -88,18 +66,6 @@ module TryScanManager
|
|
88
66
|
end
|
89
67
|
end
|
90
68
|
end
|
91
|
-
|
92
|
-
def self.update_xctestrun_after_build(scan_options)
|
93
|
-
xctestrun_files = Dir.glob("#{Scan.config[:derived_data_path]}/Build/Products/*.xctestrun")
|
94
|
-
FastlaneCore::UI.verbose("After building, found xctestrun files #{xctestrun_files} (choosing 1st)")
|
95
|
-
scan_options[:xctestrun] = xctestrun_files.first
|
96
|
-
end
|
97
|
-
|
98
|
-
def self.remove_preexisting_xctestrun_files
|
99
|
-
xctestrun_files = Dir.glob("#{Scan.config[:derived_data_path]}/Build/Products/*.xctestrun")
|
100
|
-
FastlaneCore::UI.verbose("Before building, removing pre-existing xctestrun files: #{xctestrun_files}")
|
101
|
-
FileUtils.rm_rf(xctestrun_files)
|
102
|
-
end
|
103
69
|
end
|
104
70
|
end
|
105
|
-
end
|
71
|
+
end
|
@@ -5,34 +5,39 @@ module TryScanManager
|
|
5
5
|
|
6
6
|
def initialize(options = {})
|
7
7
|
@options = options
|
8
|
+
@options[:try_count] = 1 if @options[:try_count] < 1
|
9
|
+
@options[:result_bundle] = true
|
8
10
|
end
|
9
11
|
|
10
12
|
def run
|
11
|
-
|
13
|
+
configure_xcargs
|
14
|
+
prepare_scan_config(@options)
|
12
15
|
print_summary
|
13
|
-
attempt = 1
|
16
|
+
@attempt = 1
|
14
17
|
begin
|
15
|
-
warn_of_performing_attempts
|
18
|
+
warn_of_performing_attempts
|
16
19
|
clear_preexisting_data
|
17
20
|
Scan::Runner.new.run
|
21
|
+
print_try_scan_result
|
18
22
|
return true
|
19
|
-
rescue FastlaneCore::Interface::
|
20
|
-
|
21
|
-
|
23
|
+
rescue FastlaneCore::Interface::FastlaneTestFailure => _
|
24
|
+
failed_tests = failed_tests_from_xcresult_report
|
25
|
+
print_try_scan_result(failed_tests_count: failed_tests.size)
|
26
|
+
return false if finish?
|
22
27
|
|
23
|
-
attempt += 1
|
24
|
-
update_scan_options
|
28
|
+
@attempt += 1
|
29
|
+
update_scan_options(failed_tests)
|
30
|
+
retry
|
31
|
+
rescue FastlaneCore::Interface::FastlaneBuildFailure => _
|
32
|
+
return false if finish?
|
33
|
+
|
34
|
+
@attempt += 1
|
25
35
|
retry
|
26
36
|
end
|
27
37
|
end
|
28
38
|
|
29
|
-
def
|
30
|
-
|
31
|
-
output_types = Scan.config[:output_types].split(',')
|
32
|
-
output_types << 'junit'
|
33
|
-
Scan.config[:output_types] = output_types.join(',')
|
34
|
-
end
|
35
|
-
@options[:try_count] = 0 if @options[:try_count] < 0
|
39
|
+
def finish?
|
40
|
+
@attempt >= @options[:try_count]
|
36
41
|
end
|
37
42
|
|
38
43
|
def print_summary
|
@@ -51,8 +56,8 @@ module TryScanManager
|
|
51
56
|
)
|
52
57
|
end
|
53
58
|
|
54
|
-
def warn_of_performing_attempts
|
55
|
-
FastlaneCore::UI.important("TryScan
|
59
|
+
def warn_of_performing_attempts
|
60
|
+
FastlaneCore::UI.important("TryScan: Getting started #{ordinalized_attempt} shot\n")
|
56
61
|
end
|
57
62
|
|
58
63
|
def clear_preexisting_data
|
@@ -62,101 +67,78 @@ module TryScanManager
|
|
62
67
|
FastlaneScanHelper.remove_report_files
|
63
68
|
end
|
64
69
|
|
65
|
-
def
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
FastlaneScanHelper.valid_scan_keys.include?(key)
|
72
|
-
}.merge(plugin_scan_options)
|
73
|
-
scan_options[:only_testing] = extract_failed_tests
|
74
|
-
scan_options[:skip_build] = true
|
75
|
-
scan_options[:test_without_building] = true
|
76
|
-
scan_options[:build_for_testing] = false
|
77
|
-
scan_options.delete(:skip_testing)
|
78
|
-
Scan.cache.clear
|
79
|
-
scan_options.each do |key, val|
|
80
|
-
next if val.nil?
|
81
|
-
|
82
|
-
Scan.config.set(key, val) unless val.nil?
|
83
|
-
FastlaneCore::UI.verbose("\tSetting #{key.to_s} to #{val}")
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def plugin_scan_options
|
88
|
-
xcargs = @options[:xcargs] || ''
|
89
|
-
if xcargs&.include?('build-for-testing')
|
90
|
-
FastlaneCore::UI.important(":xcargs, #{xcargs}, contained 'build-for-testing', removing it")
|
91
|
-
xcargs.slice!('build-for-testing')
|
92
|
-
end
|
93
|
-
if xcargs.include?('-quiet')
|
94
|
-
FastlaneCore::UI.important('Disabling -quiet as failing tests cannot be found with it enabled.')
|
95
|
-
xcargs.gsub!('-quiet', '')
|
96
|
-
end
|
97
|
-
@options.select { |key, _| FastlaneScanHelper.valid_scan_keys.include?(key) }.merge({ xcargs: xcargs })
|
70
|
+
def print_try_scan_result(failed_tests_count: 0)
|
71
|
+
FastlaneCore::UI.important("TryScan: result after #{ordinalized_attempt} shot 👇")
|
72
|
+
FastlaneCore::PrintTable.print_values(
|
73
|
+
config: {"Number of tests" => tests_count_from_xcresult_report, "Number of failures" => failed_tests_count},
|
74
|
+
title: "Test Results"
|
75
|
+
)
|
98
76
|
end
|
99
77
|
|
100
|
-
def
|
101
|
-
|
102
|
-
|
78
|
+
def ordinalized_attempt
|
79
|
+
case @attempt
|
80
|
+
when 1
|
81
|
+
"#{@attempt}st"
|
82
|
+
when 2
|
83
|
+
"#{@attempt}nd"
|
84
|
+
when 3
|
85
|
+
"#{@attempt}rd"
|
103
86
|
else
|
104
|
-
|
87
|
+
"#{@attempt}th"
|
105
88
|
end
|
106
89
|
end
|
107
90
|
|
108
|
-
def
|
109
|
-
|
110
|
-
|
111
|
-
|
91
|
+
def prepare_scan_config(scan_options)
|
92
|
+
Scan.config = FastlaneCore::Configuration.create(
|
93
|
+
Fastlane::Actions::ScanAction.available_options,
|
94
|
+
FastlaneScanHelper.scan_options_from_try_scan_options(scan_options)
|
95
|
+
)
|
112
96
|
end
|
113
97
|
|
114
|
-
def
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
only_testing = []
|
119
|
-
test_cases.each do |test_case|
|
120
|
-
next if test_case.xpath('failure').empty?
|
121
|
-
|
122
|
-
test_class = test_case.xpath('@classname').to_s.split('.')[1]
|
123
|
-
test_name = test_case.xpath('@name')
|
124
|
-
only_testing << "#{suite_name}/#{test_class}/#{test_name}"
|
98
|
+
def configure_xcargs
|
99
|
+
if @options[:xcargs]&.include?('-parallel-testing-enabled')
|
100
|
+
FastlaneCore::UI.important("TryScan overwrites `-parallel-testing-enabled` in :xcargs, use :try_parallel option instead")
|
101
|
+
@options[:xcargs].gsub!(/-parallel-testing-enabled(=|\s+)(YES|NO)/, '')
|
125
102
|
end
|
126
|
-
FastlaneCore::UI.verbose("Extracted tests to retry: #{only_testing}")
|
127
|
-
only_testing
|
128
|
-
end
|
129
103
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
output_files = report_options.instance_variable_get(:@output_files)
|
134
|
-
output_directory = report_options.instance_variable_get(:@output_directory)
|
135
|
-
file_name = output_files.select { |name| name.include?('.xml') }.first
|
136
|
-
@junit_report_path = "#{output_directory}/#{file_name}"
|
137
|
-
@cached_junit_report = File.open(@junit_report_path) { |f| Nokogiri::XML(f) }
|
104
|
+
if @options[:xcargs]&.include?('-parallel-testing-worker-count')
|
105
|
+
FastlaneCore::UI.important("TryScan overwrites `-parallel-testing-worker-count` in :xcargs, use :concurrent_workers option instead")
|
106
|
+
@options[:xcargs].gsub!(/-parallel-testing-worker-count(=|\s+)(\d+)/, '')
|
138
107
|
end
|
139
|
-
@cached_junit_report
|
140
|
-
end
|
141
108
|
|
142
|
-
|
143
|
-
|
144
|
-
|
109
|
+
if @options[:xcargs]&.include?('build-for-testing') || @options[:build_for_testing]
|
110
|
+
FastlaneCore::UI.important("TryScan rejects `build-for-testing` request, use it in a separate scan lane")
|
111
|
+
@options[:xcargs].slice!('build-for-testing')
|
112
|
+
@options[:build_for_testing] = nil
|
113
|
+
end
|
145
114
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
115
|
+
if @options[:try_parallel] && !@options[:disable_concurrent_testing]
|
116
|
+
xcargs = ['-parallel-testing-enabled YES']
|
117
|
+
if @options[:parallel_workers] || @options[:concurrent_workers]
|
118
|
+
workers_count = [@options[:parallel_workers].to_i, @options[:concurrent_workers].to_i].max
|
119
|
+
xcargs << "-parallel-testing-worker-count #{workers_count}"
|
150
120
|
end
|
121
|
+
@options[:xcargs] = "#{@options[:xcargs].to_s} #{xcargs.join(' ')}"
|
151
122
|
end
|
123
|
+
end
|
152
124
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
125
|
+
def update_scan_options(failed_tests)
|
126
|
+
scan_options = FastlaneScanHelper.scan_options_from_try_scan_options(@options)
|
127
|
+
scan_options[:only_testing] = failed_tests
|
128
|
+
scan_options[:skip_build] = true
|
129
|
+
scan_options.delete(:skip_testing)
|
130
|
+
if @options[:try_parallel] && !@options[:retry_parallel]
|
131
|
+
scan_options[:xcargs].gsub!(/-parallel-testing-enabled(=|\s+)(YES|NO)/, '-parallel-testing-enabled NO')
|
132
|
+
scan_options[:xcargs].gsub!(/-parallel-testing-worker-count(=|\s+)(\d+)/, '')
|
157
133
|
end
|
158
134
|
|
159
|
-
|
135
|
+
Scan.cache.clear
|
136
|
+
scan_options.each do |key, val|
|
137
|
+
next if val.nil?
|
138
|
+
|
139
|
+
Scan.config.set(key, val)
|
140
|
+
FastlaneCore::UI.verbose("\tSetting #{key.to_s} to #{val}")
|
141
|
+
end
|
160
142
|
end
|
161
143
|
|
162
144
|
def parse_xcresult_report
|
@@ -169,16 +151,25 @@ module TryScanManager
|
|
169
151
|
JSON.parse(`xcrun xcresulttool get --format json --path #{xcresult_report_files.first}`)
|
170
152
|
end
|
171
153
|
|
172
|
-
def
|
154
|
+
def failed_tests_from_xcresult_report
|
173
155
|
only_testing = []
|
174
156
|
parse_xcresult_report['issues']['testFailureSummaries']['_values'].each do |failed_test|
|
175
157
|
suite_name = failed_test['producingTarget']['_value']
|
176
|
-
|
177
|
-
|
158
|
+
test_path = failed_test['testCaseName']['_value']
|
159
|
+
begin
|
160
|
+
test_class = test_path.split('.').first
|
161
|
+
test_name = test_path.split('.')[1].split('(').first
|
162
|
+
rescue NoMethodError => _
|
163
|
+
test_class = test_path.split('[')[1].split(' ').first
|
164
|
+
test_name = test_path.split(' ')[1].split(']').first
|
165
|
+
end
|
178
166
|
only_testing << "#{suite_name}/#{test_class}/#{test_name}"
|
179
167
|
end
|
180
|
-
FastlaneCore::UI.verbose("Extracted tests to retry: #{only_testing}")
|
181
168
|
only_testing
|
182
169
|
end
|
170
|
+
|
171
|
+
def tests_count_from_xcresult_report
|
172
|
+
parse_xcresult_report['metrics']['testsCount']['_value']
|
173
|
+
end
|
183
174
|
end
|
184
175
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-try_scan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Alter-Pesotskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -122,20 +122,6 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: nokogiri
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
126
|
name: fastlane
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|