Class: Maze::Plugins::GlobalRetryPlugin

Inherits:
Object
  • Object
show all
Defined in:
lib/maze/plugins/global_retry_plugin.rb

Instance Method Summary collapse

Instance Method Details

#test_case(test_case) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/maze/plugins/global_retry_plugin.rb', line 16

def test_case(test_case)
  configuration.on_event(:test_case_finished) do |event|

    # Ensure we're in the correct test case
    next unless event.test_case == test_case

    # Set retry to 0
    configuration.options[:retry] = 0

    # Guard to check if the case should be retried
    should_retry = event.result.failed? && Maze::RetryHandler.should_retry?(test_case, event)

    next unless should_retry

    # Set retry to 1
    configuration.options[:retry] = 1
  end

  super
end