/** * get failing step from a scenario * * @param $scenario * @return Step */ protected function getFailingStep(Scenario $scenario) { // failed step is last step with executed = true $steps = $scenario->getSteps(); foreach ($steps as $step) { /** @var $step Step */ if ($step->executed == false) { return $step; } } return current(array_reverse($steps)); }