Examples of GivenStories


Examples of org.jbehave.core.model.GivenStories

            this.outputScenario.givenStories = givenStories;
        }
    }

    public void givenStories(List<String> storyPaths) {
        givenStories(new GivenStories(StringUtils.join(storyPaths, ",")));
    }
View Full Code Here

Examples of org.jbehave.core.model.GivenStories

        }
        print(format("givenStoriesEnd", "\n"));
    }

    public void givenStories(List<String> storyPaths) {
        givenStories(new GivenStories(StringUtils.join(storyPaths, ",")));
    }
View Full Code Here

Examples of org.jbehave.core.model.GivenStories

            "|11|12|" + NL +
            "|21|22|";
        Story story = parser.parseStory(wholeStory, storyPath);

        Scenario scenario = story.getScenarios().get(0);
        GivenStories givenStories = scenario.getGivenStories();
        assertThat(givenStories.asString(), equalTo("path/to/one#{0}, path/to/two#{1}, path/to/three#{2}, path/to/four#{a}, path/to/five"));
        assertThat(givenStories.toString(), containsString(givenStories.asString()));
        assertThat(givenStories.getPaths(), equalTo(asList(
                "path/to/one#{0}", // matches first parameters row
                "path/to/two#{1}", // matches second parameters row
                "path/to/three#{2}", // does not match any parameters row
                "path/to/four#{a}", // does not use valid anchor (an int)
                "path/to/five"))); // does not require parameters
        assertThat(givenStories.requireParameters(), equalTo(true));
        GivenStory givenStory1 = givenStories.getStories().get(0);
        assertThat(givenStory1.hasAnchor(), equalTo(true));
        assertThat(givenStory1.getAnchor(), equalTo("0"));
        assertThat(givenStory1.getPath(), equalTo("path/to/one"));
        assertThat(givenStory1.getParameters().get("one"), equalTo("11"));
        assertThat(givenStory1.getParameters().get("two"), equalTo("12"));
        GivenStory givenStory2 = givenStories.getStories().get(1);
        assertThat(givenStory2.hasAnchor(), equalTo(true));
        assertThat(givenStory2.getAnchor(), equalTo("1"));
        assertThat(givenStory2.getPath(), equalTo("path/to/two"));
        assertThat(givenStory2.getParameters().get("one"), equalTo("21"));
        assertThat(givenStory2.getParameters().get("two"), equalTo("22"));
        GivenStory givenStory3 = givenStories.getStories().get(2);
        assertThat(givenStory3.hasAnchor(), equalTo(true));
        assertThat(givenStory3.getAnchor(), equalTo("2"));
        assertThat(givenStory3.getPath(), equalTo("path/to/three"));
        assertThat(givenStory3.getParameters().size(), equalTo(0));
        GivenStory givenStory4 = givenStories.getStories().get(3);
        assertThat(givenStory4.hasAnchor(), equalTo(true));
        assertThat(givenStory4.getAnchor(), equalTo("a"));
        assertThat(givenStory4.getPath(), equalTo("path/to/four"));
        assertThat(givenStory4.getParameters().size(), equalTo(0));
        GivenStory givenStory5 = givenStories.getStories().get(4);
        assertThat(givenStory5.hasAnchor(), equalTo(false));
        assertThat(givenStory5.getAnchor(), equalTo(""));
        assertThat(givenStory5.getPath(), equalTo("path/to/five"));
        assertThat(givenStory5.getParameters().size(), equalTo(0));
    }
View Full Code Here

Examples of org.jbehave.core.model.GivenStories

        // When
        decorator.dryRun();
        decorator.beforeStory(story, givenStory);
        decorator.beforeScenario("My core 1");
        GivenStories givenStories = new GivenStories("/path1,/path2");
        decorator.givenStories(givenStories);
        decorator.ignorable("!-- ignore me");
        decorator.successful("Given step 1.1");
        decorator.pending("When step 1.2");
        decorator.notPerformed("Then step 1.3");
View Full Code Here

Examples of org.jbehave.core.model.GivenStories

    public void shouldDelegateReporterEvents() {
        // Given
        StoryReporter delegate = mock(StoryReporter.class);
        DelegatingStoryReporter delegator = new DelegatingStoryReporter(delegate);
        List<String> givenStoryPaths = asList("path/to/story1", "path/to/story2");
        GivenStories givenStories = new GivenStories(StringUtils.join(givenStoryPaths, ","));
        ExamplesTable examplesTable = new ExamplesTable("|one|two|\n|1|2|\n");
        UUIDExceptionWrapper anException = new UUIDExceptionWrapper(new IllegalArgumentException());
        Story story = new Story();
        boolean givenStory = false;
        Scenario scenario = new Scenario();
View Full Code Here

Examples of org.jbehave.core.model.GivenStories

    }
   
    @Test
    public void shouldRunGivenStoriesAtStoryAndScenarioLevel() throws Throwable {
        // Given
        GivenStories storyGivenStories = new GivenStories("/path/to/given/story1");
        GivenStories scenarioGivenStories = new GivenStories("/path/to/given/story1");
        Scenario scenario1 = new Scenario("scenario 1", asList("successfulStep"));
        Scenario scenario2 = new Scenario("scenario 2", Meta.EMPTY, scenarioGivenStories, ExamplesTable.EMPTY,
                asList("anotherSuccessfulStep"));
        Story story1 = new Story(new Description("story 1"), Narrative.EMPTY, asList(scenario1));
        Story story2 = new Story("", new Description("story 2"), Meta.EMPTY, Narrative.EMPTY, storyGivenStories, asList(scenario2));
View Full Code Here

Examples of org.jbehave.core.model.GivenStories

    @Test
  public void shouldIgnoreMetaFilteringInGivenStoriesIfConfigured()
      throws Throwable {
    // Given
    Scenario scenario = new Scenario("scenario", new Meta(
        asList("run false")), new GivenStories("/path/to/given/story"),
        ExamplesTable.EMPTY, asList("anotherSuccessfulStep"));
    Story story = new Story("", new Description("story"), new Meta(
        asList("run false")), Narrative.EMPTY, new GivenStories(
        "/path/to/given/story"), asList(scenario));

    // When
    MetaFilter filter = new MetaFilter("+run true");
    FilteredStory ignoreMeta = new FilteredStory(filter, story,
View Full Code Here

Examples of org.jbehave.core.model.GivenStories

    @Test
    public void shouldAllowToSkipBeforeAndAfterScenarioStepsIfGivenStory() throws Throwable {
        // Given
        Scenario scenario1 = new Scenario("scenario 1", asList("successfulStep"));
        GivenStories givenStories = new GivenStories("/path/to/given/story1");
        Scenario scenario2 = new Scenario("scenario 2", Meta.EMPTY, givenStories, ExamplesTable.EMPTY,
                asList("anotherSuccessfulStep"));
        Story story1 = new Story(new Description("story 1"), Narrative.EMPTY, asList(scenario1));
        Story story2 = new Story(new Description("story 2"), Narrative.EMPTY, asList(scenario2));
View Full Code Here

Examples of org.jbehave.core.model.GivenStories

        StoryReporter delegate = mock(StoryReporter.class);
        SilentSuccessFilter filter = new SilentSuccessFilter(delegate);
        ExamplesTable examplesTable = new ExamplesTable("|one|two|\n|1|2|\n");
        UUIDExceptionWrapper anException = new UUIDExceptionWrapper(new IllegalArgumentException());
        Story story = new Story();
        GivenStories givenStories = new GivenStories("path/to/story1,path/to/story2");
        List<String> givenStoryPaths = asList("path/to/story1","path/to/story2");

        // When
        filter.dryRun();
        filter.beforeStory(story, false);
View Full Code Here

Examples of org.jbehave.core.model.GivenStories

    public Story parseStory(String storyAsText, String storyPath) {
        Description description = parseDescriptionFrom(storyAsText);
        Meta meta = parseStoryMetaFrom(storyAsText);
        Narrative narrative = parseNarrativeFrom(storyAsText);
        GivenStories givenStories = parseGivenStories(storyAsText);
        Lifecycle lifecycle = parseLifecycle(storyAsText);
        List<Scenario> scenarios = parseScenariosFrom(storyAsText);
        Story story = new Story(storyPath, description, meta, narrative, givenStories, lifecycle, scenarios);
        if (storyPath != null) {
            story.namedAs(new File(storyPath).getName());
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.