Hook tag specificity versus declaration order in Cucumber execution
0 reputation · 15 Jul 2023, 14:50 UTC
When Cucumber evaluates multiple @Before or @After hooks matching a scenario tag, the framework applies tag specificity to determine execution precedence. Documented behavior states that more specific tags override generic ones, yet among hooks sharing equal specificity, execution follows declaration order within the same step definition file. This inquiry identifies whether declaration order applies across independently loaded step definition files or remains file-local, and how tag hierarchy affects specificity ranking in multi-module Cucumber projects.
Does Cucumber merge declaration sequences from all loaded step definition files when tag specificity is equal? How does the @tagA versus @tagA@specific hierarchy resolve specificity conflicts between hooks in different modules? Is the intra-file ordering rule intentionally scoped, and what governs inter-file hook execution precedence?