Hooks
Lifecycle hooks attach to specific points in a BDD run. Available
points: BeforeAll, AfterAll, BeforeFeature, AfterFeature,
BeforeScenario, AfterScenario, BeforeStep, AfterStep.
Hooks support optional tag filters and an ordering value. After* hooks
run even when earlier hooks or steps failed — they are the cleanup
guarantee.
Rust
JavaScript / TypeScript
Tag expressions
tags accepts the same boolean expression grammar as the --tags CLI
flag:
Ordering
order is an i32 — lower runs first. Before hooks run in ascending
order; After hooks run in descending order (cleanup mirrors setup).
Hook failure semantics
- A failing
Beforehook: the scenario is marked failed; steps are not executed;Afterhooks still run. - A failing
Afterhook: the scenario is marked failed even if the steps passed; subsequentAfterhooks still run. BeforeAll/AfterAllfailures do not cascade to other suites.