Status: New
Owner: ----
Labels: Type-Enhancement Priority-Medium

New issue 488 by tookko: Simpler conditional execution
http://code.google.com/p/robotframework/issues/detail?id=488

At least with GUI testing it's quite typical that there's a need to do
conditional execution, whether you want or not. This is currently possible
via Set Variable If / Run Keyword If / Run Keyword And Ignore Error
keywords; however they are quite clumsy and create too much unneeded
information in the test report as well, especially if multiple keywords
should follow the "exception" branch. It's also quite much hassle as when
reading the test case you need to constantly jump to the user keywords in
order to see what the branch contained.

Example with SwingLibrary (closes 2 dialogs in case 1st one popped up, but
continues test case if there is no popup):

${status}= | Run Keyword And Ignore Error | Select Dialog | Error
Run Keyword If | "${status}" == 'PASS' | Close And Confirm Dialog

"Close And Confirm Dialog" keyword:

Push Button | OK
Select Dialog | Confirm Close
Push Button | OK
Select Main Window

The proposal (1) is to add an :IF construct in same manner as the :FOR
construct,

${status}= | Run Keyword And Ignore Error | Select Dialog | Error
:IF | "${status}"=='PASS'
    | Push Button | OK
    | Select Dialog | Confirm Close
    | Push Button | OK
    | Select Main Window

This way we do not need to implement a new user keyword every time we want
to do conditional execution; also the report would look cleaner.

Developing this further, proposal (2) :IFPASS and :IFFAIL would make
handling of this kind of exception scenarios even simpler,

:IFPASS | Select Dialog | Error
        | Push Button | OK
        | Select Dialog | Confirm Close
        | Push Button | OK
        | Select Main Window


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

Reply via email to