Skip to content

New BuiltIn keyword for continuing for loop execution #1125

Closed

Description

@spooning

Originally submitted to Google Code by SamerAdra on 7 May 2012

I would like to be able to continue to the next iteration in a for loop... That is, skip all the rest of the stuff in the current block and start with the next variable in the loop. It would make certain operations a lot easier.

The existing "Exit For Loop" is the same as "break" in C#.
"Continue For Loop" would be the same as "continue" in C#.

Activity

  1. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 7 May 2012

    We have decided not to implement this keyword because you can already use Run Keyword If to simulate it:

    :FOR ${x} IN @⁠{STUFF}
    \ Do something ${x}
    \ Run Keyword If "${x}" == "zzz" Go to bed

    Adding separate keyword wouldn't help too much either because you needed to use it with Run Keyword If anyway. I actually think the example above is simpler than the example demonstrating Continue For Loop below:

    :FOR ${x} IN @⁠{STUFF}
    \ Do something ${x}
    \ Run Keyword If "${x}" != "zzz" Continue For Loop
    \ Go to bed

    Notice that Exit For Loop was different because simulating break required a really ugly hack ( issue 502 ).

  2. added this to the 2.8 milestone on Jun 29, 2014
  3. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by SamerAdra on 7 May 2012

    The trouble comes when you want to do a lot of stuff in a for loop, which won't all fit in a single keyword.

    What if there are 10 keywords in my for loop and I only want to run them based on some condition? Under the current implementation, I would have to use multiple redundant "Run Keyword If" statements, one for each keyword in the for loop that I didn't want to execute. (Another option would be to abstract out the rest of the for loop body into it own keyword, but that might not always make sense.)

    -Samer

  4. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by immo.wetzel on 12 Dec 2012

    This would be a good function for us too. (Common function at programming languages)

    That creates ones more a new keyword for a simple task.

  5. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 22 Jan 2013

    The has recently been interest in providing a patch to implement this feature. Let's see will that happen even before 2.7.7.

  6. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @jussimalinen on 22 Apr 2013

    This has been asked inside NSN, so we try to get this to 2.8 or at least 2.8.1 or so.

  7. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @mkorpela on 22 Apr 2013

    It would be also convenient to offer users "Continue For Loop If"-keyword so that

    Run Keyword If ${condition} Continue

    can be replaced with

    Continue If ${condition}

  8. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by froschre... on 2 May 2013

    a colleague of mine already implemented 'Continue For Loop' in below repository:
    https://code.google.com/r/scathaig-robotframework/source/browse

  9. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by anssi.sy... on 2 May 2013

    Thanks for contributing, we were already looking into this.

  10. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @asyrjasalo on 2 May 2013

    This issue was updated by revision 86a1236658ba.

    Implementation done. Could be refactored. Documentation not done.

  11. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @Tattoo on 3 May 2013

    This issue was updated by revision 9fa46cd352a2.

    Added Continue For Loop to user guide

  12. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @Tattoo on 3 May 2013

    Needs to be refactored after we decide, if we are going to deprecate exceptions with attributes ROBOT_XX_YY in favor of different types of exceptions. Right now, it really doesen't make sense to throw ExecutionFailed with attributes denoting that it didn't after all

  13. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @Tattoo on 6 May 2013

    This issue was updated by revision 0403877e7140.

    Fixed typos in user guide

  14. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @Tattoo on 6 May 2013

    This issue was updated by revision b5ff0515391c.

    Updated documentation

  15. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @Tattoo on 8 May 2013

    This issue was updated by revision 8776a8a05cbb.

    Added regression tag to continue for loop tests

  16. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @asyrjasalo on 14 May 2013

    This issue was updated by revision c97d732a85f5.

    Continue For Loop now uses its own exception instead of custom
    exception with the attribute ROBOT_CONTINUE_FOR_LOOP.

    This attribute was also removed. Also removed the related tests
    and helpers.

  17. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @asyrjasalo on 14 May 2013

    This issue was updated by revision 8d8e447a63bd.

    Removed rest of the refences related to the old Continue For Loop implentation.

  18. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 21 May 2013

    This issue was updated by revision 53f441c29d43.

    Enhanced docs in UG.

  19. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @pekkaklarck on 21 May 2013

    This issue was updated by revision 0df0d354dbbc.

    Enhanced kw docs. Next reviewing code and tests.

  20. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @asyrjasalo on 21 May 2013

    This issue was updated by revision 859997b3d04f.

  21. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @asyrjasalo on 21 May 2013

    This issue was updated by revision 4eb3f63b01ad.

    Status was always PASS if ExecutionFailed was raised with an empty message.

  22. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @asyrjasalo on 24 May 2013

    This issue was updated by revision 09b4d9c80d0f.

    Added Continue For Loop keyword logging.

  23. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @spooning on 27 May 2013

    Reviewed and considered done.

  24. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @spooning on 27 May 2013

    Yes, this was done....

  25. spooning commented on Jun 29, 2014

    @spooning
    ContributorAuthor

    Originally submitted to Google Code by @Tattoo on 28 May 2013

    This issue was updated by revision 0c041d0a0ef7.

    If used in keyword's teardown, the for loop was passed. This is now fixed with tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions