Behat/Behat — pull request #203 by ctrahey (2012-10-18 07:31:24+00:00)
Title: Late parsing of Definitions

It became apparent to me that dynamically attaching subContexts would be a great idea.
Primary use-case is tagged scenario hooks; I think it's a great way to organize large sets of contexts.

However, Behat only parses definitions prior to running any features/scenarios.

This change is analogous to "late binding" (maybe more accurately "lazy loading") for definitions.

This allows a subcontext to be added in e.g. @beforeScenario hook, and it's definition will be loaded properly for that scenario's steps.

I think the end result of this is highly desirable, and I'm willing to work (read: write code) to make it happen in the cleanest way possible. Take a grain of salt that I am not a Symphony dev, but I'm ready to be schooled.

I am happy to provide sample code for how this feature makes our Behat setup more intelligent and lean :-)