Skip to content

Document that failing test setup stops execution even if continue-on-failure mode is active #4404

Description

@pekkaklarck

When support for controlling the continue-on-failure mode was added (#2285), we didn't think how tests setups should behave when the mode is activated. Currently if you have a test like

*** Test Cases ***
Example
    [Tags]    robot:continue-on-failure
    [Setup]     Setup Keyword
    Keyword In Body
    Another Keyword

and the Setup Keyword fails, keywords in the test body aren't run. That can be considered inconsistent because continue-on-failure mode is explicitly enabled, but I actually like this behavior. You can have some action in setup so that execution ends if it fails, but keywords in the body that are validating that everything went as expected would all be run if the setup succeeds. This would also add some new functionality to setups that are otherwise not really different from normal keywords.

What do others (especially @oboehmer) think about this? Should we stop execution after a failing setup also when continue-on-failure mode is on? If yes, we just need to add some tests for the current behavior and mention this in the User Guide. If not, then we need to change the code as well.

A problem with changing the code is that the change would be backwards incompatible. It's a bit questionable could we do it without a deprecation in RF 5.1 but deprecation adds more work.

Activity

  1. added this to the v5.1 milestone on Jul 14, 2022
  2. pekkaklarck commented on Jul 14, 2022

    @pekkaklarck
    MemberAuthor

    If we decide to make setups special so that failures in them stop execution even if continue-on-failure mode is on, it would be a good motivation to add setups for keywords as well. Then with each keyword you could have an "action part" that can make the keyword fail but all validation keywords in the body would be run if the "action part" succeeds. That could be considered surprising/inconsistent if you use robot:recursive-continue-on-failure that is supposed to enable continuability everywhere, but having an opt-out possibility could be convenient. You wouldn't need to use keyword setups if you didn't want that behavior. Anyway, possible keyword setups are a topic for a separate issue.

  3. added a commit that references this issue on Jul 14, 2022
    0b9ac1d
  4. pekkaklarck commented on Jul 14, 2022

    @pekkaklarck
    MemberAuthor

    I asked this also on Slack and everyone there agreed that the current behavior is good. Setups have a somewhat different semantics than normal keywords and always stopping test if a setup fails makes sense. @oboehmer already provided a PR adding tests for the behavior as well as documenting it in the User Guide.

  5. added
    acknowledge
    on Jul 14, 2022
  6. changed the title [-]Decide how test setup should behave when continue-on-failure mode is active[/-] [+]Document that failing test setup stops execution even if continue-on-failure mode is active[/+] on Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgealpha 1priority: medium

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions