fastlane-plugin-retry 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf7d989288a94f8f5b9ad304cb3602330b42eb2b06c705d26cb9ebda859996f8
|
4
|
+
data.tar.gz: 0f1a78cb7988a9d7a3e09795f7f7c62e17c6998b116a630e83d0fe2640ad6411
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50c1aec0645d67957b94a8ad0a1878769cfea0807223738bbcf26e4781e71ae815c68a3b5bb58f8a23a9fc0f44b773d8a13ed368081cfed9a82ef7a9c2777764
|
7
|
+
data.tar.gz: 235e9dd814f07cd40f048942f78debebd3e3a52b1e2c2719e668ada64b0676d656541c7c140b2ebcb68f46a91ced9ccf6d503eaf49689d10c192c59e6a51e0c1
|
data/README.md
CHANGED
@@ -2,49 +2,41 @@
|
|
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-retry)
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
This plugin works with the following logic:
|
8
|
-
1) Run the whole test suite once
|
9
|
-
2) Parse the generated .plist results to obtain a list of the failed tests
|
10
|
-
3) Retry the failed tests an 'x' number of times (see below for how to specify the number of retries) and generate a .plist report for each retry run
|
11
|
-
4) Merge all .plist reports together to generate one final .plist report
|
12
|
-
|
13
|
-
Tip: You can then use the final .plist report with the [XCHtmlReport plugin](https://github.com/TitouanVanBelle/XCTestHTMLReport) to generate a very beautiful HTML report including screenshots and console logs! See the sample fastfile for usage.
|
5
|
+
Retries failed XCUITest test cases.
|
14
6
|
|
15
7
|
This plugin is available in the [Ruby Gems directory](https://rubygems.org/gems/fastlane-plugin-retry).
|
16
8
|
|
9
|
+
|
17
10
|
## Installation
|
18
11
|
|
19
12
|
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-retry`, add it to your project by running:
|
20
13
|
|
21
|
-
```
|
14
|
+
```bash
|
22
15
|
fastlane add_plugin retry
|
23
|
-
```
|
24
|
-
Check that the command above generated a Pluginfile in your project's fastlane folder. The Pluginfile should contain the following text:
|
25
|
-
```
|
26
|
-
gem 'fastlane-plugin-retry', '~> 1.0', '>= 1.0.5'
|
27
|
-
```
|
28
|
-
Add the following line to your project's Gemfile:
|
29
|
-
```
|
30
|
-
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
|
31
|
-
eval_gemfile(plugins_path) if File.exist?(plugins_path)
|
32
|
-
```
|
33
|
-
Finally, run the following command to install the plugin files to your project's Bundler folder.
|
34
|
-
```
|
35
16
|
bundle install
|
36
17
|
```
|
37
18
|
|
19
|
+
|
38
20
|
## Usage
|
39
21
|
|
40
|
-
See the sample fastfile for how to configure your project's fastfile. Once you have configured your fastfile, use the following command to run your tests with retry (you can change the number of tries and the device).
|
41
22
|
```
|
42
|
-
|
23
|
+
multi_scan(
|
24
|
+
workspace: File.absolute_path('../xxxxxx.xcworkspace'),
|
25
|
+
scheme: 'xxxxxx',
|
26
|
+
try_count: options[:tries],
|
27
|
+
result_bundle: result_bundle_path,
|
28
|
+
output_directory: result_bundle_path,
|
29
|
+
destination: options[:devices],
|
30
|
+
xctestrun: xctestrun_path,
|
31
|
+
test_without_building: true
|
32
|
+
)
|
33
|
+
|
34
|
+
sh("/usr/local/bin/xchtmlreport -r [location of the .plist generated by multi_scan]")
|
43
35
|
```
|
44
36
|
|
45
37
|
## Issues and Feedback
|
46
38
|
|
47
|
-
For any other issues and feedback about this plugin, please submit it to this repository.
|
39
|
+
For any other issues and feedback about this plugin, please submit it to this repository or Slack message to @gloria.
|
48
40
|
|
49
41
|
## Troubleshooting
|
50
42
|
|
@@ -8,19 +8,16 @@ module Fastlane
|
|
8
8
|
|
9
9
|
def self.run(params)
|
10
10
|
report_filepaths = params[:reports].reverse
|
11
|
-
# If no retries are required return the results
|
12
11
|
if report_filepaths.size == 1
|
13
12
|
FileUtils.cp(report_filepaths[0], params[:collated_report])
|
14
13
|
else
|
15
14
|
target_report = File.open(report_filepaths.shift) {|f| Nokogiri::XML(f)}
|
16
15
|
reports = report_filepaths.map { |report_filepath| Nokogiri::XML(Nokogiri::PList(open(report_filepath)).to_plist) }
|
17
|
-
# Clean each retry report and merge it into the first report
|
18
16
|
reports.each do |retry_report|
|
19
17
|
retry_report = clean_report(retry_report.to_s)
|
20
18
|
mergeLists(target_report, retry_report, params)
|
21
19
|
end
|
22
20
|
end
|
23
|
-
# Merge screenshots and console logs from all retry runs
|
24
21
|
merge_assets(params[:assets], params[:collated_report] + "/Attachments")
|
25
22
|
merge_logs(params[:logs], params[:collated_report] + "/")
|
26
23
|
end
|
@@ -33,7 +30,6 @@ module Fastlane
|
|
33
30
|
retried_tests = retry_report.xpath("//key[contains(.,'TestSummaryGUID')]/..")
|
34
31
|
current_node = retried_tests.shift
|
35
32
|
while (current_node != nil)
|
36
|
-
# For each retried test, get the corresponding node of data from the retried report and merge it into the base report
|
37
33
|
testName = get_test_name(current_node)
|
38
34
|
matching_node = target_report.at_xpath("//string[contains(.,'#{testName}')]/..")
|
39
35
|
if (!matching_node.nil?)
|
@@ -55,7 +51,6 @@ module Fastlane
|
|
55
51
|
|
56
52
|
# Cleans formatting of report
|
57
53
|
def self.clean_report(report)
|
58
|
-
# Removes unescaped <> characters which cause the final .plist to become unreadable
|
59
54
|
report = report.gsub("<XCAccessibilityElement:/>0x", " XCAccessibilityElement ")
|
60
55
|
report = report.gsub("<XCAccessibilityElement:></XCAccessibilityElement:>", " XCAccessibilityElement ")
|
61
56
|
report = Nokogiri::XML(report)
|
@@ -38,10 +38,8 @@ module Fastlane
|
|
38
38
|
def self.parse_failures(plist, scheme_name)
|
39
39
|
failures = Array.new
|
40
40
|
target_report = File.open(plist) {|f| Nokogiri::XML(f)}
|
41
|
-
# Get the names of all the failed tests from the specified report
|
42
41
|
failed = target_report.xpath("//key[contains(.,'Failure')]/../key[contains(.,'TestIdentifier')]/following-sibling::string[contains(.,'()') and contains (., '/')]")
|
43
42
|
failed.each do |test_name|
|
44
|
-
# Reformat the test name to be usable by the xcodebuild 'only_testing' flag
|
45
43
|
failures << ("#{scheme_name}/" + test_name.to_s.split('(')[0].split('>')[1])
|
46
44
|
end
|
47
45
|
failures
|
@@ -50,9 +48,9 @@ module Fastlane
|
|
50
48
|
# Merge results from all retries
|
51
49
|
def self.merge_reports(scan_options, final_report_path)
|
52
50
|
folder = get_folder_root(scan_options[:output_directory])
|
53
|
-
report_files = Dir.glob("#{folder}
|
54
|
-
asset_files = Dir.glob("#{folder}
|
55
|
-
log_files = Dir.glob("#{folder}
|
51
|
+
report_files = Dir.glob("#{folder}*/**/action_TestSummaries.plist")
|
52
|
+
asset_files = Dir.glob("#{folder}*/**/Attachments")
|
53
|
+
log_files = Dir.glob("#{folder}*/**/action.xcactivitylog")
|
56
54
|
if report_files.size > 1
|
57
55
|
other_action.collate_junit_reports(
|
58
56
|
reports: report_files,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-retry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gmgchow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|