You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support disabling continue-on-failure mode using robot:stop-on-failure and robot:recursive-stop-on-failure tags #4303
When a keyword fails, Robot's default behavior is to stop executing the current test or a user keyword. There are, however, few cases where the remaining keywords in the test/keyword are run (i.e. the continue-on-failure mode is on):
When executing keywords in test or keyword teardown.
When a test has a template, all top level iterations are run even if one of them would fail.
It would sometimes be convenient to be able to turn the continue-on-failure more off in the above cases. A concrete example is #4293, where TRY/EXCEPT behaves differently in teardowns and elsewhere. When robot:recursive-continue-on-failure was added, we discussed about adding robot:no-continue-on-failure to be able to disable it. It wasn't done then, but now would be a good time. For consistency reasons we should also support templates.
UPDATE: We decided to use robot:stop-on-failure tag and also added recursive variant robot:recursive-stop-on-failure.
I think the only design decision related to this is deciding should robot:no-continue-on-failure be recursive or not. I got a feeling it should be recursive even though it would be inconsistent with robot:continue-on-failure. Alternatively we could add separate robot:recursive-no-continue-on-failure but that's getting pretty complicated.
I would opt for it not to be recursive.. Not to continue is the default, so why should it be recursive? Let me create a PR shortly, we can discuss there..
one question is also if a test-level robot:no-continue-on-failure would propagate into the Teardown method or not?
No-continue-on-failure-2 in Teardown
[Documentation] FAIL 1
[Tags] robot:no-continue-on-failure
[Teardown] Run Keywords Fail 1 AND Fail 2
Log does not matter
At the moment this is passing (i.e. Fail 2 is not executed), but it feels odd.. if a user wants to avoid continue in teardown, he needs to use a user keyword..
Edit: Sleeping over it: to support disabling continue in user keyword teardown, we would need a similar design pattern, so maybe we should honor the test case tag as well in continue:
*** Keywords ***
User Keyword Teardown
[Tags] robot:no-continue-on-failure
[Teardown] Run Keywords Fail kw1a AND Fail kw1b
No Operation
So maybe the documentation will be like:
setting the tag robot:no-continue-on-failure on a test case or on a keyword will disable continue on failure both in the test case/keyword as well as in the test case/keyword teardown.
If overloading this doesn't look right, we could introduce a distinct robot:no-continue-on-failure-in-teardown tag which would make this behaviour more explicit..
The reason I got a feeling robot:no-continue-on-failure should be recursive is that then you could just set it once for the teardown keyword. Otherwise you needed to set it to all keywords used in teardowns to make sure TRY/EXCEPT works consistently (#4293). Same thing if you want to stop robot:recursive-continue-on-failure from propagating. It would be odd if continue-on-failure mode would be off in a keyword using robot:no-continue-on-failure but would again be enabled in keywords used by it.
robot:no-continue-on-failure being recursive when robot:continue-on-failure is not is obviously somewhat inconsistent. Possible solutions:
Add both robot:no-continue-on-failure and robot:recursive-no-continue-on-failure to match the earlier added robot:continue-on-failure and robot:recursive-continue-on-failure. That robot:recursive-no-continue-on-failure is a rather long tag name, but this would be a pretty explicit, consistent and backwards compatible solution.
Change robot:continue-on-failure to be recursive and deprecate robot:recursive-continue-on-failure. Having just robot:continue-on-failure and robot:no-continue-on-failure would be simpler but not being able to limit continue-on-failure only to a certain level could be problematic. This would obviously be a backwards incompatible change as well.
I think test level robot:no-continue-on-failureshould not affect teardowns. We can think teardowns having implicit robot:recursive-continue-on-failure set and it overrides possible higher level configuration.
Sorry, don't have time to look at PRs today. It would be important to agree on the semantics first anyway. That might be something to discuss further on Slack.
I've been thinking this a bit more and here's how I currently think we should do this:
Let's use robot:stop-on-failure instead of robot:no-continue-on-failure.
Make it not recursive to match how robot:continue-on-failure works.
Add also robot:recursive-stop-on-failure to match robot:recursive-continue-on-failure.
Neither stop-on-failure variants should propagate to teardowns. We can think them having robot:recursive-continue-on-failure implicitly. To enable the stop-on-failure mode in teardowns, these special tags need to be used explicitly.
Thanks for the PR! I won't have time to look at it in the immediate future but hopefully next week. I want to do few things in master before we create a maintenance branch for RF 5.0.x and start merging RF 5.1 features.
changed the title [-]Support disabling continue-on-failure mode[/-][+]Support disabling continue-on-failure mode using `robot:stop-on-failure` and `robot:recursive-stop-on-failure` tags[/+]on Jul 4, 2022
Activity
oboehmer commentedon Apr 7, 2022
I can take this, @pekkaklarck ..
pekkaklarck commentedon Apr 7, 2022
That would be great @oboehmer!
pekkaklarck commentedon Apr 7, 2022
I think the only design decision related to this is deciding should
robot:no-continue-on-failurebe recursive or not. I got a feeling it should be recursive even though it would be inconsistent withrobot:continue-on-failure. Alternatively we could add separaterobot:recursive-no-continue-on-failurebut that's getting pretty complicated.oboehmer commentedon Apr 7, 2022
I would opt for it not to be recursive.. Not to continue is the default, so why should it be recursive? Let me create a PR shortly, we can discuss there..
oboehmer commentedon Apr 7, 2022
please check #4306
oboehmer commentedon Apr 7, 2022
one question is also if a test-level
robot:no-continue-on-failurewould propagate into the Teardown method or not?At the moment this is passing (i.e. Fail 2 is not executed), but it feels odd.. if a user wants to avoid continue in teardown, he needs to use a user keyword..
Edit: Sleeping over it: to support disabling continue in user keyword teardown, we would need a similar design pattern, so maybe we should honor the test case tag as well in continue:
So maybe the documentation will be like:
If overloading this doesn't look right, we could introduce a distinct
robot:no-continue-on-failure-in-teardowntag which would make this behaviour more explicit..pekkaklarck commentedon Apr 8, 2022
The reason I got a feeling
robot:no-continue-on-failureshould be recursive is that then you could just set it once for the teardown keyword. Otherwise you needed to set it to all keywords used in teardowns to make sure TRY/EXCEPT works consistently (#4293). Same thing if you want to stoprobot:recursive-continue-on-failurefrom propagating. It would be odd if continue-on-failure mode would be off in a keyword usingrobot:no-continue-on-failurebut would again be enabled in keywords used by it.robot:no-continue-on-failurebeing recursive whenrobot:continue-on-failureis not is obviously somewhat inconsistent. Possible solutions:robot:no-continue-on-failureandrobot:recursive-no-continue-on-failureto match the earlier addedrobot:continue-on-failureandrobot:recursive-continue-on-failure. Thatrobot:recursive-no-continue-on-failureis a rather long tag name, but this would be a pretty explicit, consistent and backwards compatible solution.robot:continue-on-failureto be recursive and deprecaterobot:recursive-continue-on-failure. Having justrobot:continue-on-failureandrobot:no-continue-on-failurewould be simpler but not being able to limit continue-on-failure only to a certain level could be problematic. This would obviously be a backwards incompatible change as well.pekkaklarck commentedon Apr 8, 2022
I think test level
robot:no-continue-on-failureshould not affect teardowns. We can think teardowns having implicitrobot:recursive-continue-on-failureset and it overrides possible higher level configuration.pekkaklarck commentedon Apr 8, 2022
Sorry, don't have time to look at PRs today. It would be important to agree on the semantics first anyway. That might be something to discuss further on Slack.
oboehmer commentedon Apr 8, 2022
agree, started a thread on slack..
pekkaklarck commentedon Apr 12, 2022
I've been thinking this a bit more and here's how I currently think we should do this:
robot:stop-on-failureinstead ofrobot:no-continue-on-failure.robot:continue-on-failureworks.robot:recursive-stop-on-failureto matchrobot:recursive-continue-on-failure.stop-on-failurevariants should propagate to teardowns. We can think them havingrobot:recursive-continue-on-failureimplicitly. To enable the stop-on-failure mode in teardowns, these special tags need to be used explicitly.oboehmer commentedon Apr 13, 2022
@pekkaklarck , I created PR #4313 based on the recent design discussions. Please review when you have a chance.
pekkaklarck commentedon Apr 14, 2022
Thanks for the PR! I won't have time to look at it in the immediate future but hopefully next week. I want to do few things in master before we create a maintenance branch for RF 5.0.x and start merging RF 5.1 features.
Add `robot:(recursive-)stop-on-failure` for disabling continue-on-fai…
pekkaklarck commentedon Jun 9, 2022
This was implemented in PR #4313 by @oboehmer. Thanks for a great contribution!
UG: Enhance the Continuing on failure section.
[-]Support disabling continue-on-failure mode[/-][+]Support disabling continue-on-failure mode using `robot:stop-on-failure` and `robot:recursive-stop-on-failure` tags[/+]