fastlane-plugin-xcresult_to_junit 0.2.0 → 0.2.5
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: f8ea55f58789c5cc56abd231d9ffeaa21e51ecddf242de33ad17bce1bf15c059
|
4
|
+
data.tar.gz: 50b033dfc0caa9e5fe1eecc90d94afa342e4dfdc1466b0a157354cc500da4420
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88a65b73cb50b3ac83b61b00734f0bbdfe85de3dd5761ca57ac10a81db5716e9ea9e5564b04a43847bfac65a3ded8fd9821ac7a8be117fe3fd66ce77ea520439
|
7
|
+
data.tar.gz: 8d67362431ba0968263d54f1118dc9910278fc190440533b2c3aed8e22ed6eebe2fe2f84044b4d70bc3583ee042eae8154ec71f6b371dfa187953a89d8a694c0
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'date'
|
1
2
|
require 'fastlane/action'
|
2
3
|
require_relative '../helper/xcresult_to_junit_helper'
|
3
4
|
|
@@ -9,6 +10,7 @@ module Fastlane
|
|
9
10
|
all_results = Helper::XcresultToJunitHelper.load_results(params[:xcresult_path])['actions']['_values']
|
10
11
|
all_results.each do |test_run|
|
11
12
|
if test_run['actionResult']['testsRef'] # Skip if section has no testRef data as this means its not a test run
|
13
|
+
map = {}
|
12
14
|
junit_folder = Helper::XcresultToJunitHelper.save_device_details_to_file(params[:output_path], test_run['runDestination'])
|
13
15
|
test_run_id = test_run['actionResult']['testsRef']['id']['_value']
|
14
16
|
all_tests = Helper::XcresultToJunitHelper.load_object(params[:xcresult_path], test_run_id)['summaries']['_values'][0]['testableSummaries']['_values']
|
@@ -20,7 +22,10 @@ module Fastlane
|
|
20
22
|
test_suites << { name: target_name, error: failure_summary['message']['_value'] }
|
21
23
|
next
|
22
24
|
end
|
23
|
-
test_classes =
|
25
|
+
test_classes = []
|
26
|
+
if defined?(target['tests']['_values'][0]['subtests']['_values'][0]['subtests']['_values'])
|
27
|
+
test_classes = target['tests']['_values'][0]['subtests']['_values'][0]['subtests']['_values']
|
28
|
+
end
|
24
29
|
test_classes.each do |test_class|
|
25
30
|
suite_name = "#{target_name}.#{test_class['name']['_value']}"
|
26
31
|
suite = { name: suite_name, cases: [] }
|
@@ -29,16 +34,57 @@ module Fastlane
|
|
29
34
|
duration = 0
|
30
35
|
duration = test['duration']['_value'] if test['duration']
|
31
36
|
testcase_name = test['name']['_value'].tr('()', '')
|
37
|
+
tags = testcase_name.split('_')[1..-1]
|
38
|
+
testcase_name = testcase_name.split('_').first
|
32
39
|
testcase = { name: testcase_name, time: duration }
|
40
|
+
map["#{suite_name}.#{testcase_name}"] = {'files' => [], 'tags' => tags}
|
41
|
+
|
42
|
+
if defined?(test['summaryRef']['id']['_value'])
|
43
|
+
summaryRef = test['summaryRef']['id']['_value']
|
44
|
+
ref = Helper::XcresultToJunitHelper.load_object(params[:xcresult_path], summaryRef)
|
45
|
+
if defined?(ref['activitySummaries']['_values'])
|
46
|
+
ref['activitySummaries']['_values'].each do |summary|
|
47
|
+
if summary['attachments']
|
48
|
+
summary['attachments']['_values'].each do |attachment|
|
49
|
+
timestamp = DateTime.parse(attachment['timestamp']['_value']).to_time.to_i
|
50
|
+
filename = attachment['filename']['_value']
|
51
|
+
name = attachment['name']['_value']
|
52
|
+
folder_name = "#{suite_name}.#{testcase_name}"
|
53
|
+
id = attachment['payloadRef']['id']['_value']
|
54
|
+
Helper::XcresultToJunitHelper.fetch_screenshot(params[:xcresult_path], "#{junit_folder}/attachments/#{folder_name}", "#{filename}", id)
|
55
|
+
map[folder_name]['files'].push({'description' => name, 'mime-type' => 'image/png', 'path' => "#{folder_name}/#{filename}", 'timestamp' => timestamp})
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
33
60
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
61
|
+
if defined?(ref['performanceMetrics']['_value'])
|
62
|
+
performancemetrics = ""
|
63
|
+
ref['performanceMetrics']['_values'].each do |metric|
|
64
|
+
metricname = metric['displayName']['_value']
|
65
|
+
if defined?(metric['baselineAverage']['_value'])
|
66
|
+
metricbaseline = metric['baselineAverage']['_value']
|
67
|
+
else
|
68
|
+
metricbaseline = 0
|
69
|
+
end
|
70
|
+
metricmaxdev = metric['maxPercentRelativeStandardDeviation']['_value']
|
71
|
+
metricunit = metric['unitOfMeasurement']['_value']
|
72
|
+
metricave = 0
|
73
|
+
measurecount = 0
|
74
|
+
metric['measurements']['_values'].each do |measure|
|
75
|
+
metricave = metricave + measure['_value'].to_f
|
76
|
+
measurecount += 1
|
77
|
+
end
|
78
|
+
metricave = (metricave/measurecount).round(2)
|
79
|
+
if metricbaseline != 0
|
80
|
+
metricresult = (((metricbaseline.to_f-metricave)/metricbaseline.to_f)*100).round(2)
|
81
|
+
else
|
82
|
+
metricresult = 0
|
83
|
+
end
|
84
|
+
performancemetric = "\nMetric: #{metricname}\nResult: #{metricresult}%\nAverage: #{metricave}#{metricunit}\nBaseline: #{metricbaseline}#{metricunit}\nMax Deviation: #{metricmaxdev}%\n\n"
|
85
|
+
performancemetrics << performancemetric
|
41
86
|
end
|
87
|
+
testcase[:performance] = performancemetrics
|
42
88
|
end
|
43
89
|
end
|
44
90
|
|
@@ -63,6 +109,7 @@ module Fastlane
|
|
63
109
|
end
|
64
110
|
end
|
65
111
|
Helper::XcresultToJunitHelper.generate_junit(junit_folder, test_suites)
|
112
|
+
Helper::XcresultToJunitHelper.save_screenshot_mapping(map, "#{junit_folder}/attachments/")
|
66
113
|
end
|
67
114
|
end
|
68
115
|
UI.message("The xcresult_to_junit plugin has finished!")
|
@@ -19,7 +19,13 @@ module Fastlane
|
|
19
19
|
if !File.directory?(output_path)
|
20
20
|
FileUtils.mkdir output_path
|
21
21
|
end
|
22
|
-
JSON.load FastlaneCore::CommandExecutor.execute(command: "xcrun xcresulttool export --path #{xcresult_path} --output-path #{output_path}/#{file_name} --id #{id} --type file")
|
22
|
+
JSON.load FastlaneCore::CommandExecutor.execute(command: "xcrun xcresulttool export --path #{xcresult_path} --output-path \"#{output_path}/#{file_name}\" --id #{id} --type file")
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.save_screenshot_mapping(map_hash, output_path)
|
26
|
+
File.open("#{output_path}/map.json", 'w') do |f|
|
27
|
+
f << map_hash.to_json
|
28
|
+
end
|
23
29
|
end
|
24
30
|
|
25
31
|
def self.save_device_details_to_file(output_path, device_destination)
|
@@ -63,23 +69,23 @@ module Fastlane
|
|
63
69
|
end
|
64
70
|
|
65
71
|
def self.junit_testcase_start(suite, testcase)
|
66
|
-
print "<testcase name=#{testcase[:name].encode xml: :attr} classname=#{suite[:name].encode xml: :attr} time='#{testcase[:time]}'"
|
72
|
+
print "<testcase name=#{testcase[:name].encode xml: :attr} classname=#{suite[:name].encode xml: :attr} time='#{testcase[:time]}'>"
|
67
73
|
end
|
68
74
|
|
69
|
-
def self.
|
70
|
-
puts '
|
75
|
+
def self.junit_testcase_end
|
76
|
+
puts '</testcase>'
|
71
77
|
end
|
72
78
|
|
73
79
|
def self.junit_testcase_failure(testcase)
|
74
|
-
puts '>'
|
75
80
|
puts "<failure message=#{testcase[:failure].encode xml: :attr}>#{testcase[:failure_location].encode xml: :text}</failure>"
|
76
|
-
puts '</testcase>'
|
77
81
|
end
|
78
82
|
|
79
83
|
def self.junit_testcase_error(testcase)
|
80
|
-
puts '>'
|
81
84
|
puts "<error>#{testcase[:error].encode xml: :text}</error>"
|
82
|
-
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.junit_testcase_performance(testcase)
|
88
|
+
puts "<system-out>#{testcase[:performance]}</system-out>"
|
83
89
|
end
|
84
90
|
|
85
91
|
def self.generate_junit(junit_folder, test_suites)
|
@@ -98,9 +104,11 @@ module Fastlane
|
|
98
104
|
Helper::XcresultToJunitHelper.junit_testcase_failure(testcase)
|
99
105
|
elsif testcase[:error]
|
100
106
|
Helper::XcresultToJunitHelper.junit_testcase_error(testcase)
|
101
|
-
else
|
102
|
-
Helper::XcresultToJunitHelper.junit_testcase_success()
|
103
107
|
end
|
108
|
+
if testcase[:performance]
|
109
|
+
Helper::XcresultToJunitHelper.junit_testcase_performance(testcase)
|
110
|
+
end
|
111
|
+
Helper::XcresultToJunitHelper.junit_testcase_end
|
104
112
|
end
|
105
113
|
end
|
106
114
|
Helper::XcresultToJunitHelper.junit_suite_end()
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-xcresult_to_junit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Birdsall
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 2.134.0
|
139
|
-
description:
|
139
|
+
description:
|
140
140
|
email: shane.birdsall@fiserv.com
|
141
141
|
executables: []
|
142
142
|
extensions: []
|
@@ -152,7 +152,7 @@ homepage: https://github.com/zanizrules/fastlane-plugin-xcresult_to_junit
|
|
152
152
|
licenses:
|
153
153
|
- MIT
|
154
154
|
metadata: {}
|
155
|
-
post_install_message:
|
155
|
+
post_install_message:
|
156
156
|
rdoc_options: []
|
157
157
|
require_paths:
|
158
158
|
- lib
|
@@ -167,8 +167,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
|
-
|
171
|
-
|
170
|
+
rubyforge_project:
|
171
|
+
rubygems_version: 2.7.6.2
|
172
|
+
signing_key:
|
172
173
|
specification_version: 4
|
173
174
|
summary: Produces junit xml files from Xcode 11+ xcresult files
|
174
175
|
test_files: []
|