Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SpecFlow - Retry failed tests

Is there a way to implement an AfterScenario hook to re-run the current test in case of Fail?

Something like this:

[AfterScenario("retry")]
public void Retry()
{
    if (ScenarioContext.Current.TestError != null)
    {
     // ?     
    }
}

Note: The tests in my project are combined in Ordered tests and executed via MsTest.

like image 260
LeeWay Avatar asked Jan 22 '14 09:01

LeeWay


1 Answers

This plugin is awesome. https://github.com/arrty/specflow-retry. I got it to work with nunit and his example is using MS-Test

It will allow you to do this:

@retry:2
Scenario: Tag on scenario is preferred
Then scenario should be run 3 times
like image 142
LaTisha Avatar answered Oct 04 '22 23:10

LaTisha