fastlane-plugin-retry_tests 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/retry_tests/actions/collate_junit_reports.rb +24 -19
- data/lib/fastlane/plugin/retry_tests/actions/multi_scan.rb +7 -2
- data/lib/fastlane/plugin/retry_tests/actions/suppress_tests.rb +0 -0
- data/lib/fastlane/plugin/retry_tests/actions/suppress_tests_from_junit.rb +0 -0
- data/lib/fastlane/plugin/retry_tests/actions/suppressed_tests.rb +0 -0
- data/lib/fastlane/plugin/retry_tests/actions/tests_from_junit.rb +0 -0
- data/lib/fastlane/plugin/retry_tests.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a0861a627d2bfd0292d137580b0d9b07c91964f
|
4
|
+
data.tar.gz: 9fdf46ae22536ba69d16e5d0fb147aeb14aed445
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed3bc24fe0e8436f9f281262eebaea90207c6e7be6765f01efbe333f06e867be38b9092b3062186edb24690f762788a19c9f6b5a92088b9d83550b2cbd80afdf
|
7
|
+
data.tar.gz: b1cb78997558327ed5846c6c85b2e4ff54e093661918afd01154fb60a4bd174ccf4b007a3579fadbf0bfc72b588ad32f660166c13f457424ef5b84235948086c
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#Adapted from the "fastlane-plugin-test_center" plugin
|
1
2
|
|
2
3
|
require 'nokogiri'
|
3
4
|
require 'nokogiri-plist'
|
@@ -11,9 +12,12 @@ module Fastlane
|
|
11
12
|
if report_filepaths.size == 1
|
12
13
|
FileUtils.cp(report_filepaths[0], params[:collated_report])
|
13
14
|
else
|
15
|
+
#Convert .plist reports to Nokogiri XML objects
|
14
16
|
target_report = File.open(report_filepaths.shift) {|f| Nokogiri::XML(f)}
|
15
17
|
file_name = params[:collated_report] + "/#{params[:scheme]}.test_result/1_Test/action_TestSummaries.plist"
|
16
18
|
reports = report_filepaths.map { |report_filepath| Nokogiri::XML(Nokogiri::PList(open(report_filepath)).to_plist_xml) }
|
19
|
+
|
20
|
+
#Merge .plist reports
|
17
21
|
reports.each do |retry_report|
|
18
22
|
mergeLists(target_report, retry_report, params)
|
19
23
|
end
|
@@ -22,24 +26,15 @@ module Fastlane
|
|
22
26
|
copy_log(params[:logs], params[:collated_report] + "/")
|
23
27
|
end
|
24
28
|
|
25
|
-
def self.clean_report(report)
|
26
|
-
report = report.gsub(/<(\w+): 0x(\w+)>/, '(\1: 0x\2)')
|
27
|
-
report = report.gsub(/<XCAccessibilityElement:\/>0x(\w+)/, '(XCAccessibilityElement): 0x\1')
|
28
|
-
report
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.copy_log(log_files, logs_folder)
|
32
|
-
target_log = log_files.shift
|
33
|
-
FileUtils.cp_r(target_log, logs_folder)
|
34
|
-
end
|
35
|
-
|
36
29
|
def self.mergeLists(target_report, retry_report, params)
|
37
30
|
retry_report = clean_report(retry_report)
|
38
|
-
UI.verbose("Merging retried results...")
|
39
31
|
Dir.mkdir(params[:collated_report]) unless File.exists?(params[:collated_report])
|
40
32
|
file_name = params[:collated_report] + "/action_TestSummaries.plist"
|
41
33
|
retried_tests = retry_report.xpath("//key[contains(.,'TestSummaryGUID')]/..")
|
34
|
+
|
42
35
|
current_node = retried_tests.shift
|
36
|
+
|
37
|
+
#Copy retried test results into the base report
|
43
38
|
while (current_node != nil)
|
44
39
|
testName = get_test_name(current_node)
|
45
40
|
matching_node = target_report.at_xpath("//string[contains(.,'#{testName}')]/..")
|
@@ -52,28 +47,37 @@ module Fastlane
|
|
52
47
|
end
|
53
48
|
end
|
54
49
|
|
50
|
+
def self.clean_report(report)
|
51
|
+
report = report.gsub(/<(\w+): 0x(\w+)>/, '(\1: 0x\2)')
|
52
|
+
report = report.gsub(/<XCAccessibilityElement:\/>0x(\w+)/, '(XCAccessibilityElement): 0x\1')
|
53
|
+
report
|
54
|
+
end
|
55
|
+
|
55
56
|
def self.merge_assets(asset_files, assets_folder)
|
56
|
-
|
57
|
+
#copy screenshots from all retries into the results folder
|
57
58
|
Dir.mkdir(assets_folder) unless File.exists?(assets_folder)
|
58
59
|
asset_files.each do |folder|
|
59
60
|
FileUtils.cp_r(Dir[folder + '/*'], assets_folder)
|
60
61
|
end
|
61
62
|
end
|
62
63
|
|
64
|
+
def self.copy_log(log_files, logs_folder)
|
65
|
+
target_log = log_files.shift
|
66
|
+
FileUtils.cp_r(target_log, logs_folder)
|
67
|
+
end
|
68
|
+
|
63
69
|
def self.merge_logs(log_files, logs_folder)
|
64
70
|
UI.verbose("Merging console logs...")
|
71
|
+
all = ""
|
65
72
|
target_log = log_files.shift
|
66
73
|
log_files.each do |log|
|
67
|
-
|
68
|
-
File.open(target_log, "a") do |handle|
|
69
|
-
handle.puts to_append
|
70
|
-
end
|
71
|
-
FileUtils.cp_r(target_log, logs_folder)
|
74
|
+
all = all + log + " "
|
72
75
|
end
|
76
|
+
sh("cat #{all}> #{target_log}")
|
77
|
+
FileUtils.cp_r(target_log, logs_folder)
|
73
78
|
end
|
74
79
|
|
75
80
|
def self.write_report_to_file(report, file_name)
|
76
|
-
UI.verbose("Writing merged results to file...")
|
77
81
|
File.new(file_name, 'w')
|
78
82
|
File.open(file_name, 'w') do |f|
|
79
83
|
f.write(report.to_xml)
|
@@ -167,6 +171,7 @@ module Fastlane
|
|
167
171
|
end
|
168
172
|
|
169
173
|
def self.authors
|
174
|
+
#Adapted from the "fastlane-plugin-test_center" plugin by:
|
170
175
|
["lyndsey-ferguson/@lyndseydf"]
|
171
176
|
end
|
172
177
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
#Adapted from the "fastlane-plugin-test_center" plugin
|
2
|
+
|
1
3
|
module Fastlane
|
2
4
|
module Actions
|
3
5
|
require 'fastlane/actions/scan'
|
@@ -5,6 +7,7 @@ module Fastlane
|
|
5
7
|
|
6
8
|
class MultiScanAction < Action
|
7
9
|
def self.run(params)
|
10
|
+
=begin
|
8
11
|
try_count = 0
|
9
12
|
scan_options = params.values.reject { |k| k == :try_count }
|
10
13
|
final_report_path = scan_options[:result_bundle]
|
@@ -23,7 +26,8 @@ module Fastlane
|
|
23
26
|
config = FastlaneCore::Configuration.create(Fastlane::Actions::ScanAction.available_options, scan_options)
|
24
27
|
Fastlane::Actions::ScanAction.run(config)
|
25
28
|
rescue FastlaneCore::Interface::FastlaneTestFailure => e
|
26
|
-
UI.verbose("Scan failed with #{e}")
|
29
|
+
FastlaneCore::UI.verbose("Scan failed with error #{e}")
|
30
|
+
#Retry for the specified number of times if there were failed tests
|
27
31
|
if try_count < params[:try_count]
|
28
32
|
report_filepath = junit_report_filepath(scan_options)
|
29
33
|
failed_tests = other_action.tests_from_junit(junit: report_filepath)[:failed]
|
@@ -31,6 +35,7 @@ module Fastlane
|
|
31
35
|
retry
|
32
36
|
end
|
33
37
|
end
|
38
|
+
=end
|
34
39
|
merge_reports(scan_options, final_report_path)
|
35
40
|
end
|
36
41
|
|
@@ -40,7 +45,6 @@ module Fastlane
|
|
40
45
|
asset_files = Dir.glob("#{folder}*/#{scan_options[:scheme]}.test_result/1_Test/Attachments")
|
41
46
|
log_files = Dir.glob("#{folder}*/#{scan_options[:scheme]}.test_result/1_Test/action.xcactivitylog")
|
42
47
|
#Merge all reports, screenshots, and logs if there were retried tests
|
43
|
-
|
44
48
|
if report_files.size > 1
|
45
49
|
other_action.collate_junit_reports(
|
46
50
|
scheme: scan_options[:scheme],
|
@@ -132,6 +136,7 @@ module Fastlane
|
|
132
136
|
end
|
133
137
|
|
134
138
|
def self.authors
|
139
|
+
#Adapted from the "fastlane-plugin-test_center" plugin by:
|
135
140
|
["lyndsey-ferguson/@lyndseydf"]
|
136
141
|
end
|
137
142
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
require 'fastlane/plugin/retry_tests/version'
|
2
2
|
|
3
3
|
module Fastlane
|
4
|
-
module
|
4
|
+
module RetryTests
|
5
5
|
# Return all .rb files inside the "actions" and "helper" directory
|
6
6
|
def self.all_classes
|
7
7
|
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
@@ -11,6 +11,6 @@ end
|
|
11
11
|
|
12
12
|
# By default we want to import all available actions and helpers
|
13
13
|
# A plugin can contain any number of actions and plugins
|
14
|
-
Fastlane::
|
14
|
+
Fastlane::RetryTests.all_classes.each do |current|
|
15
15
|
require current
|
16
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-retry_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gloria Chow
|
@@ -217,5 +217,5 @@ rubyforge_project:
|
|
217
217
|
rubygems_version: 2.6.14
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
|
-
summary: Makes testing your iOS app easier
|
220
|
+
summary: Makes testing your iOS app easier
|
221
221
|
test_files: []
|