@@ -56,11 +56,12 @@ class Options
56
56
NO_PROFILE_LONG_FLAG = '--no-profile' . freeze
57
57
FAIL_FAST_FLAG = '--fail-fast' . freeze
58
58
RETRY_FLAG = '--retry' . freeze
59
+ RETRY_TOTAL_FLAG = '--retry-total' . freeze
59
60
OPTIONS_WITH_ARGS = [
60
61
'-r' , '--require' , '--i18n-keywords' , '-f' , '--format' , '-o' ,
61
62
'--out' , '-t' , '--tags' , '-n' , '--name' , '-e' , '--exclude' ,
62
- PROFILE_SHORT_FLAG , PROFILE_LONG_FLAG , RETRY_FLAG , '-l' ,
63
- '--lines' , '--port' , '-I' , '--snippet-type'
63
+ PROFILE_SHORT_FLAG , PROFILE_LONG_FLAG , RETRY_FLAG , RETRY_TOTAL_FLAG ,
64
+ '-l' , '- -lines', '--port' , '-I' , '--snippet-type'
64
65
] . freeze
65
66
ORDER_TYPES = %w[ defined random ] . freeze
66
67
TAG_LIMIT_MATCHER = /(?<tag_name>@\w +):(?<limit>\d +)/x
@@ -108,6 +109,7 @@ def parse!(args) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
108
109
opts . on ( '-j DIR' , '--jars DIR' , 'Load all the jars under DIR' ) { |jars | load_jars ( jars ) } if Cucumber ::JRUBY
109
110
110
111
opts . on ( "#{ RETRY_FLAG } ATTEMPTS" , *retry_msg ) { |v | set_option :retry , v . to_i }
112
+ opts . on ( "#{ RETRY_TOTAL_FLAG } TESTS" , *retry_total_msg ) { |v | set_option :retry_total , v . to_i }
111
113
opts . on ( '--i18n-languages' , *i18n_languages_msg ) { list_languages_and_exit }
112
114
opts . on ( '--i18n-keywords LANG' , *i18n_keywords_msg ) { |lang | language lang }
113
115
opts . on ( FAIL_FAST_FLAG , 'Exit immediately following the first failing scenario' ) { set_option :fail_fast }
@@ -271,6 +273,13 @@ def retry_msg
271
273
[ 'Specify the number of times to retry failing tests (default: 0)' ]
272
274
end
273
275
276
+ def retry_total_msg
277
+ [
278
+ 'The total number of failing test after which retrying of tests is suspended.' ,
279
+ 'Example: --retry-total 10 -> Will stop retrying tests after 10 failing tests.'
280
+ ]
281
+ end
282
+
274
283
def name_msg
275
284
[
276
285
'Only execute the feature elements which match part of the given name.' ,
@@ -543,6 +552,7 @@ def reverse_merge(other_options) # rubocop:disable Metrics/AbcSize
543
552
end
544
553
545
554
@options [ :retry ] = other_options [ :retry ] if @options [ :retry ] . zero?
555
+ @options [ :retry_total ] = other_options [ :retry_total ] if @options [ :retry_total ] . infinite?
546
556
547
557
self
548
558
end
@@ -616,7 +626,8 @@ def default_options
616
626
snippets : true ,
617
627
source : true ,
618
628
duration : true ,
619
- retry : 0
629
+ retry : 0 ,
630
+ retry_total : Float ::INFINITY
620
631
}
621
632
end
622
633
end
0 commit comments