fastlane-plugin-test_center 3.8.15 → 3.8.16

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: b4adb9ed126d094e159090135e62445355b0ddf62a93d30ecccb482081bc2254
4
- data.tar.gz: ea0e33f2159a5e6b0b189f8d848a2aa4a446c4cc70c95a5487bcf617913432f1
3
+ metadata.gz: 1b53bbbb4a17b23c0a0d1a3d6df0fcd24363427ae699d65b290742d8e7ad336f
4
+ data.tar.gz: 1fd7e8b3f2faab7b441f1ce926693e4f34d4531ad43595ba0cf9cd3a7e4b89f9
5
5
  SHA512:
6
- metadata.gz: 9235adc15d1021a1b5dd92117eb3623ee9b52fa21ecccdc0268b68fced2073b0c241f56e7203175b78b94cdb3b0d5270bcf444121d596d5b380aaaabb57e2baf
7
- data.tar.gz: 9d3e7fa82911ed52c67d4169d813c5c2d6d997f59d21983e59f3b68d63b184ce6bb2f1f743e377913174eb67c9976c57c05cc30790e86ee1978d0a39e3b994ec
6
+ metadata.gz: d5127e1ed4d506b5cf86a67520fa4049c6e003b8426a597c5201aa9d2f1d7a7e7614353a87a6bf8039fbdf6a3f53d3ada52ca1fa2efb24a30a1c6c0b33f3fd2e
7
+ data.tar.gz: c8311011c5e8cb872be4976f89f9756d95b8ffc59bc453405bfdad96e523ade239c7d5ba09db61ab0a0e6b0df2d9a2f4df4331bf40006887042756e7978e8f8c
data/README.md CHANGED
@@ -5,666 +5,70 @@
5
5
  # test_center plugin 🎯
6
6
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-test_center) [![Actions Status](https://github.com/lyndsey-ferguson/fastlane-plugin-test_center/workflows/Run%20Tests/badge.svg)](https://github.com/lyndsey-ferguson/fastlane-plugin-test_center/actions)
7
7
 
8
- Have you ever spent too much time trying to fix fragile tests only to give up with nothing real to show? Use the `fastlane` actions from `test_center` to remove internal and external interference from your tests, so that you can focus on what makes 💰: features that customers love 😍.
8
+ Have you ever spent too much time trying to fix fragile tests only to give up with nothing real to show? Use the `fastlane` actions from `test_center` to remove the pain around your tests, so that you can focus on what makes 💰: features that customers love 😍.
9
9
 
10
10
  <p align="center">
11
- <a href="#quick-start">Quick Start</a> |
12
- <a href="#overview">Overview</a> |
13
- <a href="#issues-and-feedback">Issues and Feedback</a> |
11
+ <a href="#features">Features</a> |
12
+ <a href="#installation">Installation</a> |
13
+ <a href="#usage">Usage</a> |
14
+ <a href="#issues-and-feedback">Issues &amp; Feedback</a> |
14
15
  <a href="#contributing">Contributing</a> |
16
+ <a href="#troubleshooting">Troubleshooting</a> |
15
17
  <a href="#license">License</a>
16
18
  </p>
17
19
 
18
20
  <img src="docs/multi_scan.gif" />
19
21
 
20
- ## Quick Start
21
-
22
- This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-test_center`, add it to your project by running:
23
-
24
- ```bash
25
- fastlane add_plugin test_center
26
- ```
27
-
28
- Add this example 'lane' to your `Fastfile`, change `MY_XCODE_PROJECT_FILEPATH` to point to your project path, and change the option `scheme: AtomicBoy` in the call to `multi_scan` to be the name of your Xcode projects Scheme:
29
-
30
- ```ruby
31
-
32
- ################################################################################
33
- # An example of how one can use the plugin's :multi_scan action to run tests
34
- # that have not yet passed (up to 3 times). If, after the 3 runs of the tests, there
35
- # are still failing tests, print out the number of tests that are still failing.
36
- #
37
- # For a walkthrough to write a lane that can run tests up to 3 times, suppress
38
- # the failing tests in the Xcode project, and create a Github Pull Request, see:
39
- # https://github.com/lyndsey-ferguson/fastlane-plugin-test_center/blob/master/docs/WALKTHROUGH.md
40
- ################################################################################
41
-
42
- MY_XCODE_PROJECT_FILEPATH = File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj')
43
- lane :sweep do
44
- test_run_block = lambda do |testrun_info|
45
- failed_test_count = testrun_info[:failed].size
46
-
47
- if failed_test_count > 0
48
- UI.important('The run of tests would finish with failures due to fragile tests here.')
49
-
50
- try_attempt = testrun_info[:try_count]
51
- if try_attempt < 3
52
- UI.header('Since we are using :multi_scan, we can re-run just those failing tests!')
53
- end
54
- end
55
- end
56
-
57
- result = multi_scan(
58
- project: MY_XCODE_PROJECT_FILEPATH,
59
- try_count: 3,
60
- fail_build: false,
61
- scheme: 'AtomicBoy',
62
- testrun_completed_block: test_run_block,
63
- parallel_testrun_count: 4
64
- )
65
- unless result[:failed_testcount].zero?
66
- UI.message("There are #{result[:failed_testcount]} legitimate failing tests")
67
- end
68
- end
69
- ```
70
-
71
- ## Overview
22
+ ## Features
72
23
 
73
24
  This plugin makes testing your iOS app easier by providing you actions that give you greater control over everthing related to testing your app.
74
25
 
75
- `multi_scan` began when I engineered an action to only re-run the failed tests in order to determine which ones were truly failing, or just failing randomly due to a fragile infrastructure. This action morphed into an entire plugin with many actions related to tests.
26
+ `multi_scan` began when I created an action to only re-run the failed tests in order to determine if they were truly failing, or if they were failing randomly due to a fragile infrastructure. This action morphed into an entire plugin with many actions in the testing category.
76
27
 
77
28
  This fastlane plugin includes the following actions:
78
- - [`multi_scan`](#multi_scan-): gives you control over how your tests are exercised.
79
- - [`suppress_tests_from_junit`](#suppress_tests_from_junit): from a test report, suppresses tests in your project.
80
- - [`suppress_tests`](#suppress_tests): from a provided list, suppresses tests in your project.
81
- - [`suppressed_tests`](#suppressed_tests): returns a list of the suppressed tests in your project.
82
- - [`tests_from_junit`](#tests_from_junit): from a test report, returns lists of passing and failed tests.
83
- - [`tests_from_xctestrun`](#tests_from_xctestrun): from an xctestrun file, returns a list of tests for each of its test targets.
84
- - [`collate_junit_reports`](#collate_junit_reports): combines multiple junit test reports into one report.
85
- - [`collate_html_reports`](#collate_html_reports): combines multiple html test reports into one report.
86
- - [`collate_json_reports`](#collate_json_reports): combines multiple json test reports into one report.
87
- - [`collate_test_result_bundles`](#collate_test_result_bundles): combines multiple test_result bundles into one test_result bundle.
88
-
89
- ### multi_scan 🎉
90
-
91
- Use `:multi_scan` intead of `:scan` to improve the usefulness of iOS test results, reduce test run time, inspect partial results periodically during a test run, and provide better results reporting.
92
-
93
- #### Improving Usefulness
94
-
95
- Over time, your tests can change the state of your application in unexpected ways that cause other tests to fail randomly. Or, the tools and infrastructure for testing are the root causes of random test failures. The test results may not truly reflect how the product code is working.
96
-
97
- Rather than wasting time trying to account for unstable tools, or trying to tweak your test code ad-nauseum to get a passing result reliably, just use the `:try_count` option to run `:scan` multiple times, running only the tests that failed each time. This ensures that any _fragility_ is ironed out over a number of "tries". The end result is that only the truly failing tests appear.
98
29
 
99
- Another issue that can cause tests to incorrectly fail comes from an issue with the iOS Simulator. If you provide a huge number of tests to the iOS Simulator, it can exhaust the available resources and cause it to fail large numbers of tests. You can get around this by running your tests in batches using the `:batch_count` option in order to lighten the load on the simulator.
30
+ _read the documentation on each action by clicking on the action name_
100
31
 
101
- #### Reduce Test Run Time
32
+ | Action | Description | Supported Platforms |
33
+ | :--- | :--- | ---: |
34
+ |[`multi_scan`](docs/feature_details/multi_scan.md)| supports everthing that [`scan`](https://docs.fastlane.tools/actions/scan/) (also known as `run_tests`) does, and also supports:</br></br>- dividing your tests evenly into batches and run each batch on its own Simulator in parallel to reduce the time to test</br>- re-running tests that may be failing due to a fragile test environment</br>- splitting tests into batches when a huge number of tests overwhelm the Simulator</br> - performing an action after a block of tests have been run| ios, mac |
35
+ | [`suppress_tests_from_junit`](docs/feature_details/suppress_tests_from_junit.md) | suppress tests in an Xcode Scheme using those in a Junit test report | ios, mac |
36
+ | [`suppress_tests`](docs/feature_details/suppress_tests.md) | suppress tests in an Xcode Scheme | ios, mac |
37
+ | [`suppressed_tests`](docs/feature_details/suppressed_tests.md) | returns a list of the suppressed tests in your Xcode Project or Scheme | ios, mac |
38
+ | [`tests_from_junit`](docs/feature_details/tests_from_junit.md) | returns the passing and failing tests in a Junit test report | ios, mac |
39
+ | [`tests_from_xctestrun`](docs/feature_details/tests_from_xctestrun.md) | returns a list of tests for each test target in a `xctestrun` file | ios, mac |
40
+ | [`collate_junit_reports`](docs/feature_details/collate_junit_reports.md) | combines multiple Junit test reports into one report | ios, mac |
41
+ | [`collate_html_reports`](docs/feature_details/collate_html_reports.md) | combines multiple HTML test reports into one report | ios, mac |
42
+ | [`collate_json_reports`](docs/feature_details/collate_json_reports.md) | combines multiple json test reports into one report | ios, mac |
43
+ | [`collate_test_result_bundles`](docs/feature_details/collate_test_result_bundles.md) | combines multiple test_result bundles into one test_result bundle | ios, mac |
102
44
 
103
- Make better use of your Mac resources by running batches of test runs in parallel iOS Simulators running simultaneously. Use the `:parallel_testrun_count` option to specify 2 to 6 simulators, each running a subset of your tests. It is not recommended to run more than 6 simulators in parallel as the service that backs the simulators can fail to connect to them.
104
45
 
105
- ##### Note: while Xcode provides the option to run testsuites in parallel, this does not help if one testsuite has 100 testcases and another has 300 testcases. That's because each of those testsuites will run on their own iOS Simulator and you have to wait for the Simulator with the most testcases: 300 testcases in this example.
106
- ##### `multi_scan`, on the other hand, can split those tests into 4 batches of 100 using a `:parallel_testrun_count` of 4. You only have to wait for the iOS Simulators to finish 100 testcases.
46
+ ## Installation
107
47
 
108
- #### Inspect Partial Results
109
-
110
- If you have a large number of tests, and you want to inspect the overall status of how test runs are progressing, you can use the `:testrun_completed_block` callback to bailout early or make adjustments on how your tests are exercised.
111
-
112
- #### Better Results Reporting
113
-
114
- Do you have multiple test targets and the normal operation of `:scan` is providing you a test report that implies that all the tests ran in just one test target? Don't worry, `:multi_scan` has fixed that. It will provide a separate test report for each test target. It can handle JUnit, HTML, JSON, and Apple's `test_result` bundles.
115
-
116
- `test_result` bundles are particularly useful because they contain screenshots of the UI when a UI test fails so you can review what was actually there compared to what you expected.
117
-
118
- #### Invocation based tests
119
-
120
- If your tests are invocation based like [Kiwi](https://github.com/kiwi-bdd/Kiwi) you need to set `:invocation_based_tests` to handle these tests, because unlike `XCTest`s the list of tests cannot be deterimned before running and also you can't try an exact test (The reruns run the whole file where the test failed).
121
-
122
- <details>
123
- <summary>Example Code (expand to view):</summary>
124
- <!-- multi_scan examples: begin -->
125
-
126
- ```ruby
127
-
128
- UI.important(
129
- 'example: ' \
130
- 'run tests for a scheme that has two test targets, re-trying up to 2 times if ' \
131
- 'tests fail. Turn off the default behavior of failing the build if, at the ' \
132
- 'end of the action, there were 1 or more failing tests.'
133
- )
134
- summary = multi_scan(
135
- project: File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj'),
136
- scheme: 'AtomicBoy',
137
- try_count: 3,
138
- fail_build: false,
139
- output_files: 'report.html',
140
- output_types: 'html'
141
- )
142
- UI.success("multi_scan passed? #{summary[:result]}")
143
-
144
- ```
145
-
146
- ```ruby
147
-
148
- UI.important(
149
- 'example: ' \
150
- 'split the tests into 2 batches and run each batch of tests up to 3 ' \
151
- 'times if tests fail. Do not fail the build.'
152
- )
153
- multi_scan(
154
- project: File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj'),
155
- scheme: 'AtomicBoy',
156
- try_count: 3,
157
- batch_count: 2,
158
- fail_build: false
159
- )
48
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-test_center`, add it to your project by running:
160
49
 
50
+ ```bash
51
+ fastlane add_plugin test_center
161
52
  ```
162
53
 
163
- ```ruby
54
+ ## Usage
164
55
 
165
- UI.important(
166
- 'example: ' \
167
- 'split the tests into 2 batches and run each batch of tests up to 3 ' \
168
- 'times if tests fail. Abort the testing early if there are too many ' \
169
- 'failing tests by passing in a :testrun_completed_block that is called ' \
170
- 'by :multi_scan after each run of tests.'
171
- )
172
- test_run_block = lambda do |testrun_info|
173
- failed_test_count = testrun_info[:failed].size
174
- passed_test_count = testrun_info[:passing].size
175
- try_attempt = testrun_info[:try_count]
176
- batch = testrun_info[:batch]
56
+ Click the name of each action [above](#features) and review the documentation to learn how to use each action.
177
57
 
178
- # UI.abort_with_message!('You could conditionally abort')
179
- UI.message("\ὠA everything is fine, let's continue try #{try_attempt + 1} for batch #{batch}")
180
- end
58
+ The most popular action in the `test_center` plugin is `multi_scan`, and if you run your tests in parallel with multiple retries, they will finish faster and only the truly failing tests will be reported as failing:
181
59
 
60
+ ```action
182
61
  multi_scan(
183
62
  project: File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj'),
184
63
  scheme: 'AtomicBoy',
185
- try_count: 3,
186
- batch_count: 2,
64
+ try_count: 3, # retry _failing_ tests up to three times^1.
187
65
  fail_build: false,
188
- testrun_completed_block: test_run_block
189
- )
190
-
191
- ```
192
-
193
- ```ruby
194
-
195
- UI.important(
196
- 'example: ' \
197
- 'multi_scan also works with invocation based tests.'
198
- )
199
- Dir.chdir('../AtomicBoy') do
200
- bundle_install
201
- cocoapods(podfile: File.absolute_path('Podfile'))
202
- multi_scan(
203
- workspace: File.absolute_path('AtomicBoy.xcworkspace'),
204
- scheme: 'KiwiBoy',
205
- try_count: 3,
206
- clean: true,
207
- invocation_based_tests: true,
208
- fail_build: false
209
- )
210
- end
211
-
212
- ```
213
-
214
- ```ruby
215
-
216
- UI.important(
217
- 'example: ' \
218
- 'use the :workspace parameter instead of the :project parameter to find, ' \
219
- 'build, and test the iOS app.'
220
- )
221
- begin
222
- multi_scan(
223
- workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
224
- scheme: 'AtomicBoy',
225
- try_count: 3
226
- )
227
- rescue # anything
228
- UI.error('Found real failing tests!')
229
- end
230
-
231
- ```
232
-
233
- ```ruby
234
-
235
- UI.important(
236
- 'example: ' \
237
- 'use the :workspace parameter instead of the :project parameter to find, ' \
238
- 'build, and test the iOS app. Use the :skip_build parameter to not rebuild.'
239
- )
240
- multi_scan(
241
- workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
242
- scheme: 'AtomicBoy',
243
- skip_build: true,
244
- clean: true,
245
- try_count: 3,
246
- result_bundle: true,
247
- fail_build: false
248
- )
249
-
250
- ```
251
-
252
- ```ruby
253
-
254
- UI.important(
255
- 'example: ' \
256
- 'multi_scan also works with just one test target in the Scheme.'
257
- )
258
- multi_scan(
259
- project: File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj'),
260
- scheme: 'Professor',
261
- try_count: 3,
262
- output_files: 'atomic_report.xml',
263
- output_types: 'junit',
264
- fail_build: false
265
- )
266
-
267
- ```
268
-
269
- ```ruby
270
-
271
- UI.important(
272
- 'example: ' \
273
- 'multi_scan also can also run just the tests passed in the ' \
274
- ':only_testing option.'
275
- )
276
- multi_scan(
277
- workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
278
- scheme: 'AtomicBoy',
279
- try_count: 3,
280
- code_coverage: true,
281
- only_testing: ['AtomicBoyTests'],
282
- fail_build: false
283
- )
284
-
285
- ```
286
-
287
- ```ruby
288
-
289
- UI.important(
290
- 'example: ' \
291
- 'multi_scan also works with json.'
292
- )
293
- multi_scan(
294
- workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
295
- scheme: 'AtomicBoy',
296
- try_count: 3,
297
- output_types: 'json',
298
- output_files: 'report.json',
299
- fail_build: false
300
- )
301
-
302
- ```
303
-
304
- ```ruby
305
-
306
- UI.important(
307
- 'example: ' \
308
- 'multi_scan parallelizes its test runs.'
309
- )
310
- multi_scan(
311
- workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
312
- scheme: 'AtomicBoy',
313
- try_count: 3,
314
- parallel_testrun_count: 4,
315
- fail_build: false
316
- )
317
-
318
- ```
319
-
320
- ```ruby
321
-
322
- UI.important(
323
- 'example: ' \
324
- 'use the :xctestrun parameter instead of the :project parameter to find, ' \
325
- 'build, and test the iOS app.'
326
- )
327
- Dir.mktmpdir do |derived_data_path|
328
- project_path = File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj')
329
- command = "bundle exec fastlane scan --build_for_testing true --project '#{project_path}' --derived_data_path #{derived_data_path} --scheme AtomicBoy"
330
- `#{command}`
331
- xctestrun_file = Dir.glob("#{derived_data_path}/Build/Products/AtomicBoy*.xctestrun").first
332
- multi_scan(
333
- scheme: 'AtomicBoy',
334
- try_count: 3,
335
- fail_build: false,
336
- xctestrun: xctestrun_file,
337
- test_without_building: true
338
- )
339
- end
340
-
341
- ```
342
- <!-- multi_scan examples: end -->
343
- </details>
344
-
345
- ### suppress_tests_from_junit
346
-
347
- Do you not have time to fix a test and it can be tested manually? You can suppress the `:failed` tests in your project and create and prioritize a ticket in your bug tracking system.
348
-
349
- Do you want to create a special CI job that only re-tries failing tests? Suppress the `:passing` tests in your project and exercise your fragile tests.
350
-
351
- <details>
352
- <summary>Example Code (expand to view):</summary>
353
- <!-- suppress_tests_from_junit examples: begin -->
354
-
355
- ```ruby
356
-
357
- UI.important(
358
- 'example: ' \
359
- 'suppress the tests that failed in the junit report for _all_ Schemes'
360
- )
361
- suppress_tests_from_junit(
362
- xcodeproj: 'AtomicBoy/AtomicBoy.xcodeproj',
363
- junit: './spec/fixtures/junit.xml',
364
- suppress_type: :failed
365
- )
366
- UI.message(
367
- "Suppressed tests for project: #{suppressed_tests(xcodeproj: 'AtomicBoy/AtomicBoy.xcodeproj')}"
368
- )
369
-
370
- ```
371
-
372
- ```ruby
373
-
374
- UI.important(
375
- 'example: ' \
376
- 'suppress the tests that failed in the junit report for _one_ Scheme'
377
- )
378
- suppress_tests_from_junit(
379
- xcodeproj: 'AtomicBoy/AtomicBoy.xcodeproj',
380
- junit: './spec/fixtures/junit.xml',
381
- scheme: 'Professor',
382
- suppress_type: :failed
383
- )
384
- UI.message(
385
- "Suppressed tests for the 'Professor' scheme: #{suppressed_tests(xcodeproj: 'AtomicBoy/AtomicBoy.xcodeproj')}"
386
- )
387
-
388
- ```
389
- <!-- suppress_tests_from_junit examples: end -->
390
- </details>
391
-
392
- ### suppress_tests
393
-
394
- Have some tests that you want turned off? Give the list to this action in order to suppress them for your project.
395
-
396
- <details>
397
- <summary>Example Code (expand to view):</summary>
398
- <!-- suppress_tests examples: begin -->
399
-
400
- ```ruby
401
-
402
- UI.important(
403
- 'example: ' \
404
- 'suppress some tests in all Schemes for a Project'
405
- )
406
- suppress_tests(
407
- xcodeproj: 'AtomicBoy/AtomicBoy.xcodeproj',
408
- tests: [
409
- 'AtomicBoyUITests/HappyNapperTests/testBeepingNonExistentFriendDisplaysError',
410
- 'AtomicBoyUITests/GrumpyWorkerTests'
411
- ]
412
- )
413
-
414
- ```
415
-
416
- ```ruby
417
-
418
- UI.important(
419
- 'example: ' \
420
- 'suppress some tests in one Scheme for a Project'
421
- )
422
- suppress_tests(
423
- xcodeproj: 'AtomicBoy/AtomicBoy.xcodeproj',
424
- tests: [
425
- 'AtomicBoyUITests/HappyNapperTests/testBeepingNonExistentFriendDisplaysError',
426
- 'AtomicBoyUITests/GrumpyWorkerTests'
427
- ],
428
- scheme: 'Professor'
429
- )
430
-
431
- ```
432
-
433
- ```ruby
434
-
435
- UI.important(
436
- 'example: ' \
437
- 'suppress some tests in one Scheme from a workspace'
438
- )
439
- suppress_tests(
440
- workspace: 'AtomicBoy/AtomicBoy.xcworkspace',
441
- tests: [
442
- 'AtomicBoyUITests/HappyNapperTests/testBeepingNonExistentFriendDisplaysError',
443
- 'AtomicBoyUITests/GrumpyWorkerTests'
444
- ],
445
- scheme: 'Professor'
446
- )
447
-
448
- ```
449
- <!-- suppress_tests examples: end -->
450
- </details>
451
-
452
- ### suppressed_tests
453
-
454
- Do you have an automated process that requires the list of suppressed tests in your project? Use this action to get that.
455
-
456
- <details>
457
- <summary>Example Code (expand to view):</summary>
458
- <!-- suppressed_tests examples: begin -->
459
-
460
- ```ruby
461
-
462
- UI.important(
463
- 'example: ' \
464
- 'get the tests that are suppressed in a Scheme in the Project'
465
- )
466
- tests = suppressed_tests(
467
- xcodeproj: 'AtomicBoy/AtomicBoy.xcodeproj',
468
- scheme: 'AtomicBoy'
469
- )
470
- UI.message("Suppressed tests for scheme: #{tests}")
471
-
472
- ```
473
-
474
- ```ruby
475
-
476
- UI.important(
477
- 'example: ' \
478
- 'get the tests that are suppressed in all Schemes in the Project'
479
- )
480
- UI.message(
481
- "Suppressed tests for project: #{suppressed_tests(xcodeproj: 'AtomicBoy/AtomicBoy.xcodeproj')}"
482
- )
483
-
484
- ```
485
-
486
- ```ruby
487
-
488
- UI.important(
489
- 'example: ' \
490
- 'get the tests that are suppressed in all Schemes in a workspace'
491
- )
492
- tests = suppressed_tests(
493
- workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
494
- scheme: 'Professor'
495
- )
496
- UI.message("tests: #{tests}")
497
-
498
- ```
499
- <!-- suppressed_tests examples: end -->
500
- </details>
501
-
502
- ### tests_from_junit
503
-
504
- Performing analysis on a test report file? Get the lists of failing and passing tests using this action.
505
-
506
- <details>
507
- <summary>Example Code (expand to view):</summary>
508
- <!-- tests_from_junit examples: begin -->
509
-
510
- ```ruby
511
-
512
- UI.important(
513
- 'example: ' \
514
- 'get the failed and passing tests from the junit test report file'
515
- )
516
- result = tests_from_junit(junit: './spec/fixtures/junit.xml')
517
- UI.message("Passing tests: #{result[:passing]}")
518
- UI.message("Failed tests: #{result[:failed]}")
519
-
520
- ```
521
- <!-- tests_from_junit examples: end -->
522
- </details>
523
-
524
- ### tests_from_xctestrun
525
-
526
- Do you have multiple test targets referenced by your `xctestrun` file and need to know all the tests? Use this action to go through each test target, collect the tests, and return them to you in a simple and usable structure.
527
-
528
- <details>
529
- <summary>Example Code (expand to view):</summary>
530
- <!-- tests_from_xctestrun examples: begin -->
531
-
532
- ```ruby
533
-
534
- require 'fastlane/actions/scan'
535
-
536
- UI.important(
537
- 'example: ' \
538
- 'get list of tests that are referenced from an xctestrun file'
539
- )
540
- # build the tests so that we have a xctestrun file to parse
541
- scan(
542
- build_for_testing: true,
543
- workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
544
- scheme: 'AtomicBoy'
545
- )
546
-
547
- # find the xctestrun file
548
- derived_data_path = Scan.config[:derived_data_path]
549
- xctestrun_file = Dir.glob("#{derived_data_path}/Build/Products/*.xctestrun").first
550
-
551
- # get the tests from the xctestrun file
552
- tests = tests_from_xctestrun(xctestrun: xctestrun_file)
553
- UI.header('xctestrun file contains the following tests')
554
- tests.values.flatten.each { |test_identifier| puts test_identifier }
555
-
556
- ```
557
- <!-- tests_from_xctestrun examples: end -->
558
- </details>
559
-
560
- ### collate_junit_reports
561
-
562
- Do you have multiple junit test reports coming in from different sources and need it combined? Use this action to collate all the tests performed for a given test target into one report file.
563
-
564
- <details>
565
- <summary>Example Code (expand to view):</summary>
566
- <!-- collate_junit_reports examples: begin -->
567
-
568
- ```ruby
569
-
570
- UI.important(
571
- 'example: ' \
572
- 'collate the xml reports to a temporary file "result.xml"'
573
- )
574
- reports = Dir['../spec/fixtures/*.xml'].map { |relpath| File.absolute_path(relpath) }
575
- collate_junit_reports(
576
- reports: reports,
577
- collated_report: File.join(Dir.mktmpdir, 'result.xml')
66
+ parallel_testrun_count: 4 # run subsets of your tests on parallel simulators^2
578
67
  )
579
-
68
+ # [1] The ones that pass on a retry probably failed due to test interactions or test infrastructure
69
+ # [2] splits all your tests into 4 smaller batches and runs each batch on its own sim in parallel for faster completion!
580
70
  ```
581
- <!-- collate_junit_reports examples: end -->
582
- </details>
583
-
584
- ### collate_html_reports
585
-
586
- Do you have multiple html test reports coming in from different sources and need it combined? Use this action to collate all the tests performed for a given test target into one report file.
587
-
588
- <details>
589
- <summary>Example Code (expand to view):</summary>
590
- <!-- collate_html_reports examples: begin -->
591
-
592
- ```ruby
593
-
594
- UI.important(
595
- 'example: ' \
596
- 'collate the html reports to a temporary file "result.html"'
597
- )
598
- reports = Dir['../spec/fixtures/*.html'].map { |relpath| File.absolute_path(relpath) }
599
- collate_html_reports(
600
- reports: reports,
601
- collated_report: File.join(Dir.mktmpdir, 'result.html')
602
- )
603
71
 
604
- ```
605
- <!-- collate_html_reports examples: end -->
606
- </details>
607
-
608
- ### collate_json_reports
609
-
610
- Do you have multiple json test reports coming in from different sources and need it combined? Use this action to collate all the tests performed for a given test target into one report file.
611
-
612
- <details>
613
- <summary>Example Code (expand to view):</summary>
614
- <!-- collate_json_reports examples: begin -->
615
-
616
- ```ruby
617
-
618
- UI.important(
619
- 'example: ' \
620
- 'collate the json reports to a temporary file "result.json"'
621
- )
622
- reports = Dir['../spec/fixtures/report*.json'].map { |relpath| File.absolute_path(relpath) }
623
- collate_json_reports(
624
- reports: reports,
625
- collated_report: File.join(Dir.mktmpdir, 'result.json')
626
- )
627
-
628
- ```
629
- <!-- collate_json_reports examples: end -->
630
- </details>
631
-
632
- ### collate_test_result_bundles
633
-
634
- Do you have multiple test_result bundles coming in from different sources and need it combined? Use this action to collate all the tests performed for a given test target into one test_result bundle.
635
-
636
- <details>
637
- <summary>Example Code (expand to view):</summary>
638
- <!-- collate_test_result_bundles examples: begin -->
639
-
640
- ```ruby
641
-
642
- UI.important(
643
- 'example: ' \
644
- 'collate the test_result bundles to a temporary bundle "result.test_result"'
645
- )
646
- bundles = Dir['../spec/fixtures/*.test_result'].map { |relpath| File.absolute_path(relpath) }
647
- collate_test_result_bundles(
648
- bundles: bundles,
649
- collated_bundle: File.join(Dir.mktmpdir, 'result.test_result')
650
- )
651
-
652
- ```
653
- <!-- collate_test_result_bundles examples: end -->
654
- </details>
655
-
656
- ## Run tests for this plugin
657
-
658
- To run both the tests, and code style validation, run
659
-
660
- ```
661
- rake
662
- ```
663
-
664
- To automatically fix many of the styling issues, use
665
- ```
666
- rubocop -a
667
- ```
668
72
 
669
73
  ## Issues and Feedback
670
74
 
@@ -207,7 +207,7 @@ module Fastlane
207
207
  )
208
208
  reports = Dir['../spec/fixtures/*.xml'].map { |relpath| File.absolute_path(relpath) }
209
209
  collate_junit_reports(
210
- reports: reports,
210
+ reports: reports.sort_by { |f| File.mtime(f) },
211
211
  collated_report: File.join(Dir.mktmpdir, 'result.xml')
212
212
  )
213
213
  "
@@ -224,7 +224,7 @@ module Fastlane
224
224
  bundles = Dir['../spec/fixtures/*.test_result'].map { |relpath| File.absolute_path(relpath) }
225
225
  collate_test_result_bundles(
226
226
  bundles: bundles,
227
- collated_bundle: File.join(Dir.mktmpdir, 'result.test_result')
227
+ collated_bundle: File.join('test_output', 'result.test_result')
228
228
  )
229
229
  "
230
230
  ]
@@ -14,6 +14,12 @@ module Fastlane
14
14
  class MultiScanAction < Action
15
15
  def self.run(params)
16
16
  params[:quit_simulators] = params._values[:force_quit_simulator] if params._values[:force_quit_simulator]
17
+ if params[:output_types]
18
+ params[:output_types] = params[:output_types].split(',').map(&:strip).join(',')
19
+ end
20
+ if params[:output_files]
21
+ params[:output_files] = params[:output_files].split(',').map(&:strip).join(',')
22
+ end
17
23
 
18
24
  print_multi_scan_parameters(params)
19
25
  force_quit_simulator_processes if params[:quit_simulators]
@@ -344,41 +350,11 @@ module Fastlane
344
350
  "
345
351
  UI.important(
346
352
  'example: ' \\
347
- 'run tests for a scheme that has two test targets, re-trying up to 2 times if ' \\
348
- 'tests fail. Turn off the default behavior of failing the build if, at the ' \\
349
- 'end of the action, there were 1 or more failing tests.'
350
- )
351
- summary = multi_scan(
352
- project: File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj'),
353
- scheme: 'AtomicBoy',
354
- try_count: 3,
355
- fail_build: false,
356
- output_files: 'report.html',
357
- output_types: 'html'
358
- )
359
- UI.success(\"multi_scan passed? \#{summary[:result]}\")
360
- ",
361
- "
362
- UI.important(
363
- 'example: ' \\
364
- 'split the tests into 2 batches and run each batch of tests up to 3 ' \\
365
- 'times if tests fail. Do not fail the build.'
366
- )
367
- multi_scan(
368
- project: File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj'),
369
- scheme: 'AtomicBoy',
370
- try_count: 3,
371
- batch_count: 2,
372
- fail_build: false
373
- )
374
- ",
375
- "
376
- UI.important(
377
- 'example: ' \\
378
- 'split the tests into 2 batches and run each batch of tests up to 3 ' \\
379
- 'times if tests fail. Abort the testing early if there are too many ' \\
380
- 'failing tests by passing in a :testrun_completed_block that is called ' \\
381
- 'by :multi_scan after each run of tests.'
353
+ 'split the tests into 4 batches and run each batch of tests in ' \\
354
+ 'parallel up to 3 times if tests fail. Abort the testing early ' \\
355
+ 'if there are too many failing tests by passing in a ' \\
356
+ ':testrun_completed_block that is called by :multi_scan ' \\
357
+ 'after each run of tests.'
382
358
  )
383
359
  test_run_block = lambda do |testrun_info|
384
360
  failed_test_count = testrun_info[:failed].size
@@ -394,91 +370,13 @@ module Fastlane
394
370
  project: File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj'),
395
371
  scheme: 'AtomicBoy',
396
372
  try_count: 3,
397
- batch_count: 2,
373
+ batch_count: 4,
398
374
  fail_build: false,
375
+ parallel_testrun_count: 4,
399
376
  testrun_completed_block: test_run_block
400
377
  )
401
378
  ",
402
379
  "
403
- UI.important(
404
- 'example: ' \\
405
- 'multi_scan also works with invocation based tests.'
406
- )
407
- Dir.chdir('../AtomicBoy') do
408
- bundle_install
409
- cocoapods(podfile: File.absolute_path('Podfile'))
410
- multi_scan(
411
- workspace: File.absolute_path('AtomicBoy.xcworkspace'),
412
- scheme: 'KiwiBoy',
413
- try_count: 3,
414
- clean: true,
415
- invocation_based_tests: true,
416
- fail_build: false
417
- )
418
- end
419
- ",
420
- "
421
- UI.important(
422
- 'example: ' \\
423
- 'use the :workspace parameter instead of the :project parameter to find, ' \\
424
- 'build, and test the iOS app.'
425
- )
426
- begin
427
- multi_scan(
428
- workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
429
- scheme: 'AtomicBoy',
430
- try_count: 3
431
- )
432
- rescue # anything
433
- UI.error('Found real failing tests!')
434
- end
435
- ",
436
- "
437
- UI.important(
438
- 'example: ' \\
439
- 'use the :workspace parameter instead of the :project parameter to find, ' \\
440
- 'build, and test the iOS app. Use the :skip_build parameter to not rebuild.'
441
- )
442
- multi_scan(
443
- workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
444
- scheme: 'AtomicBoy',
445
- skip_build: true,
446
- clean: true,
447
- try_count: 3,
448
- result_bundle: true,
449
- fail_build: false
450
- )
451
- ",
452
- "
453
- UI.important(
454
- 'example: ' \\
455
- 'multi_scan also works with just one test target in the Scheme.'
456
- )
457
- multi_scan(
458
- project: File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj'),
459
- scheme: 'Professor',
460
- try_count: 3,
461
- output_files: 'atomic_report.xml',
462
- output_types: 'junit',
463
- fail_build: false
464
- )
465
- ",
466
- "
467
- UI.important(
468
- 'example: ' \\
469
- 'multi_scan also can also run just the tests passed in the ' \\
470
- ':only_testing option.'
471
- )
472
- multi_scan(
473
- workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
474
- scheme: 'AtomicBoy',
475
- try_count: 3,
476
- code_coverage: true,
477
- only_testing: ['AtomicBoyTests'],
478
- fail_build: false
479
- )
480
- ",
481
- "
482
380
  UI.important(
483
381
  'example: ' \\
484
382
  'multi_scan also works with json.'
@@ -491,39 +389,6 @@ module Fastlane
491
389
  output_files: 'report.json',
492
390
  fail_build: false
493
391
  )
494
- ",
495
- "
496
- UI.important(
497
- 'example: ' \\
498
- 'multi_scan parallelizes its test runs.'
499
- )
500
- multi_scan(
501
- workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'),
502
- scheme: 'AtomicBoy',
503
- try_count: 3,
504
- parallel_testrun_count: 4,
505
- fail_build: false
506
- )
507
- ",
508
- "
509
- UI.important(
510
- 'example: ' \\
511
- 'use the :xctestrun parameter instead of the :project parameter to find, ' \\
512
- 'build, and test the iOS app.'
513
- )
514
- Dir.mktmpdir do |derived_data_path|
515
- project_path = File.absolute_path('../AtomicBoy/AtomicBoy.xcodeproj')
516
- command = \"bundle exec fastlane scan --build_for_testing true --project '\#{project_path}' --derived_data_path \#{derived_data_path} --scheme AtomicBoy\"
517
- `\#{command}`
518
- xctestrun_file = Dir.glob(\"\#{derived_data_path}/Build/Products/AtomicBoy*.xctestrun\").first
519
- multi_scan(
520
- scheme: 'AtomicBoy',
521
- try_count: 3,
522
- fail_build: false,
523
- xctestrun: xctestrun_file,
524
- test_without_building: true
525
- )
526
- end
527
392
  "
528
393
  ]
529
394
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TestCenter
3
- VERSION = "3.8.15"
3
+ VERSION = "3.8.16"
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.8.15
4
+ version: 3.8.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-23 00:00:00.000000000 Z
11
+ date: 2019-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: bundler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 2.0.2
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 2.0.2
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: fastlane
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: 2.108.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: markdown-tables
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: pry
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -256,7 +270,6 @@ files:
256
270
  - lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb
257
271
  - lib/fastlane/plugin/test_center/helper/html_test_report.rb
258
272
  - lib/fastlane/plugin/test_center/helper/junit_helper.rb
259
- - lib/fastlane/plugin/test_center/helper/multi_scan.rb
260
273
  - lib/fastlane/plugin/test_center/helper/multi_scan_manager.rb
261
274
  - lib/fastlane/plugin/test_center/helper/multi_scan_manager/device_manager.rb
262
275
  - lib/fastlane/plugin/test_center/helper/multi_scan_manager/parallel_test_batch_worker.rb