public function beforeScenarioSetVariables(BeforeScenarioScope $scope)
    {
        $steps = [];
        if ($scope->getFeature()->hasBackground()) {
            $steps = $scope->getFeature()->getBackground()->getSteps();
        }
        $steps = array_merge($steps, $scope->getScenario()->getSteps());
        foreach ($steps as $step) {
            preg_match_all(static::VARIABLE_REGEX, $step->getText(), $matches);
            $variables_found = $matches[0];
            // Find variables in are TableNodes or PyStringNodes.
            $step_argument = $step->getArguments();
            if (!empty($step_argument) && $step_argument[0] instanceof TableNode) {
                preg_match_all(static::VARIABLE_REGEX, $step_argument[0]->getTableAsString(), $matches);
                $variables_found = array_filter(array_merge($variables_found, $matches[0]));
            }
            foreach ($variables_found as $variable_name) {
                if (!isset($this->values[$variable_name])) {
                    $value = $this->getDriver()->getRandom()->name(10);
                    // Value forced to lowercase to ensure it is machine-readable.
                    $this->values[$variable_name] = strtolower($value);
                }
            }
        }
    }