I have a FeatureContext
class, whose methods implement step definitions for my feature scenarios.
Is it possible to obtain information about current scenario or feature within FeatureContext
class? To be specific, I need the path of the feature file, so I can create directory paths relative to dirname('file.feature')
.
The context class resides somewhere in vendor directory structure, i.e. far away from the actual feature file, so getting the path using __DIR__
would not work.
Any ideas?
Thanks, Sascha
I did find an answer to my question: "hooks"
class MyContext implements Context
{
// ...
/**
* @BeforeScenario
*/
public function beforeScenario(BeforeScenarioScope $scope)
{
var_dump($scope->getFeature()->getFile());
}
}