depends_on
The depends_on meta-argument allows you to explicitly define execution dependencies between test scenarios, ensuring that prerequisites are executed in the correct sequence using a topological Directed Acyclic Graph (DAG).
Gherkin Declaration (@depends_on)
Section titled “Gherkin Declaration (@depends_on)”Dependencies are declared as tags directly above a Scenario:, supporting canonical array brackets (matching Terraform lists) as well as comma-separated targets:
@checkout @e2e@depends_on(["auth/login.feature.@login_success", "inventory/cart.feature.@add_item"])Scenario: User completes checkout successfully Given shopping cart contains selected products When user confirms shipping and billing details Then order confirmation receipt is issuedYou can also write @depends_on("target1", "target2") or use multiple separate @depends_on(...) tags.
Topological DAG Ordering
Section titled “Topological DAG Ordering”During testform plan and testform apply:
- Testform builds a Directed Acyclic Graph (DAG) of all planned test resources.
- Applies Kahn’s algorithm to resolve the exact linear execution sequence.
- Prerequisite scenarios (
auth/login) are verified before downstream scenarios (checkout/order).
Circular Dependency Prevention
Section titled “Circular Dependency Prevention”If a circular dependency cycle is declared ($A \rightarrow B \rightarrow A$), Testform aborts during static analysis before executing any tests:
[ERROR] Circular dependency detected in DAG: auth/login.feature.@login_success -> checkout/order.feature.@checkout -> auth/login.feature.@login_successVisualizing the Graph: testform graph
Section titled “Visualizing the Graph: testform graph”Output the complete dependency DAG in standard Graphviz DOT format:
testform graph# Render to image using Graphviz:testform graph | dot -Tpng -o dependencies.png