fastlane-plugin-test_center 3.14.1 → 3.14.2
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/test_center/actions/collate_test_result_bundles.rb +6 -4
- data/lib/fastlane/plugin/test_center/actions/collate_xcresults.rb +9 -5
- data/lib/fastlane/plugin/test_center/actions/multi_scan.rb +83 -1
- data/lib/fastlane/plugin/test_center/actions/tests_from_xcresult.rb +103 -0
- data/lib/fastlane/plugin/test_center/version.rb +1 -1
- metadata +21 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5110e6b44d55945155e5769bf07fa9a1883521d125349f0d06211eea98014d14
|
4
|
+
data.tar.gz: ae0ffaa0f14c026a2ffdf2413f9b119142a130ba530742746715f2338cd058d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00eeb25839214b31b2cdf248f0daa5978fba3a3e1e03c31b994bf24b618e6fd56588a2e2c41c4b6610346892c5a4460db0df854c78014b2aafdf3ee1651b37cb
|
7
|
+
data.tar.gz: 4928830dfca2a60011d1435ee38532bebfb4d9e7b3887cd3088f1a7dcc26fe503028229b4d73d64e04d166ac21ee25d8bd8641a0a8b30e4eb96400e160d932e5
|
@@ -221,10 +221,12 @@ module Fastlane
|
|
221
221
|
'collate the test_result bundles to a temporary bundle \"result.test_result\"'
|
222
222
|
)
|
223
223
|
bundles = Dir['../spec/fixtures/*.test_result'].map { |relpath| File.absolute_path(relpath) }
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
224
|
+
Dir.mktmpdir('test_output') do |dir|
|
225
|
+
collate_test_result_bundles(
|
226
|
+
bundles: bundles,
|
227
|
+
collated_bundle: File.join(dir, 'result.test_result')
|
228
|
+
)
|
229
|
+
end
|
228
230
|
"
|
229
231
|
]
|
230
232
|
end
|
@@ -86,15 +86,19 @@ module Fastlane
|
|
86
86
|
def self.example_code
|
87
87
|
[
|
88
88
|
"
|
89
|
+
require 'tmpdir'
|
90
|
+
|
89
91
|
UI.important(
|
90
92
|
'example: ' \\
|
91
93
|
'collate the xcresult bundles to a temporary xcresult bundle \"result.xcresult\"'
|
92
94
|
)
|
93
|
-
xcresults = Dir['../spec/fixtures
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
95
|
+
xcresults = Dir['../spec/fixtures/AtomicBoyUITests-batch-{3,4}/result.xcresult'].map { |relpath| File.absolute_path(relpath) }
|
96
|
+
Dir.mktmpdir('test_output') do |dir|
|
97
|
+
collate_xcresults(
|
98
|
+
xcresults: xcresults,
|
99
|
+
collated_xcresult: File.join(dir, 'result.xcresult')
|
100
|
+
)
|
101
|
+
end
|
98
102
|
"
|
99
103
|
]
|
100
104
|
end
|
@@ -171,7 +171,10 @@ module Fastlane
|
|
171
171
|
use_scanfile_to_override_settings(scan_options)
|
172
172
|
turn_off_concurrent_workers(scan_options)
|
173
173
|
UI.important("Turning off :skip_build as it doesn't do anything with multi_scan") if scan_options[:skip_build]
|
174
|
-
scan_options
|
174
|
+
if scan_options[:disable_xcpretty]
|
175
|
+
UI.important("Turning off :disable_xcpretty as xcpretty is needed to generate junit reports for retrying failed tests")
|
176
|
+
end
|
177
|
+
scan_options.reject! { |k,v| %i[skip_build disable_xcpretty].include?(k) }
|
175
178
|
ScanHelper.remove_preexisting_simulator_logs(scan_options)
|
176
179
|
if scan_options[:test_without_building]
|
177
180
|
UI.verbose("Preparing Scan config options for multi_scan testing")
|
@@ -487,6 +490,85 @@ module Fastlane
|
|
487
490
|
]
|
488
491
|
end
|
489
492
|
|
493
|
+
def self.integration_tests
|
494
|
+
[
|
495
|
+
"
|
496
|
+
UI.header('Basic test')
|
497
|
+
multi_scan(
|
498
|
+
workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
|
499
|
+
scheme: 'AtomicBoy',
|
500
|
+
fail_build: false,
|
501
|
+
try_count: 2,
|
502
|
+
disable_xcpretty: true
|
503
|
+
)
|
504
|
+
",
|
505
|
+
"
|
506
|
+
UI.header('Basic test with 1 specific test')
|
507
|
+
multi_scan(
|
508
|
+
workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
|
509
|
+
scheme: 'AtomicBoy',
|
510
|
+
fail_build: false,
|
511
|
+
try_count: 2,
|
512
|
+
only_testing: ['AtomicBoyUITests/AtomicBoyUITests/testExample']
|
513
|
+
)
|
514
|
+
",
|
515
|
+
"
|
516
|
+
UI.header('Basic test with test target expansion')
|
517
|
+
multi_scan(
|
518
|
+
workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
|
519
|
+
scheme: 'AtomicBoy',
|
520
|
+
fail_build: false,
|
521
|
+
try_count: 2,
|
522
|
+
only_testing: ['AtomicBoyUITests', 'AtomicBoyTests']
|
523
|
+
)
|
524
|
+
",
|
525
|
+
"
|
526
|
+
UI.header('Parallel test run')
|
527
|
+
multi_scan(
|
528
|
+
workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
|
529
|
+
scheme: 'AtomicBoy',
|
530
|
+
fail_build: false,
|
531
|
+
try_count: 2,
|
532
|
+
parallel_testrun_count: 2
|
533
|
+
)
|
534
|
+
",
|
535
|
+
"
|
536
|
+
UI.header('Parallel test run with fewer tests than parallel test runs')
|
537
|
+
multi_scan(
|
538
|
+
workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
|
539
|
+
scheme: 'AtomicBoy',
|
540
|
+
fail_build: false,
|
541
|
+
try_count: 2,
|
542
|
+
parallel_testrun_count: 4,
|
543
|
+
only_testing: ['AtomicBoyUITests/AtomicBoyUITests/testExample']
|
544
|
+
)
|
545
|
+
",
|
546
|
+
"
|
547
|
+
UI.header('Basic test with batches')
|
548
|
+
multi_scan(
|
549
|
+
workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
|
550
|
+
scheme: 'AtomicBoy',
|
551
|
+
fail_build: false,
|
552
|
+
try_count: 2,
|
553
|
+
batch_count: 2
|
554
|
+
)
|
555
|
+
",
|
556
|
+
"
|
557
|
+
UI.header('Basic test with xcresult')
|
558
|
+
multi_scan(
|
559
|
+
workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
|
560
|
+
scheme: 'AtomicBoy',
|
561
|
+
output_types: 'xcresult',
|
562
|
+
output_files: 'result.xcresult',
|
563
|
+
collate_reports: false,
|
564
|
+
fail_build: false,
|
565
|
+
try_count: 2,
|
566
|
+
batch_count: 2
|
567
|
+
)
|
568
|
+
"
|
569
|
+
]
|
570
|
+
end
|
571
|
+
|
490
572
|
def self.authors
|
491
573
|
["lyndsey-ferguson/@lyndseydf"]
|
492
574
|
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'trainer'
|
2
|
+
require 'shellwords'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class TestsFromXcresultAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
unless FastlaneCore::Helper.xcode_at_least?('11.0.0')
|
9
|
+
UI.error("Error: tests_from_xcresult requires at least Xcode 11.0")
|
10
|
+
return {}
|
11
|
+
end
|
12
|
+
|
13
|
+
xcresult_path = File.absolute_path(params[:xcresult])
|
14
|
+
|
15
|
+
# taken from the rubygem trainer, in the test_parser.rb module
|
16
|
+
result_bundle_object_raw = sh("xcrun xcresulttool get --path #{xcresult_path.shellescape} --format json", print_command: false, print_command_output: false)
|
17
|
+
result_bundle_object = JSON.parse(result_bundle_object_raw)
|
18
|
+
|
19
|
+
# Parses JSON into ActionsInvocationRecord to find a list of all ids for ActionTestPlanRunSummaries
|
20
|
+
actions_invocation_record = Trainer::XCResult::ActionsInvocationRecord.new(result_bundle_object)
|
21
|
+
test_refs = actions_invocation_record.actions.map do |action|
|
22
|
+
action.action_result.tests_ref
|
23
|
+
end.compact
|
24
|
+
|
25
|
+
ids = test_refs.map(&:id)
|
26
|
+
summaries = ids.map do |id|
|
27
|
+
raw = sh("xcrun xcresulttool get --format json --path #{xcresult_path.shellescape} --id #{id}", print_command: false, print_command_output: false)
|
28
|
+
json = JSON.parse(raw)
|
29
|
+
Trainer::XCResult::ActionTestPlanRunSummaries.new(json)
|
30
|
+
end
|
31
|
+
failures = actions_invocation_record.issues.test_failure_summaries || []
|
32
|
+
all_summaries = summaries.map(&:summaries).flatten
|
33
|
+
testable_summaries = all_summaries.map(&:testable_summaries).flatten
|
34
|
+
failed = []
|
35
|
+
passing = []
|
36
|
+
failure_details = {}
|
37
|
+
rows = testable_summaries.map do |testable_summary|
|
38
|
+
all_tests = testable_summary.all_tests.flatten
|
39
|
+
all_tests.each do |t|
|
40
|
+
if t.test_status == 'Success'
|
41
|
+
passing << "#{t.parent.name}/#{t.identifier}"
|
42
|
+
else
|
43
|
+
test_identifier = "#{t.parent.name}/#{t.identifier}"
|
44
|
+
failed << test_identifier
|
45
|
+
failure = t.find_failure(failures)
|
46
|
+
if failure
|
47
|
+
failure_details[test_identifier] = {
|
48
|
+
message: failure.failure_message
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
{
|
55
|
+
failed: failed.uniq,
|
56
|
+
passing: passing.uniq,
|
57
|
+
failure_details: failure_details
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
#####################################################
|
62
|
+
# @!group Documentation
|
63
|
+
#####################################################
|
64
|
+
|
65
|
+
def self.description
|
66
|
+
"☑️ Retrieves the failing and passing tests as reportedn an xcresult bundle"
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
def self.available_options
|
71
|
+
[
|
72
|
+
FastlaneCore::ConfigItem.new(
|
73
|
+
key: :xcresult,
|
74
|
+
env_name: "FL_TESTS_FROM_XCRESULT_XCRESULT_PATH",
|
75
|
+
description: "The path to the xcresult bundle to retrieve the tests from",
|
76
|
+
verify_block: proc do |path|
|
77
|
+
UI.user_error!("Error: cannot find the xcresult bundle at '#{path}'") unless Dir.exist?(path)
|
78
|
+
UI.user_error!("Error: cannot parse files that are not in the xcresult format") unless File.extname(path) == ".xcresult"
|
79
|
+
end
|
80
|
+
)
|
81
|
+
]
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.return_value
|
85
|
+
"A Hash with information about the test results:\r\n" \
|
86
|
+
"failed: an Array of the failed test identifiers\r\n" \
|
87
|
+
"passing: an Array of the passing test identifiers\r\n"
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.authors
|
91
|
+
["lyndsey-ferguson/lyndseydf"]
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.category
|
95
|
+
:testing
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.is_supported?(platform)
|
99
|
+
%i[ios mac].include?(platform)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
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.14.
|
4
|
+
version: 3.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lyndsey Ferguson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: trainer
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: xcodeproj
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -270,6 +284,7 @@ files:
|
|
270
284
|
- lib/fastlane/plugin/test_center/actions/test_options_from_testplan.rb
|
271
285
|
- lib/fastlane/plugin/test_center/actions/testplans_from_scheme.rb
|
272
286
|
- lib/fastlane/plugin/test_center/actions/tests_from_junit.rb
|
287
|
+
- lib/fastlane/plugin/test_center/actions/tests_from_xcresult.rb
|
273
288
|
- lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb
|
274
289
|
- lib/fastlane/plugin/test_center/helper/fastlane_core/device_manager/simulator_extensions.rb
|
275
290
|
- lib/fastlane/plugin/test_center/helper/html_test_report.rb
|
@@ -295,7 +310,7 @@ homepage: https://github.com/lyndsey-ferguson/fastlane-plugin-test_center
|
|
295
310
|
licenses:
|
296
311
|
- MIT
|
297
312
|
metadata: {}
|
298
|
-
post_install_message:
|
313
|
+
post_install_message:
|
299
314
|
rdoc_options: []
|
300
315
|
require_paths:
|
301
316
|
- lib
|
@@ -310,8 +325,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
325
|
- !ruby/object:Gem::Version
|
311
326
|
version: '0'
|
312
327
|
requirements: []
|
313
|
-
rubygems_version: 3.
|
314
|
-
signing_key:
|
328
|
+
rubygems_version: 3.1.2
|
329
|
+
signing_key:
|
315
330
|
specification_version: 4
|
316
331
|
summary: Makes testing your iOS app easier
|
317
332
|
test_files: []
|