fastlane-plugin-test_center 3.5.9 → 3.5.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61bc8728dd74fdf047e74386d9cb5cb4b0f0d753
4
- data.tar.gz: 77b98ba834e8fcb18fc3c0189aa757fa6fb1a14f
3
+ metadata.gz: e2f64dd90cd40d23bc5af62990c5a3cec86d729c
4
+ data.tar.gz: 9972b63261d62a37533ab8448ec97853faeca89f
5
5
  SHA512:
6
- metadata.gz: 8b7fdf2acb1a244af23db7584c043e20179c7cf6f9d164c08d94d63055eebcfd5cc467c57b5ae80043408e6e12988f7384e1f21179db27eaf168e71a1b684b48
7
- data.tar.gz: 5f2366303671ed2de76837dd440a496bae487d11a7769171a070850c46c82fae6497b6f24e414d434cbd07c5422658e032d59c06b87db84118c8a8cccca2924a
6
+ metadata.gz: c585ac7539733cecf79d16bc09abbc31169e08a31464ddc3d00c663654d261f4dde76c24fd15ec273e65b2874f027fe6d073683299fa9260d04f5855087d10da
7
+ data.tar.gz: e291cd3e9d74dccdec5f9eb6f01074b3bee7b015cbffcec5b25eabcba3e99fda5f344c4bb44bbf18b4a21900a048e193cb4217ac6bfc9843a1f95313c667e6a4
@@ -6,26 +6,29 @@ module Fastlane
6
6
  if report_filepaths.size == 1
7
7
  FileUtils.cp(report_filepaths[0], params[:collated_report])
8
8
  else
9
+ UI.verbose("collate_junit_reports with #{report_filepaths}")
9
10
  reports = report_filepaths.map { |report_filepath| REXML::Document.new(File.new(report_filepath)) }
10
11
 
11
12
  # copy any missing testsuites
12
13
  target_report = reports.shift
13
- flatten_duplicate_testsuites(target_report)
14
+ preprocess_testsuites(target_report)
14
15
 
15
16
  reports.each do |report|
16
- flatten_duplicate_testsuites(report)
17
-
17
+ preprocess_testsuites(report)
18
+ UI.verbose("> collating last report file #{report_filepaths.last}")
18
19
  report.elements.each('//testsuite') do |testsuite|
19
20
  testsuite_name = testsuite.attributes['name']
20
-
21
21
  target_testsuite = REXML::XPath.first(target_report, "//testsuite[@name='#{testsuite_name}']")
22
22
  if target_testsuite
23
+ UI.verbose(" > collating testsuite #{testsuite_name}")
23
24
  collate_testsuite(target_testsuite, testsuite)
25
+ UI.verbose(" < collating testsuite #{testsuite_name}")
24
26
  else
25
27
  testable = REXML::XPath.first(target_report, "//testsuites")
26
28
  testable << testsuite
27
29
  end
28
30
  end
31
+ UI.verbose("< collating last report file #{report_filepaths.last}")
29
32
  end
30
33
  target_report.elements.each('//testsuite') do |testsuite|
31
34
  update_testsuite_counts(testsuite)
@@ -40,18 +43,47 @@ module Fastlane
40
43
  end
41
44
  end
42
45
 
43
- def self.flatten_duplicate_testsuites(report)
44
- report.elements.each('//testsuite') do |testsuite|
45
- testsuite_name = testsuite.attributes['name']
46
+ def self.collapse_testcase_multiple_failures_in_testsuite(testsuite)
47
+ testcases_with_failures = REXML::XPath.match(testsuite, 'testcase[failure]')
46
48
 
47
- duplicate_testsuites = REXML::XPath.match(report, "//testsuite[@name='#{testsuite_name}']")
48
- if duplicate_testsuites.size > 1
49
- duplicate_testsuites.drop(1).each do |duplicate_testsuite|
50
- collate_testsuite(testsuite, duplicate_testsuite)
51
- duplicate_testsuite.parent.delete_element(duplicate_testsuite)
52
- end
49
+ while testcases_with_failures.size > 1
50
+ target_testcase = testcases_with_failures.shift
51
+
52
+ name = target_testcase.attributes['name']
53
+ classname = target_testcase.attributes['classname']
54
+
55
+ failures = REXML::XPath.match(testsuite, "testcase[@name='#{name}'][@classname='#{classname}']/failure")
56
+ next unless failures.size > 1
57
+
58
+ failures[1..-1].each do |failure|
59
+ failure_clone = failure.clone
60
+ failure_clone.text = failure.text
61
+ target_testcase << failure_clone
62
+
63
+ testsuite.delete_element(failure.parent)
64
+ testcases_with_failures.delete(failure.parent)
53
65
  end
54
- update_testsuite_counts(testsuite)
66
+ end
67
+ end
68
+
69
+ def self.flatten_duplicate_testsuites(report, testsuite)
70
+ testsuite_name = testsuite.attributes['name']
71
+ duplicate_testsuites = REXML::XPath.match(report, "//testsuite[@name='#{testsuite_name}']")
72
+ if duplicate_testsuites.size > 1
73
+ UI.verbose(" > flattening_duplicate_testsuites")
74
+ duplicate_testsuites.drop(1).each do |duplicate_testsuite|
75
+ collate_testsuite(testsuite, duplicate_testsuite)
76
+ duplicate_testsuite.parent.delete_element(duplicate_testsuite)
77
+ end
78
+ UI.verbose(" < flattening_duplicate_testsuites")
79
+ end
80
+ update_testsuite_counts(testsuite)
81
+ end
82
+
83
+ def self.preprocess_testsuites(report)
84
+ report.elements.each('//testsuite') do |testsuite|
85
+ flatten_duplicate_testsuites(report, testsuite)
86
+ collapse_testcase_multiple_failures_in_testsuite(testsuite)
55
87
  end
56
88
  end
57
89
 
@@ -61,9 +93,14 @@ module Fastlane
61
93
  name = testcase.attributes['name']
62
94
  target_testcase = REXML::XPath.first(target_testsuite, "testcase[@name='#{name}' and @classname='#{classname}']")
63
95
  # Replace target_testcase with testcase
64
- if target_testcase
65
- target_testcase.parent.insert_after(target_testcase, testcase)
66
- target_testcase.parent.delete_element(target_testcase)
96
+ if target_testcase
97
+ UI.verbose(" collate_testsuite with testcase #{name}")
98
+ UI.verbose(" replacing \"#{target_testcase}\" with \"#{testcase}\"")
99
+ parent = target_testcase.parent
100
+ parent.insert_after(target_testcase, testcase)
101
+ parent.delete_element(target_testcase)
102
+ UI.verbose("")
103
+ UI.verbose(" target_testcase after replacement \"#{parent}\"")
67
104
  else
68
105
  target_testsuite << testcase
69
106
  end
@@ -21,9 +21,6 @@ module Fastlane
21
21
  end
22
22
  smart_scanner = ::TestCenter::Helper::CorrectingScanHelper.new(params.values)
23
23
  tests_passed = smart_scanner.scan
24
- if params[:fail_build] && !tests_passed
25
- raise UI.test_failure!('Tests have failed')
26
- end
27
24
  summary = run_summary(params, tests_passed, smart_scanner.retry_total_count)
28
25
  unless Helper.test?
29
26
  FastlaneCore::PrintTable.print_values(
@@ -31,6 +28,9 @@ module Fastlane
31
28
  title: "multi_scan results"
32
29
  )
33
30
  end
31
+ if params[:fail_build] && !tests_passed
32
+ raise UI.test_failure!('Tests have failed')
33
+ end
34
34
  summary
35
35
  end
36
36
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TestCenter
3
- VERSION = "3.5.9"
3
+ VERSION = "3.5.10"
4
4
  end
5
5
  end
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.5.9
4
+ version: 3.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-01 00:00:00.000000000 Z
11
+ date: 2018-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json