fastlane-plugin-xcresult_to_junit 0.2.0 → 0.2.1
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: 93cee4a6855a642b868a73b1d2ecc8715bf1fc22b72b2a2c788ce3e03c6868fa
|
4
|
+
data.tar.gz: cc7f640bb15c9d964d5c4d16eca0f2bfc8607a6aa920c235c05e19496cb7bcd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8350ff9eb38513f6e04a34a8e1c11d3b5c3c577c215b6985c9759e6345b8c7e6753c779c6c2558a814301cb1cd3976f0f7e08ca1e2e3712fc4a89c66fc7eb10e
|
7
|
+
data.tar.gz: b31ec515d9ea3b7b58b9ff404c6f571b72034adafedf189404317f0ae0ab0d0c3d26180b69f5c959c5f25ff44121e62dd3bbd0bbc18a67a0b61a2c1844aeb89a
|
@@ -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']
|
@@ -29,15 +31,24 @@ module Fastlane
|
|
29
31
|
duration = 0
|
30
32
|
duration = test['duration']['_value'] if test['duration']
|
31
33
|
testcase_name = test['name']['_value'].tr('()', '')
|
34
|
+
tags = testcase_name.split('_')[1..-1]
|
35
|
+
testcase_name = testcase_name.split('_').first
|
32
36
|
testcase = { name: testcase_name, time: duration }
|
37
|
+
map["#{suite_name}.#{testcase_name}"] = {'files' => [], 'tags' => tags}
|
33
38
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
summary['attachments']
|
39
|
-
|
40
|
-
|
39
|
+
if test['summaryRef']
|
40
|
+
summaryRef = test['summaryRef']['id']['_value']
|
41
|
+
ref = Helper::XcresultToJunitHelper.load_object(params[:xcresult_path], summaryRef)['activitySummaries']['_values']
|
42
|
+
ref.each do |summary|
|
43
|
+
if summary['attachments']
|
44
|
+
summary['attachments']['_values'].each do |attachment|
|
45
|
+
timestamp = DateTime.parse(attachment['timestamp']['_value']).to_time.to_i
|
46
|
+
name = attachment['name']['_value']
|
47
|
+
folder_name = "#{suite_name}.#{testcase_name}"
|
48
|
+
id = attachment['payloadRef']['id']['_value']
|
49
|
+
Helper::XcresultToJunitHelper.fetch_screenshot(params[:xcresult_path], "#{junit_folder}/attachments/#{folder_name}", "#{id}.png", id)
|
50
|
+
map[folder_name]['files'].push({'description' => name, 'mime-type' => 'image/png', 'path' => "#{folder_name}/#{id}.png", 'timestamp' => timestamp})
|
51
|
+
end
|
41
52
|
end
|
42
53
|
end
|
43
54
|
end
|
@@ -63,6 +74,7 @@ module Fastlane
|
|
63
74
|
end
|
64
75
|
end
|
65
76
|
Helper::XcresultToJunitHelper.generate_junit(junit_folder, test_suites)
|
77
|
+
Helper::XcresultToJunitHelper.save_screenshot_mapping(map, "#{junit_folder}/attachments/")
|
66
78
|
end
|
67
79
|
end
|
68
80
|
UI.message("The xcresult_to_junit plugin has finished!")
|
@@ -22,6 +22,12 @@ module Fastlane
|
|
22
22
|
JSON.load FastlaneCore::CommandExecutor.execute(command: "xcrun xcresulttool export --path #{xcresult_path} --output-path #{output_path}/#{file_name} --id #{id} --type file")
|
23
23
|
end
|
24
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
|
29
|
+
end
|
30
|
+
|
25
31
|
def self.save_device_details_to_file(output_path, device_destination)
|
26
32
|
device_udid = device_destination['targetDeviceRecord']['identifier']['_value']
|
27
33
|
device_details = {
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Birdsall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -167,7 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
|
-
|
170
|
+
rubyforge_project:
|
171
|
+
rubygems_version: 2.7.6.2
|
171
172
|
signing_key:
|
172
173
|
specification_version: 4
|
173
174
|
summary: Produces junit xml files from Xcode 11+ xcresult files
|