Conditional Steps
Conditional steps let a test branch based on the state of the application under test. When a condition is true, the steps inside the block run; when false, the block is skipped and the test continues. A false condition never fails the test.
Writing a Condition
Write a condition in plain English at the start of a step. The following keywords introduce a condition:
given thatproviding thatifonly ifif and only ifunless
Any phrasing accepted by an assertion
can be used as a condition, including visibility, text content, element
state, URL, and variable
comparisons. Combine conditions with the logical operators and, or,
and not.
if "do you want to leave a tip?" is visible on the page
- type "15%" next to "tip"
- click "pay now"
if the "Log in" button is visible on the page
- run Login Flow
When you type a condition inline, Autonomous restructures the step into a
visual block and indents the steps that follow. Pressing Enter after an
if step auto-indents the next recorded step so it becomes part of the
block. You can also start a condition block from the editor toolbar.

Branching: if / else if / else
A condition block supports a single if, any number of else if
branches, and an optional else branch. The else block is the fallback
and must always be last.
if "do you want to leave a tip?" is visible on the page
- type "15%" next to "tip"
- click "pay now"
else
- type "10%" next to "tip"
- click "pay now"
if {userType} equals "guest"
- fill in guest shipping details
- click "Place order"
else
- click "Place order"
if the cart is empty
- click "All Products"
- click "Small Succulent Planter Pot"
- click "Add to cart"
else
- click "Checkout"

Conditions on Reusable Flows
A run, call, or execute step that invokes a
reusable flow
can be gated by a condition, so an entire sub-test runs only when the
condition is met.
if the cart is empty
- add "Wireless Mouse" to the cart
else
- run CartCleanUpFlow
if {userName} equals "adminUser"
- run Login Admin Flow
Editing Condition Blocks
The editor behaves like an IDE — editing actions are never blocked. Invalid structures are surfaced as inline validation errors until you fix them.
- Insert a step between steps — hover between two steps and click
the
+that appears. - Indent right / left —
Tab/Shift+Tabat the start of a step, or use the step's three-dot menu. Indenting anif,else if, orelsestep moves only that line; the steps nested under it stay where they are. - Multi-select — select multiple steps and indent, dedent, or drag them together.
- Move — drag a step to any position in the test.
- Convert back to a regular action — any conditional step can be edited and converted back into a regular action.
Saving and Running
A test cannot be saved while any step has an unresolved validation error.
In interactive mode, invalid steps are skipped and execution continues with the next valid step.
When a Condition Is Not Met
When a condition evaluates to false, its block is skipped, the child
steps receive a Skipped status, and an informative message is shown
on the block (for example, Condition not met). A false condition does
not fail the test.

Validation Rules
| Condition | Validation message |
|---|---|
else without a preceding if / else if | 'else' must follow an 'if' |
else if without a preceding if | 'else if' must follow an 'if' |
| Empty block (no child steps) | This block has no steps |
| A step is indented at a level that doesn't fit the surrounding block structure | Unexpected indentation |
if without a condition | Condition is missing |
else if without a condition | Condition is missing |
A step with both a condition and an Optionally instruction | A step cannot have both a condition and an 'Optionally' instruction |
Good to Know
- Conditions cannot be set on the test's first (navigation) step.