Class: TestCenter::Helper::MultiScanManager::RetryingScan

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ RetryingScan

Returns a new instance of RetryingScan.



5
6
7
8
# File 'lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan.rb', line 5

def initialize(options = {})
  @options = options
  @retrying_scan_helper = RetryingScanHelper.new(@options)
end

Class Method Details

.run(options) ⇒ Object

:nocov:



11
12
13
# File 'lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan.rb', line 11

def self.run(options)
  RetryingScan.new(options).run
end

Instance Method Details

#runObject

:nocov:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan.rb', line 16

def run
  try_count = @options[:try_count] || 1
  begin
    @retrying_scan_helper.before_testrun
    Scan::Runner.new.run
    @retrying_scan_helper.after_testrun
    true
  rescue FastlaneCore::Interface::FastlaneTestFailure => e
    @retrying_scan_helper.after_testrun(e)
    retry if @retrying_scan_helper.testrun_count < try_count
    false
  rescue FastlaneCore::Interface::FastlaneBuildFailure => e
    @retrying_scan_helper.after_testrun(e)
    retry if @retrying_scan_helper.testrun_count < try_count
    false
  end
end