Skip to content

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).


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 issued

You can also write @depends_on("target1", "target2") or use multiple separate @depends_on(...) tags.


During testform plan and testform apply:

  1. Testform builds a Directed Acyclic Graph (DAG) of all planned test resources.
  2. Applies Kahn’s algorithm to resolve the exact linear execution sequence.
  3. Prerequisite scenarios (auth/login) are verified before downstream scenarios (checkout/order).

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_success

Output the complete dependency DAG in standard Graphviz DOT format:

Ventana de terminal
testform graph
Ventana de terminal
# Render to image using Graphviz:
testform graph | dot -Tpng -o dependencies.png