If/Else Logic
Using If/Else
Cycle has the ability to use If / Else / ElsIf structures. The basic syntax of an if statement is shown in the following diagram. The only required elements of the if structure are the If and EndIf keywords. The use of Else and ElsIf elements are optional.
The figure below demonstrates a Feature File that prompts the user for a number and If/Elsif/Else to determine if the number entered was 1, 2, 3, or none of those.
Combining If/Else with "I execute Scenario..."
In some cases it may be helpful to call an imported Scenario inside of an if statement, as in the example below which would wait .5 seconds in the middle of each loop.
The benefit of using the if/else here is that the overall Feature can keep running even in the event of a failure of the inner looping Scenario.
Note: Though a failure in an inner Scenario that is called from an if/else would cause an error to display in the output panel, the top level feature would still report a success.