Examples of StepResult


Examples of org.jbehave.core.steps.StepResult

        public State run(Step step) {
            if ( step instanceof ParametrisedStep ){
                ((ParametrisedStep)step).describeTo(reporter.get());
            }
            UUIDExceptionWrapper storyFailureIfItHappened = storyFailure.get();
            StepResult result = step.perform(storyFailureIfItHappened);
            result.describeTo(reporter.get());
            UUIDExceptionWrapper stepFailure = result.getFailure();
            if (stepFailure == null) {
                return this;
            }

            storyFailure.set(mostImportantOf(storyFailureIfItHappened, stepFailure));
View Full Code Here

Examples of org.jbehave.core.steps.StepResult

        public SomethingHappened(UUIDExceptionWrapper scenarioFailure) {
            this.scenarioFailure = scenarioFailure;
        }

        public State run(Step step) {
            StepResult result = step.doNotPerform(scenarioFailure);
            result.describeTo(reporter.get());
            return this;
        }
View Full Code Here

Examples of org.jbehave.core.steps.StepResult

        }
    }

    private class SomethingHappened implements State {
        public void run(Step step) {
            StepResult result = step.doNotPerform();
            result.describeTo(reporter);
        }
View Full Code Here

Examples of org.jbehave.core.steps.StepResult

    private final class FineSoFar implements State {

        public void run(Step step) {

            StepResult result = step.perform();
            result.describeTo(reporter);
            Throwable scenarioFailure = result.getFailure();
            if (scenarioFailure != null) {
                state = new SomethingHappened();
                storyFailure = mostImportantOf(storyFailure, scenarioFailure);
                currentStrategy = strategyFor(storyFailure);
            }
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.result.StepResult

        scenarioOutput.getSteps().forEach(so -> reportStep(so, issues));
    }

    private void reportStep(final StepOutput stepOutput, final Collection<String> issues) {
        final Ansi.Color color;
        final StepResult stepResult = stepOutput.getResult();
        if (stepResult instanceof StepResult.Error) {
            color = RED;
        } else if (stepResult instanceof StepResult.Failure) {
            color = YELLOW;
        } else if (stepResult instanceof StepResult.Pending) {
            color = CYAN;
        } else if (stepResult instanceof StepResult.Skipped) {
            color = MAGENTA;
        } else if (stepResult instanceof StepResult.Success) {
            color = GREEN;
        } else {
            throw new IllegalStateException("The [" + stepResult+ "] step result is not supported by the reporter");
        }

        try {
            final Ansi stepReportOutput = ansi().fg(color).a("        " + stepOutput.getDescription()).reset().newline();
            writer.append(stepReportOutput.toString());
            if (stepResult instanceof StepResult.Error || stepResult instanceof StepResult.Failure) {
                for (final String issue : issues) {
                    final String issueTrackerUrlPattern = Configuration.getConfig("issueTrackerUrlPattern", "%s");
                    writer.append("Issue: " + String.format(issueTrackerUrlPattern, issue) + "\n");
                }
            }

            if (stepResult instanceof StepResult.Error) {
                stepResult.getException().printStackTrace(new PrintWriter(writer, true));
            }
            if (stepResult instanceof StepResult.Failure) {
                stepResult.getException().writeTo(writer, 3);
            }

        } catch (final IOException e) {
            throw new IllegalStateException(e);
        }
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.result.StepResult

            stepOutputs = new ArrayList<StepOutput>(steps.size());
            for (final Step step : steps) {
                final StepOutput stepOutput;
                if (ScenarioResult.Success.equals(result)) {
                    stepOutput = stepExecutor.apply(step, stepHooks);
                    final StepResult stepResult = stepOutput.getResult();
                    if (stepResult instanceof StepResult.Error) {
                        result = ScenarioResult.Error;
                    } else if (stepResult instanceof StepResult.Failure) {
                        result = ScenarioResult.Failure;
                    } else if (stepResult instanceof StepResult.Pending) {
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.result.StepResult

    public StepOutput execute(final StepHooks hooks) {

        hooks.startStep(this);

        StepResult result;
        try {
            result = stepImplementation.step();
        } catch (final Throwable t) {
            t.printStackTrace(); //TODO replace with some logger
            result = StepResult.error(t);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.