Hi,
A few days ago I found some behaviour of which I'm not sure whether it's a bug or a feature. In my behat.yml I have defined multiple suites, and in my contexts I have also defined a @BeforeSuite hook. When I run a test passing the path of the feature file and no --suite= option, Behat will cycle through all my suites executing the @BeforeSuite (and I presume, but I did not test, also the @AfterSuite) for every suite in my behat.yml. Even though via the paths: configuration the feature I was running is only defined for one suite.
If running without --suite, but with a filter (whether it's passing a specific feature file or using something like --tags) I would expect Behat to ignore any suites that don't have any matching features or scenario's. And if a suite is ignored, you also don't need to run any @BeforeSuite and @AfterSuite.
Can this be considered a bug, or it is an intentional feature? For example is it possible to manipulate the filters or paths or something in the @BeforeSuite that might cause Behat to run scenario's for the suite even though initially nothing would have matched?
If this can be considered a bug (or unintentional behaviour) I don't mind diving into the code to see if I can create a PR for it, but I'm not sure where to start looking where something like this can be changed.
Hi,
A few days ago I found some behaviour of which I'm not sure whether it's a bug or a feature. In my
behat.ymlI have defined multiple suites, and in my contexts I have also defined a@BeforeSuitehook. When I run a test passing the path of the feature file and no--suite=option, Behat will cycle through all my suites executing the@BeforeSuite(and I presume, but I did not test, also the@AfterSuite) for every suite in mybehat.yml. Even though via thepaths:configuration the feature I was running is only defined for one suite.If running without
--suite, but with a filter (whether it's passing a specific feature file or using something like--tags) I would expect Behat to ignore any suites that don't have any matching features or scenario's. And if a suite is ignored, you also don't need to run any@BeforeSuiteand@AfterSuite.Can this be considered a bug, or it is an intentional feature? For example is it possible to manipulate the filters or paths or something in the
@BeforeSuitethat might cause Behat to run scenario's for the suite even though initially nothing would have matched?If this can be considered a bug (or unintentional behaviour) I don't mind diving into the code to see if I can create a PR for it, but I'm not sure where to start looking where something like this can be changed.