I'd not include such logic in a test as a test should either fail or pass. Retry logic is prone to flaws. (Resources, transactions, pre-conditions could be dangling.)
Why do you need to retry? I guess your tests could be unstable/undeterministic and you would prefer to try again before reporting a failure? Solutions: - Fix your environment, mocks, stubs, drivers and system-under-test to get stable deterministic results. - Collect failing tests with a script and run them selectively. Sorry that I can't help you further but it seems to me that there is an underlying problem that retriyng would not fix. On Tue, Aug 13, 2013 at 12:10 AM, Mauro Talevi <mauro.tal...@aquilonia.org>wrote: > No, the issue JBEHAVE-755 address a different concern: that of retrying > in the same execution run, not in a subsequent one, which is what you seem > to be after (if I understood correctly). > > If you want to use the RestartingScenarioFailure, then as already said you > need to implement yourself the logic for when it's thrown, by catching a > known exception: > > > @Given("user is on Home page") > public void userIsOnHomePage() { > try { > pages.home().open(); > } catch ( YourException e ) { > throw new RestartingScenarioFailure(e); > } > } > > Implementing the full retry logic is not trivial, as already said, and > touches the internals of the runner. I don't think it's possible to > implement with the current low-level 3.8 API. > > If you have problems accessing JIRA, please raise an issue at > https://jira.codehaus.org/browse/HAUS. > > > On 12/08/2013 15:28, Selenium Learner 2013 wrote: > > Ok, I tried for some time after having off on Sunday and found that I > can't log in to Jira for some strange reasons even though I have an account > on Xircles .. > Nevertheless , I found one jira which is being opened since last year( > https://jira.codehaus.org/browse/JBEHAVE-755)which talks about retry > logic , so can I put this comments in the same jira? pls advise.. > IF we need to implement the retry logic in Jbehave, would that be API > level change which has to be released properly? > I have one solution as creating a flat file with failed scenarios and > creating a story on the fly..is this possible with current Jbehave 3.8 > stable release version? Pls advise. > Sorry for asking too many questions:(.. > Also , I had mistake in the code snippet in my previous mail..the correct > code snippet can be given as > @Given("user is on Home page") > public void userIsOnHomePage() throws RestartingScenarioFailure > > { > pages.home().open(); > } > > but this is not enabling to run the failed scenario re-run again? Any > more coding I'm missing?Pls advise. > > Awaiting the reply.. > > > > On Sat, Aug 10, 2013 at 10:50 PM, Mauro Talevi <mauro.tal...@aquilonia.org > > wrote: > >> No, you don't duplicate the method. You need to implement some logic >> in the same method to catch a known exception (based on the logic >> implemented in your pages) and rethrow a RestartingScenarioFailure, where >> appropriate. >> >> Implementing a retry logic is possible, but not trivial. It involves >> persisting the results of the previous run which is not easy to do without >> taking into account the interaction with the embedding system. >> >> Feel free to raise a JIRA issue, it may get some ideas flowing. >> >> Cheers >> >> >> On 10/08/2013 16:29, Selenium Learner 2013 wrote: >> >> Hmm.. >> So if I have a step defined as for an example: >> @Given("user is on Home page") >> public void userIsOnHomePage(){ >> pages.home().open(); >> } >> >> and I want to run this step again if it fails while running it through >> Jenkins Job then do I need to include something like >> @Given("user is on Home page") >> public void userIsOnHomePage() Throwable >> RestartingScenarioFailure("Failed scenario") >> ) >> { >> pages.home().open(); >> } >> >> in the code so that it can re-run again? Pls advise. >> >> Please let me know if you have any questions. >> PS: I think if Jbehave can include retry logic feature then it would be >> great as we can do it in TestNG which takes automation framework to the >> next level..Do I need to raise Jira if you permit? >> >> >> On Sat, Aug 10, 2013 at 8:07 PM, Mauro Talevi <mauro.tal...@aquilonia.org >> > wrote: >> >>> No, there is no such feature currently. >>> >>> What is possible is to implement some logic in your step to verify >>> failure/success according to your criteria and, if failed, you can throw a >>> RestartingScenarioFailure exception which will tell the runner to restart >>> the scenario, i.e. re-execute the scenario steps. >>> >>> >>> On 09/08/2013 14:49, Selenium Learner 2013 wrote: >>> >>>> Hi All, >>>> >>>> Is it possible in Jbehave to run failed scenarios once again after >>>> finishes jenkins job like kind of Retry logic? Please advise .If possible >>>> then any documentation available in Jbehave? >>>> >>>> Regards, >>>> Selenium-777 >>>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe from this list, please visit: >>> >>> http://xircles.codehaus.org/manage_email >>> >>> >>> >> >> > >