-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a getScenario method to BeforeStepScope and AfterStepScope #653
Comments
The interface
|
👍 |
1 similar comment
👍 |
I am looking forward to it so much. I need insert scenario name to screenshot name... ;-) |
cf #795 |
Another way is : /** @var \Behat\Gherkin\Node\ScenarioNode $scenario */
$scenario = current($scope->getFeature()->getScenarios()); Having a public method would a be must-have though. Event if it implements one of the "hacks" at the moment. |
The following is what I'm using currently ; <?php
class FeatureContext {
// snip
private function getScenario(StepScope $scope)
{
$scenario = null;
$feature = $scope->getFeature();
$step = $scope->getStep();
$line = $step->getLine();
foreach ($feature->getScenarios() as $tmp) {
if ($tmp->getLine() > $line) {
break;
}
$scenario = $tmp;
}
return $scenario;
}
} In my features context file. |
This would fix the issue reported in #650 - you could call $scope->getScenario()->hasTag() to check for the tag.
The text was updated successfully, but these errors were encountered: