Package org.jbehave.core.model

Examples of org.jbehave.core.model.Scenario


                "Then I should an output";

        Story story = parser.parseStory(wholeStory);

        assertThat(story.getPath(), equalTo(""));
        Scenario scenario = story.getScenarios().get(0);
        assertThat(scenario.getSteps(), equalTo(asList(
                "Given a step",
                "When I run it",
                "Then I should an output"
        )));
    }
View Full Code Here


        GivenStories givenStories = findScenarioGivenStories(scenarioWithoutTitle);
        if (givenStories.requireParameters()) {
            givenStories.useExamplesTable(examplesTable);
        }
        List<String> steps = findSteps(scenarioWithoutTitle);
        return new Scenario(title, meta, givenStories, examplesTable, steps);
    }
View Full Code Here

    private Scenario parseScenario(String scenarioAsText) {
        String title = findScenarioTitle(scenarioAsText);
        ExamplesTable examplesTable = findExamplesTable(scenarioAsText);
        List<String> givenStoryPaths = findGivenStoryPaths(scenarioAsText);
        List<String> steps = findSteps(scenarioAsText);
        return new Scenario(title, givenStoryPaths, examplesTable, steps);
    }
View Full Code Here

        when(candidate.matches("my step")).thenReturn(true);
        when(candidate.createMatchedStep("my step", parameters)).thenReturn(executableStep);
        when(steps.listCandidates()).thenReturn(asList(candidate));

        // When
        List<Step> executableSteps = stepCollector.collectScenarioSteps(asList(steps), new Scenario(asList("my step")),
                parameters);

        // Then
        assertThat(executableSteps.size(), equalTo(1));
        assertThat(executableSteps.get(0), equalTo(executableStep));
View Full Code Here

        when(steps.listCandidates()).thenReturn(asList(candidate, andCandidate));

        // When
        List<Step> executableSteps = stepCollector.collectScenarioSteps(asList(steps),
                new Scenario(asList(myStep, myAndStep)), parameters);

        // Then
        assertThat(executableSteps.size(), equalTo(2));
    }
View Full Code Here

        when(compositeCandidate.isComposite()).thenReturn(true);
        when(compositeCandidate.createMatchedStep(compositeStepAsString, parameters)).thenReturn(
                executableCompositeStep);

        // When
        stepCollector.collectScenarioSteps(asList(steps), new Scenario(
                asList(compositeStepAsString)), parameters);

        // Then
        verify(compositeCandidate, times(1)).addComposedSteps(Mockito.eq(new ArrayList<Step>()), Mockito.eq(compositeStepAsString), Mockito.eq(parameters), Mockito.eq(allCandidates));
    }
View Full Code Here

        String andWhenPendingStep = "And a when pending step";
        when(steps.listCandidates()).thenReturn(Arrays.<StepCandidate> asList());

        // When
        List<Step> executableSteps = stepCollector.collectScenarioSteps(asList(steps),
                new Scenario(asList(givenPendingStep, andGivenPendingStep, whenPendingStep, andWhenPendingStep)),
                parameters);
        // Then
        assertThat(executableSteps.size(), equalTo(4));
        assertIsPending(executableSteps.get(0), givenPendingStep, null);
        assertIsPending(executableSteps.get(1), andGivenPendingStep, givenPendingStep);
View Full Code Here

        when(steps.listCandidates()).thenReturn(
                asList(firstCandidate, secondCandidate, thirdCandidate, fourthCandidate));

        // When
        List<Step> executableSteps = stepCollector.collectScenarioSteps(asList(steps),
                new Scenario(asList(givenPendingStep, andGivenPendingStep, whenPendingStep, andWhenPendingStep)),
                parameters);
        // Then
        assertThat(executableSteps.size(), equalTo(4));
        assertIsPending(executableSteps.get(0), givenPendingStep, null);
        assertIsPending(executableSteps.get(1), andGivenPendingStep, givenPendingStep);
View Full Code Here

        String stepAsString = "my ignorable step";
        when(candidate.ignore(stepAsString)).thenReturn(true);
        when(steps.listCandidates()).thenReturn(asList(candidate));

        // When
        List<Step> executableSteps = stepCollector.collectScenarioSteps(asList(steps), new Scenario(
                asList(stepAsString)), parameters);
        // Then
        assertThat(executableSteps.size(), equalTo(1));
        StepResult result = executableSteps.get(0).perform(null);
        assertThat(result, Matchers.instanceOf(Ignorable.class));
View Full Code Here

        when(candidate4.createMatchedStep(stepAsString, parameters)).thenReturn(step4);

        // When we collect the list of steps
        StepCollector stepCollector = new MarkUnmatchedStepsAsPending();
        List<Step> steps = stepCollector.collectScenarioSteps(asList(steps1, steps2),
                new Scenario(asList(stepAsString)), parameters);

        // Then the step with highest priority is returned
        assertThat(step4, equalTo(steps.get(0)));
    }
View Full Code Here

TOP

Related Classes of org.jbehave.core.model.Scenario

Copyright © 2018 www.massapicom. 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.