Writing Tests
Control Flow Steps
Add conditional logic and branching to your tests
Control flow steps add conditional logic to your tests, enabling dynamic test paths based on runtime conditions.
Conditional
Execute different steps based on an AI-evaluated condition. Enables branching logic without writing code.
Configuration:
condition(required): Condition to evaluate using AI in natural language (e.g., "User is logged in", "Cart is empty")thenSteps(required): Steps to execute if the condition is trueelseSteps(optional): Steps to execute if the condition is false
Examples:
- Login check:
"User is already logged in"→ skip login steps - Empty state:
"No items in the cart"→ add items before checkout - Feature flag:
"Dark mode toggle is visible"→ test dark mode functionality
When to Use Control Flow
- Handling different application states (logged in vs. logged out)
- Testing multiple paths in a single test case
- Adapting to dynamic content or feature flags
- Creating resilient tests that handle varying conditions
Control flow steps make your tests more flexible by adapting to the actual state of your application rather than assuming a fixed state.
