Search in sources :

Example 1 with Step

use of org.jbehave.core.steps.Step in project jbehave-core by jbehave.

the class StoryRunner method generatePendingStepMethods.

private void generatePendingStepMethods(RunContext context, List<Step> steps) {
    List<PendingStep> pendingSteps = new ArrayList<>();
    for (Step step : steps) {
        if (step instanceof PendingStep) {
            pendingSteps.add((PendingStep) step);
        }
    }
    if (!pendingSteps.isEmpty()) {
        PendingStepMethodGenerator generator = new PendingStepMethodGenerator(context.configuration().keywords());
        List<String> methods = new ArrayList<>();
        for (PendingStep pendingStep : pendingSteps) {
            if (!pendingStep.annotated()) {
                methods.add(generator.generateMethod(pendingStep));
            }
        }
        reporter.get().pendingMethods(methods);
    }
}
Also used : PendingStep(org.jbehave.core.steps.StepCreator.PendingStep) ArrayList(java.util.ArrayList) Step(org.jbehave.core.steps.Step) ParametrisedStep(org.jbehave.core.steps.StepCreator.ParametrisedStep) PendingStep(org.jbehave.core.steps.StepCreator.PendingStep) PendingStepMethodGenerator(org.jbehave.core.steps.PendingStepMethodGenerator)

Example 2 with Step

use of org.jbehave.core.steps.Step in project jbehave-core by jbehave.

the class StoryRunner method runStepsWhileKeepingState.

private void runStepsWhileKeepingState(RunContext context, List<Step> steps) throws InterruptedException {
    if (steps == null || steps.size() == 0) {
        return;
    }
    State state = context.state();
    for (Step step : steps) {
        try {
            context.interruptIfCancelled();
            state = state.run(step);
        } catch (RestartingScenarioFailure e) {
            reporter.get().restarted(step.toString(), e);
            throw e;
        }
    }
    context.stateIs(state);
}
Also used : Step(org.jbehave.core.steps.Step) ParametrisedStep(org.jbehave.core.steps.StepCreator.ParametrisedStep) PendingStep(org.jbehave.core.steps.StepCreator.PendingStep) RestartingScenarioFailure(org.jbehave.core.failures.RestartingScenarioFailure)

Aggregations

Step (org.jbehave.core.steps.Step)2 ParametrisedStep (org.jbehave.core.steps.StepCreator.ParametrisedStep)2 PendingStep (org.jbehave.core.steps.StepCreator.PendingStep)2 ArrayList (java.util.ArrayList)1 RestartingScenarioFailure (org.jbehave.core.failures.RestartingScenarioFailure)1 PendingStepMethodGenerator (org.jbehave.core.steps.PendingStepMethodGenerator)1