JoshKeegan / xRetry

Retry running tests via Xunit and Specflow
MIT License
47 stars 14 forks source link

Add a json configuration file and ability to add retry at global level #71

Closed CmdrRamon closed 3 years ago

CmdrRamon commented 3 years ago

Hi,

I add this optional configuration file : retrySettings.json { "isVerbose": true, "Global": true, "MaxRetry": 3, "DelayBetweenRetriesMs": 500 }

And some feature file to validate all changes.

The goal is to add retry trait to all specflow file

JoshKeegan commented 3 years ago

If I have understood correctly, you want to be able to make all tests in a specflow project retry automatically without needing make any changes to feature files (i.e. not add "@retry" above a scenario). It is an interesting addition and I will have to think about whether it is something I would like to include in the library as adding this has some downsides:

So this one needs some consideration. I have previously thought about perhaps being able to mark a whole feature file to be retried, which would also reduce the noise of every test needing the "@retry" tag adding, but still keep it clear in the feature file that retries are happening.

I do like the idea of being able to control the number of retries and the delay globally via a configuration file, but that is also something that I think would need implementing at the xUnit level so that the feature would be available in both xUnit and xUnit.SpecFlow.

CmdrRamon commented 3 years ago

I'm happy to hear you so quickly. The reason why I develop this is because we've several BDD solution with almost 500 BDD test with Specflow. It's indeed concerns only by Specflow file generation not XUnit.

Anyway, by default the retry is not apply everywhere so there is no change by default. The user is « just » able to set the « Global » variable if he wants.

Keep me in touch if you change something.

This feature fit our need but it can be improve :)

JoshKeegan commented 3 years ago

Having thought about it some more, I can see the value in there being a global configuration for a project that allows for all tests in it to be retried by default, so I think that could be a part of a future version of the library. Whilst it would be specflow only and is hidden from the feature file, it's still a valueable tool even if it lets the end-user "shoot themselves in the foot" so to speak.

I won't merge this PR though as the global default changes being specific to specflow isn't how I think that should work (it needs to be applicable to xunit tests too). I also think that the new tests covering this functionality need to live in their own project, as the way they have been added to the existing project means many existing test cases are now running with a combination of the global defaults and test-specific retry tags.

So I'm going to close this PR and create two new feature requests from it, linking back to this. Thanks for combing up with these ideas and taking the time to work on them!

CmdrRamon commented 3 years ago

Thank for these actions. I like the idea of an extension of this plugin for global retry