Cucumber hooks: what is the execution order of Before, BeforeStep, After, AfterStep?
Multiple hooks in different classes are firing in a weird order.
cucumberhooks
Multiple hooks in different classes are firing in a weird order.
Accepted solution
Order per scenario: Before (all) -> BeforeStep -> Step -> AfterStep -> (repeat per step) -> After (all, reverse of Before). Tagged hooks run only for matching scenarios. Use @Order or the hook order= param to make execution deterministic across classes.