public function printStep(Formatter $formatter, Scenario $scenario, StepNode $step, StepResult $result)
    {
        /** @var JUnitOutputPrinter $outputPrinter */
        $outputPrinter = $formatter->getOutputPrinter();

        $message = $step->getKeyword() . ' ' . $step->getText();

        if ($result instanceof ExceptionResult && $result->hasException()) {
            $message .= ': ' . $this->exceptionPresenter->presentException($result->getException());
        }

        $attributes = array('message' => $message);

        switch ($result->getResultCode()) {
            case TestResult::FAILED:
                $outputPrinter->addTestcaseChild('failure', $attributes);
                break;

            case TestResult::PENDING:
                $attributes['type'] = 'pending';
                $outputPrinter->addTestcaseChild('error', $attributes);
                break;

            case StepResult::UNDEFINED:
                $attributes['type'] = 'undefined';
                $outputPrinter->addTestcaseChild('error', $attributes);
                break;
        }
    }