Rerunning failed scenario inside Around block

35 views
Skip to first unread message

James Poyser

unread,
Feb 7, 2016, 8:38:43 AM2/7/16
to Cukes
I'd like to find a way to re-run a failed scenario, before it's reported back (to our CI server in our case). If it fails twice, then it's reported as a failure.

This is to improve the reliability of browser automation tests. I'd like to set a global variable to slow down execution time on the second run. If it still fails, then it's a 'real' failure.

I was hoping this would work, but alas not - any ideas?

Around do |scenario, block|
  begin
    $slowdown = 0
    block.call
  rescue
    $slowdown = 1
    block.call
  end
end


Paolo Ambrosio

unread,
Feb 7, 2016, 9:44:28 AM2/7/16
to cu...@googlegroups.com
Can't help you with the Ruby part but I really hope you won't need it
after reading my comments below.

On Sun, Feb 7, 2016 at 9:58 AM, James Poyser <ja...@inniaccounts.co.uk> wrote:

> I'd like to find a way to re-run a failed scenario, before it's reported
> back (to our CI server in our case). If it fails twice, then it's reported
> as a failure.

Instead of trying this hack, what about fixing the root cause?

> This is to improve the reliability of browser automation tests. I'd like to
> set a global variable to slow down execution time on the second run. If it
> still fails, then it's a 'real' failure.

In general you should poll for some condition to be met instead of
introducing slowdowns. This way your tests will be as fast as your
system can be.

James Poyser

unread,
Feb 8, 2016, 7:17:54 PM2/8/16
to Cukes
It's an admirable aim Paolo, however this simply doesn't work in the real world of browser automation, where there's inherence flakiness and inconsistencies in the frameworks which go beyond our control.

Tim Walker

unread,
Feb 8, 2016, 8:24:57 PM2/8/16
to cu...@googlegroups.com


On Feb 8, 2016 18:17, "James Poyser" <ja...@inniaccounts.co.uk> wrote:
>
> It's an admirable aim Paolo, however this simply doesn't work in the real world of browser automation, where there's inherence flakiness and inconsistencies in the frameworks which go beyond our control.
>

When determinism is lost smash the state...


>
> On Sunday, 7 February 2016 14:44:28 UTC, Paolo Ambrosio wrote:
>>
>> Can't help you with the Ruby part but I really hope you won't need it
>> after reading my comments below.
>>
>> On Sun, Feb 7, 2016 at 9:58 AM, James Poyser <ja...@inniaccounts.co.uk> wrote:
>>
>> > I'd like to find a way to re-run a failed scenario, before it's reported
>> > back (to our CI server in our case). If it fails twice, then it's reported
>> > as a failure.
>>
>> Instead of trying this hack, what about fixing the root cause?
>>
>> > This is to improve the reliability of browser automation tests. I'd like to
>> > set a global variable to slow down execution time on the second run. If it
>> > still fails, then it's a 'real' failure.
>>
>> In general you should poll for some condition to be met instead of
>> introducing slowdowns. This way your tests will be as fast as your
>> system can be.
>>
>> > I was hoping this would work, but alas not - any ideas?
>> >
>> > Around do |scenario, block|
>> >   begin
>> >     $slowdown = 0
>> >     block.call
>> >   rescue
>> >     $slowdown = 1
>> >     block.call
>> >   end
>> > end
>

> --
> Posting rules: http://cukes.info/posting-rules.html
> ---
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Samar Mukherjee

unread,
Feb 9, 2016, 8:58:41 AM2/9/16
to Cukes
Can anyone help on the Cucumber Java to rerun the failed scenario?

Matt Wynne

unread,
Feb 10, 2016, 4:12:41 AM2/10/16
to Cukes
Reply all
Reply to author
Forward
0 new messages