Differences between "IF... ELSEIF..." and "Run Keyword If"

Hi John,

Yes you can use both, however the documentation for Run Keyword If says:

NOTE: Robot Framework 4.0 introduced built-in IF/ELSE support and using that is generally recommended over using this keyword.

Run Keyword If, has not been deprecated yet but may be in the future, though as far as I know there are no plans to deprecate them any time soon, This thread from quite a while back might be interesting reading on the topic.

Basically while these are the old way of doing things, these are kept around so the many thousands of existing test cases don’t break, I guess there could be an argument that there are times when it’s necessary to use them, particularly when combining them with other keywords but in general as Aleh (@JaPyR) mentioned, using the new style is easier to read and makes tests easier to maintain.

Dave.

2 Likes